\doxysection{proto.\+h}
\label{proto_8h_source}\index{include/osmocom/e1d/proto.h@{include/osmocom/e1d/proto.h}}
\textbf{ Go to the documentation of this file.}
\begin{DoxyCode}{0}
\DoxyCodeLine{1 }
\DoxyCodeLine{6 \textcolor{comment}{/* (C) 2019 by Sylvain Munaut <tnt@246tNt.com>}}
\DoxyCodeLine{7 \textcolor{comment}{ * (C) 2020 by Harald Welte <laforge@gnumonks.org>}}
\DoxyCodeLine{8 \textcolor{comment}{ *}}
\DoxyCodeLine{9 \textcolor{comment}{ * All Rights Reserved}}
\DoxyCodeLine{10 \textcolor{comment}{ *}}
\DoxyCodeLine{11 \textcolor{comment}{ * SPDX-\/License-\/Identifier: LGPL-\/3.0-\/or-\/later}}
\DoxyCodeLine{12 \textcolor{comment}{ *}}
\DoxyCodeLine{13 \textcolor{comment}{ * This program is free software; you can redistribute it and/or modify}}
\DoxyCodeLine{14 \textcolor{comment}{ * it under the terms of the GNU Lesser General Public License as published}}
\DoxyCodeLine{15 \textcolor{comment}{ * by the Free Software Foundation; either version 3 of the License, or}}
\DoxyCodeLine{16 \textcolor{comment}{ * (at your option) any later version.}}
\DoxyCodeLine{17 \textcolor{comment}{ *}}
\DoxyCodeLine{18 \textcolor{comment}{ * This program is distributed in the hope that it will be useful,}}
\DoxyCodeLine{19 \textcolor{comment}{ * but WITHOUT ANY WARRANTY; without even the implied warranty of}}
\DoxyCodeLine{20 \textcolor{comment}{ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the}}
\DoxyCodeLine{21 \textcolor{comment}{ * GNU General Public License for more details.}}
\DoxyCodeLine{22 \textcolor{comment}{ *}}
\DoxyCodeLine{23 \textcolor{comment}{ * You should have received a copy of the GNU Lesser General Public License}}
\DoxyCodeLine{24 \textcolor{comment}{ * along with this program; if not, see <http://www.gnu.org/licenses/>.}}
\DoxyCodeLine{25 \textcolor{comment}{ */}}
\DoxyCodeLine{26 }
\DoxyCodeLine{27 \textcolor{preprocessor}{\#pragma once}}
\DoxyCodeLine{28 }
\DoxyCodeLine{29 \textcolor{preprocessor}{\#include <stdint.h>}}
\DoxyCodeLine{30 }
\DoxyCodeLine{31 \textcolor{preprocessor}{\#include <osmocom/core/select.h>}}
\DoxyCodeLine{32 \textcolor{preprocessor}{\#include <osmocom/core/utils.h>}}
\DoxyCodeLine{33 }
\DoxyCodeLine{34 }
\DoxyCodeLine{36 \textcolor{keyword}{enum} osmo\_e1dp\_msg\_type \{}
\DoxyCodeLine{39         E1DP\_CMD\_INTF\_QUERY  = 0x00,}
\DoxyCodeLine{40 }
\DoxyCodeLine{43         E1DP\_CMD\_LINE\_QUERY  = 0x01,}
\DoxyCodeLine{44 }
\DoxyCodeLine{47         E1DP\_CMD\_TS\_QUERY      = 0x02,}
\DoxyCodeLine{48 }
\DoxyCodeLine{51         E1DP\_CMD\_LINE\_CONFIG        = 0x03,}
\DoxyCodeLine{52 }
\DoxyCodeLine{57         E1DP\_CMD\_TS\_OPEN        = 0x04,}
\DoxyCodeLine{58 }
\DoxyCodeLine{61         E1DP\_CMD\_SABITS          = 0x05,}
\DoxyCodeLine{62 }
\DoxyCodeLine{65         E1DP\_CMD\_CAS                = 0x06,}
\DoxyCodeLine{66 }
\DoxyCodeLine{68         E1DP\_EVT\_LOS\_ON          = 0x40,}
\DoxyCodeLine{69 }
\DoxyCodeLine{71         E1DP\_EVT\_LOS\_OFF        = 0x41,}
\DoxyCodeLine{72 }
\DoxyCodeLine{74         E1DP\_EVT\_AIS\_ON          = 0x42,}
\DoxyCodeLine{75 }
\DoxyCodeLine{77         E1DP\_EVT\_AIS\_OFF        = 0x43,}
\DoxyCodeLine{78 }
\DoxyCodeLine{80         E1DP\_EVT\_RAI\_ON          = 0x44,}
\DoxyCodeLine{81 }
\DoxyCodeLine{83         E1DP\_EVT\_RAI\_OFF        = 0x45,}
\DoxyCodeLine{84 }
\DoxyCodeLine{86         E1DP\_EVT\_LOF\_ON          = 0x46,}
\DoxyCodeLine{87 }
\DoxyCodeLine{89         E1DP\_EVT\_LOF\_OFF        = 0x47,}
\DoxyCodeLine{90 }
\DoxyCodeLine{93         E1DP\_EVT\_CAS                = 0x7e,}
\DoxyCodeLine{94 }
\DoxyCodeLine{97         E1DP\_EVT\_SABITS          = 0x7f,}
\DoxyCodeLine{98 }
\DoxyCodeLine{100         E1DP\_EVT\_TYPE              = 0x40,}
\DoxyCodeLine{102         E1DP\_RESP\_TYPE            = 0x80,}
\DoxyCodeLine{104         E1DP\_ERR\_TYPE              = 0xc0,}
\DoxyCodeLine{106         E1DP\_TYPE\_MSK              = 0xc0,}
\DoxyCodeLine{107 \};}
\DoxyCodeLine{108 }
\DoxyCodeLine{110 \textcolor{keyword}{enum} osmo\_e1dp\_line\_mode \{}
\DoxyCodeLine{112         E1DP\_LMODE\_OFF            = 0x00,}
\DoxyCodeLine{114         E1DP\_LMODE\_CHANNELIZED    = 0x20,}
\DoxyCodeLine{116         E1DP\_LMODE\_SUPERCHANNEL  = 0x21,}
\DoxyCodeLine{118         E1DP\_LMODE\_E1OIP        = 0x22,}
\DoxyCodeLine{119 \};}
\DoxyCodeLine{120 }
\DoxyCodeLine{122 \textcolor{keyword}{enum} osmo\_e1dp\_ts\_mode \{}
\DoxyCodeLine{124         E1DP\_TSMODE\_OFF          = 0x00,}
\DoxyCodeLine{126         E1DP\_TSMODE\_RAW          = 0x10,}
\DoxyCodeLine{128         E1DP\_TSMODE\_HDLCFCS  = 0x11,}
\DoxyCodeLine{129 \};}
\DoxyCodeLine{130 }
\DoxyCodeLine{132 \textcolor{preprocessor}{\#define E1DP\_TS\_OPEN\_F\_FORCE    0x80}}
\DoxyCodeLine{133 }
\DoxyCodeLine{136 \textcolor{preprocessor}{\#define E1DP\_MAGIC      0x01e1}}
\DoxyCodeLine{138 \textcolor{preprocessor}{\#define E1DP\_MAX\_LEN    4096}}
\DoxyCodeLine{140 \textcolor{preprocessor}{\#define E1DP\_TS\_SUPERCHAN 0xfe}}
\DoxyCodeLine{143 \textcolor{preprocessor}{\#define E1DP\_INVALID    0xff}}
\DoxyCodeLine{145 \textcolor{preprocessor}{\#define E1DP\_DEFAULT\_SOCKET "{}/tmp/osmo-\/e1d.ctl"{}}}
\DoxyCodeLine{146 }
\DoxyCodeLine{148 \textcolor{preprocessor}{\#define E1DP\_MAX\_SIZE\_HDLC      264}}
\DoxyCodeLine{149 }
\DoxyCodeLine{151 \textcolor{keyword}{struct }osmo\_e1dp\_msg\_hdr \{}
\DoxyCodeLine{152         uint16\_t magic;            \textcolor{comment}{/*< magic value (E1DP\_MAGIC) */}}
\DoxyCodeLine{153         uint16\_t len;                \textcolor{comment}{/*< length of message (octets) */}}
\DoxyCodeLine{154 }
\DoxyCodeLine{155         uint8\_t  type;              \textcolor{comment}{/*< message type (enum osmo\_e1dp\_msg\_type) */}}
\DoxyCodeLine{156         uint8\_t  intf;              \textcolor{comment}{/*< E1 interface number (or E1DP\_INVALID) */}}
\DoxyCodeLine{157         uint8\_t  line;              \textcolor{comment}{/*< E1 line number (or E1DP\_INVALID) */}}
\DoxyCodeLine{158         uint8\_t  ts;          \textcolor{comment}{/*< timeslot number (or E1DP\_INVALID) */}}
\DoxyCodeLine{159 \} \_\_attribute\_\_((packed));}
\DoxyCodeLine{160 }
\DoxyCodeLine{162 \textcolor{keyword}{struct }osmo\_e1dp\_intf\_info \{}
\DoxyCodeLine{163         uint8\_t id;           \textcolor{comment}{/*< Numeric identifier of E1 interface */}}
\DoxyCodeLine{164         uint8\_t n\_lines; \textcolor{comment}{/*< number of E1 lines within this interface */}}
\DoxyCodeLine{165 \} \_\_attribute\_\_((packed));}
\DoxyCodeLine{166 }
\DoxyCodeLine{168 \textcolor{keyword}{struct }osmo\_e1dp\_line\_config \{}
\DoxyCodeLine{169         uint8\_t mode;               \textcolor{comment}{/*< E1 line mode (enum osmo\_e1dp\_line\_mode) */}}
\DoxyCodeLine{170 \} \_\_attribute\_\_((packed));}
\DoxyCodeLine{171 }
\DoxyCodeLine{173 \textcolor{keyword}{struct }osmo\_e1dp\_line\_info \{}
\DoxyCodeLine{174         uint8\_t id;                           \textcolor{comment}{/*< E1 line number */}}
\DoxyCodeLine{175         \textcolor{keyword}{struct }osmo\_e1dp\_line\_config cfg;       }
\DoxyCodeLine{176         uint8\_t status;                           }
\DoxyCodeLine{177 \} \_\_attribute\_\_((packed));}
\DoxyCodeLine{178 }
\DoxyCodeLine{180 \textcolor{keyword}{struct }osmo\_e1dp\_ts\_config \{}
\DoxyCodeLine{181         uint8\_t mode;               \textcolor{comment}{/*< timeslot mode (enum osmo\_e1dp\_ts\_mode) */}}
\DoxyCodeLine{182         uint8\_t flags;             \textcolor{comment}{/*< flags (currently only E1DP\_TS\_OPEN\_F\_FORCE) */}}
\DoxyCodeLine{183         uint16\_t read\_bufsize;      \textcolor{comment}{/*< size of read buffer (in octets) */}}
\DoxyCodeLine{184 \} \_\_attribute\_\_((packed));}
\DoxyCodeLine{185 }
\DoxyCodeLine{187 \textcolor{keyword}{struct }osmo\_e1dp\_ts\_info \{}
\DoxyCodeLine{188         uint8\_t id;                           \textcolor{comment}{/*< E1 timeslot number */}}
\DoxyCodeLine{189         \textcolor{keyword}{struct }osmo\_e1dp\_ts\_config cfg;           \textcolor{comment}{/*< E1 timeslot configuration */}}
\DoxyCodeLine{190         uint8\_t status;                           \textcolor{comment}{/*< TBD */}}
\DoxyCodeLine{191 \} \_\_attribute\_\_((packed));}
\DoxyCodeLine{192 }
\DoxyCodeLine{194 \textcolor{keyword}{struct }osmo\_e1dp\_cas\_bits \{}
\DoxyCodeLine{195         uint8\_t bits;                               \textcolor{comment}{/*< CAS value */}}
\DoxyCodeLine{196         uint8\_t query\_rx;                       \textcolor{comment}{/*< set to 1, to query RX CAS information */}}
\DoxyCodeLine{197 \} \_\_attribute\_\_((packed));}
\DoxyCodeLine{198 }
\DoxyCodeLine{199 }
\DoxyCodeLine{200 \textcolor{keyword}{struct }msgb *osmo\_e1dp\_recv(\textcolor{keyword}{struct} osmo\_fd *ofd, \textcolor{keywordtype}{int} *fd);}
\DoxyCodeLine{201 \textcolor{keywordtype}{int} osmo\_e1dp\_send(\textcolor{keyword}{struct} osmo\_fd *ofd, \textcolor{keyword}{struct} msgb *msgb, \textcolor{keywordtype}{int} fd);}
\DoxyCodeLine{202 }
\DoxyCodeLine{203 \textcolor{keyword}{extern} \textcolor{keyword}{const} \textcolor{keyword}{struct }value\_string osmo\_e1dp\_msg\_type\_names[];}
\DoxyCodeLine{204 \textcolor{keyword}{extern} \textcolor{keyword}{const} \textcolor{keyword}{struct }value\_string osmo\_e1dp\_line\_mode\_names[];}
\DoxyCodeLine{205 \textcolor{keyword}{extern} \textcolor{keyword}{const} \textcolor{keyword}{struct }value\_string osmo\_e1dp\_ts\_mode\_names[];}

\end{DoxyCode}
