blob: 06f9f305bfb8851f81e9819ca615c508dcf75ed9 [file] [log] [blame]
Harald Welte794d9b22009-02-17 02:02:14 +00001E1 related data model
2
3This data model describes the physical relationship of the individual
4parts in the network, it is not the logical/protocol side of the GSM
5network.
6
7A BTS is connected to the BSC by some physical link. It could be an actual
8E1 link, but it could also be abis-over-IP with a mixture of TCP and RTP/UDP.
9
10To further complicate the fact, multiple BTS can share one such pysical
Martin Haukea29affd2019-11-13 22:10:41 +010011link. On a single E1 line, we can easily accommodate up to three BTS with
Harald Welte794d9b22009-02-17 02:02:14 +000012two TRX each.
13
14Thus, it is best for OpenBSC to have some kind of abstraction layer. The BSC's
15view of a BTS connected to it. We call this 'bts_link'. A bts_link can be
16* all the TCP and UDP streams of a Abis-over-IP BTS
17* a set of E1 timeslots for OML, RSL and TRAU connections on a E1 link
18* a serial line exclusively used for OML messages (T-Link)
19
20A bts_link can be registered with the OpenBSC core at runtime.
21
22struct trx_link {
23 struct gsm_bts_trx *trx;
24};
25
26struct bts_link {
27 struct gsm_bts *bts;
28 struct trx_link trx_links[NUM_TRX];
29};
30
31Interface from stack to input core:
32======================================================================
33int abis_rsl_sendmsg(struct msgb *msg);
34 send a message through a RSL link to the TRX specified by the caller in
35 msg->trx.
36
37int abis_rsl_rcvmsg(struct msgb *msg);
38 receive a message from a RSL link from the TRX specified by the
39 caller in msg->trx.
40
41int abis_nm_sendmsg(struct msgb *msg);
42 send a message through a OML link to the BTS specified by the caller in
43 msg->trx->bts. The caller can just use bts->c0 to get the first TRX
44 in a BTS. (OML messages are not really sent to a TRX but to the BTS)
45
46int abis_nm_rcvmsg(struct msgb *msg);
47 receive a message from a OML link from the BTS specified by the caller
48 in msg->trx->bts. The caller can just use bts->c0 to get the first
49 TRX in a BTS.
50
51int abis_link_event(int event, void *data);
52 signal some event (such as layer 1 connect/disconnect) from the
53 input core to the stack.
54
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020055int subch_demux_in(mx, const uint8_t *data, int len);
Harald Welte794d9b22009-02-17 02:02:14 +000056 receive 'len' bytes from a given E1 timeslot (TRAU frames)
57
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +020058int subchan_mux_out(mx, uint8_t *data, int len);
Harald Welte794d9b22009-02-17 02:02:14 +000059 obtain 'len' bytes of output data to be sent on E1 timeslot
60
61Intrface by Input Core for Input Plugins
62======================================================================
63
64int btslink_register_plugin();
65
66
67Configuration for the E1 input module
68======================================================================
69
70BTS
71 BTS number
72 number of TRX
73 OML link
74 E1 line number
75 timeslot number
76 [subslot number]
77 SAPI
78 TEI
79 for each TRX
80 RSL link
81 E1 line number
82 timeslot number
83 [subslot number]
84 SAPI
85 TEI
86 for each TS
87 E1 line number
88 timeslot number
89 subslot number
90
91
92E1 input module data model
93======================================================================
94
95
96enum e1inp_sign_type {
97 E1INP_SIGN_NONE,
98 E1INP_SIGN_OML,
99 E1INP_SIGN_RSL,
100};
101
102struct e1inp_sign_link {
103 /* list of signalling links */
104 struct llist_head list;
105
106 enum e1inp_sign_type type;
107
108 /* trx for msg->trx of received msgs */
109 struct gsm_bts_trx *trx;
110
111 /* msgb queue of to-be-transmitted msgs */
112 struct llist_head tx_list;
113
114 /* SAPI and TEI on the E1 TS */
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +0200115 uint8_t sapi;
116 uint8_t tei;
Harald Welte794d9b22009-02-17 02:02:14 +0000117}
118
119enum e1inp_ts_type {
120 E1INP_TS_TYPE_NONE,
121 E1INP_TS_TYPE_SIGN,
122 E1INP_TS_TYPE_TRAU,
123};
124
125/* A timeslot in the E1 interface */
126struct e1inp_ts {
127 enum e1inp_ts_type type;
128 struct e1inp_line *line;
129 union {
130 struct {
131 struct llist_head sign_links;
132 } sign;
133 struct {
134 /* subchannel demuxer for frames from E1 */
135 struct subch_demux demux;
136 /* subchannel muxer for frames to E1 */
137 struct subch_mux mux;
138 } trau;
139 };
140 union {
141 struct {
142 /* mISDN driver has one fd for each ts */
Pablo Neira Ayuso4db92992011-05-06 12:11:23 +0200143 struct osmo_fd;
Harald Welte794d9b22009-02-17 02:02:14 +0000144 } misdn;
145 } driver;
146};
147
148struct e1inp_line {
149 unsigned int num;
150 char *name;
151
152 struct e1inp_ts ts[NR_E1_TS];
153
154 char *e1inp_driver;
155 void *driver_data;
156};
157
158/* Call from the Stack: configuration of this TS has changed */
159int e1inp_update_ts(struct e1inp_ts *ts);
160
161/* Receive a packet from the E1 driver */
162int e1inp_rx_ts(struct e1inp_ts *ts, struct msgb *msg,
Holger Hans Peter Freytherc42ad8b2011-04-18 17:04:00 +0200163 uint8_t tei, uint8_t sapi);
Harald Welte794d9b22009-02-17 02:02:14 +0000164
165/* Send a packet, callback function in the driver */
166int e1driver_tx_ts(struct e1inp_ts *ts, struct msgb *msg)
167
168
169struct e1inp_driver {
170 const char *name;
171 int (*want_write)(struct e1inp_ts *ts);
172};