libosmo-e1d 0.8.0.1-ed54
Osmocom e1d client library
proto.h
Go to the documentation of this file.
6/* (C) 2019 by Sylvain Munaut <tnt@246tNt.com>
7 * (C) 2020 by Harald Welte <laforge@gnumonks.org>
8 *
9 * All Rights Reserved
10 *
11 * SPDX-License-Identifier: LGPL-3.0-or-later
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU Lesser General Public License as published
15 * by the Free Software Foundation; either version 3 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU Lesser General Public License
24 * along with this program; if not, see <http://www.gnu.org/licenses/>.
25 */
26
27#pragma once
28
29#include <stdint.h>
30
31#include <osmocom/core/select.h>
32#include <osmocom/core/utils.h>
33
34
40
44
48
52
58
62
66
69
72
75
78
81
84
87
90
94
98
107};
108
119};
120
129};
130
132#define E1DP_TS_OPEN_F_FORCE 0x80
133
136#define E1DP_MAGIC 0x01e1
138#define E1DP_MAX_LEN 4096
140#define E1DP_TS_SUPERCHAN 0xfe
143#define E1DP_INVALID 0xff
145#define E1DP_DEFAULT_SOCKET "/tmp/osmo-e1d.ctl"
146
148#define E1DP_MAX_SIZE_HDLC 264
149
152 uint16_t magic; /*< magic value (E1DP_MAGIC) */
153 uint16_t len; /*< length of message (octets) */
154
155 uint8_t type; /*< message type (enum osmo_e1dp_msg_type) */
156 uint8_t intf; /*< E1 interface number (or E1DP_INVALID) */
157 uint8_t line; /*< E1 line number (or E1DP_INVALID) */
158 uint8_t ts; /*< timeslot number (or E1DP_INVALID) */
159} __attribute__((packed));
160
163 uint8_t id; /*< Numeric identifier of E1 interface */
164 uint8_t n_lines; /*< number of E1 lines within this interface */
165} __attribute__((packed));
166
169 uint8_t mode; /*< E1 line mode (enum osmo_e1dp_line_mode) */
170} __attribute__((packed));
171
174 uint8_t id; /*< E1 line number */
176 uint8_t status;
177} __attribute__((packed));
178
181 uint8_t mode; /*< timeslot mode (enum osmo_e1dp_ts_mode) */
182 uint8_t flags; /*< flags (currently only E1DP_TS_OPEN_F_FORCE) */
183 uint16_t read_bufsize; /*< size of read buffer (in octets) */
184} __attribute__((packed));
185
188 uint8_t id; /*< E1 timeslot number */
189 struct osmo_e1dp_ts_config cfg; /*< E1 timeslot configuration */
190 uint8_t status; /*< TBD */
191} __attribute__((packed));
192
195 uint8_t bits; /*< CAS value */
196 uint8_t query_rx; /*< set to 1, to query RX CAS information */
197} __attribute__((packed));
198
199
200struct msgb *osmo_e1dp_recv(struct osmo_fd *ofd, int *fd);
201int osmo_e1dp_send(struct osmo_fd *ofd, struct msgb *msgb, int fd);
202
203extern const struct value_string osmo_e1dp_msg_type_names[];
204extern const struct value_string osmo_e1dp_line_mode_names[];
205extern const struct value_string osmo_e1dp_ts_mode_names[];
struct osmo_e1dp_msg_hdr __attribute__((packed))
const struct value_string osmo_e1dp_line_mode_names[]
const struct value_string osmo_e1dp_ts_mode_names[]
osmo_e1dp_line_mode
e1d CTL protocol line mode.
Definition: proto.h:110
@ E1DP_LMODE_E1OIP
Line is used in E1oIP mode (not available to CTL clients)
Definition: proto.h:118
@ E1DP_LMODE_SUPERCHANNEL
Line is used as superchannel (31TS combined together)
Definition: proto.h:116
@ E1DP_LMODE_OFF
Line is switched off.
Definition: proto.h:112
@ E1DP_LMODE_CHANNELIZED
Line is used in channelized mode with (64kBps) timeslots.
Definition: proto.h:114
osmo_e1dp_msg_type
e1d CTL protocol message type definition.
Definition: proto.h:36
@ E1DP_CMD_TS_OPEN
Open a given E1 timeslot.
Definition: proto.h:57
@ E1DP_EVT_AIS_ON
Received alarm indication signal from interface.
Definition: proto.h:74
@ E1DP_EVT_LOF_OFF
Ceased frame loss from interface.
Definition: proto.h:89
@ E1DP_EVT_LOS_OFF
Ceased signal loss from interface.
Definition: proto.h:71
@ E1DP_CMD_SABITS
Send Sa bits to line.
Definition: proto.h:61
@ E1DP_EVT_AIS_OFF
Ceased alarm indication signal from interface.
Definition: proto.h:77
@ E1DP_CMD_LINE_CONFIG
Configure a given E1 line.
Definition: proto.h:51
@ E1DP_CMD_TS_QUERY
Query information about E1 timeslot(s).
Definition: proto.h:47
@ E1DP_EVT_LOF_ON
Received frame loss from interface.
Definition: proto.h:86
@ E1DP_EVT_TYPE
Message is an event.
Definition: proto.h:100
@ E1DP_ERR_TYPE
Message is an error.
Definition: proto.h:104
@ E1DP_CMD_CAS
Send CAS bits to line.
Definition: proto.h:65
@ E1DP_EVT_RAI_OFF
Ceased remote alarm indication from interface.
Definition: proto.h:83
@ E1DP_EVT_RAI_ON
Received remote alarm indication from interface.
Definition: proto.h:80
@ E1DP_CMD_INTF_QUERY
Query information about E1 interface(s).
Definition: proto.h:39
@ E1DP_RESP_TYPE
Message is a response
Definition: proto.h:102
@ E1DP_EVT_LOS_ON
Received signal loss from interface.
Definition: proto.h:68
@ E1DP_EVT_SABITS
Received Sa bits from interface.
Definition: proto.h:97
@ E1DP_TYPE_MSK
Mask to separate type from command.
Definition: proto.h:106
@ E1DP_CMD_LINE_QUERY
Query information about E1 line(s).
Definition: proto.h:43
@ E1DP_EVT_CAS
Received CAS bits from interface.
Definition: proto.h:93
struct msgb * osmo_e1dp_recv(struct osmo_fd *ofd, int *fd)
const struct value_string osmo_e1dp_msg_type_names[]
osmo_e1dp_ts_mode
e1d CTL protocol timeslot mode.
Definition: proto.h:122
@ E1DP_TSMODE_HDLCFCS
Timeslot is in HLDC-FCS mode; e1d will run software HDLC processor.
Definition: proto.h:128
@ E1DP_TSMODE_RAW
Timeslot is in RAW mode, containing transparent 64kBps bitstream.
Definition: proto.h:126
@ E1DP_TSMODE_OFF
Timeslot is switched off.
Definition: proto.h:124
int osmo_e1dp_send(struct osmo_fd *ofd, struct msgb *msgb, int fd)
Information about CAS bits.
Definition: proto.h:194
uint8_t query_rx
Definition: proto.h:196
uint8_t bits
Definition: proto.h:195
Information about an E1 interface.
Definition: proto.h:162
uint8_t id
Definition: proto.h:163
uint8_t n_lines
Definition: proto.h:164
Configuration of an E1 line.
Definition: proto.h:168
uint8_t mode
Definition: proto.h:169
Information about an E1 line.
Definition: proto.h:173
uint8_t status
E1 line configuration.
Definition: proto.h:176
uint8_t id
Definition: proto.h:174
struct osmo_e1dp_line_config cfg
Definition: proto.h:175
message header of osmo-e1d CTL protocol.
Definition: proto.h:151
uint8_t intf
Definition: proto.h:156
uint16_t magic
Definition: proto.h:152
uint8_t ts
Definition: proto.h:158
uint8_t line
Definition: proto.h:157
uint16_t len
Definition: proto.h:153
uint8_t type
Definition: proto.h:155
Configuration of an E1 timeslot.
Definition: proto.h:180
uint8_t flags
Definition: proto.h:182
uint16_t read_bufsize
Definition: proto.h:183
uint8_t mode
Definition: proto.h:181
Information about an E1 timeslot.
Definition: proto.h:187
uint8_t id
Definition: proto.h:188
uint8_t status
Definition: proto.h:190
struct osmo_e1dp_ts_config cfg
Definition: proto.h:189