Harald Welte | 1da5d23 | 2009-02-17 02:02:14 +0000 | [diff] [blame] | 1 | E1 related data model |
| 2 | |
| 3 | This data model describes the physical relationship of the individual |
| 4 | parts in the network, it is not the logical/protocol side of the GSM |
| 5 | network. |
| 6 | |
| 7 | A BTS is connected to the BSC by some physical link. It could be an actual |
| 8 | E1 link, but it could also be abis-over-IP with a mixture of TCP and RTP/UDP. |
| 9 | |
| 10 | To further complicate the fact, multiple BTS can share one such pysical |
| 11 | link. On a single E1 line, we can easily accomodate up to three BTS with |
| 12 | two TRX each. |
| 13 | |
| 14 | Thus, it is best for OpenBSC to have some kind of abstraction layer. The BSC's |
| 15 | view 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 | |
| 20 | A bts_link can be registered with the OpenBSC core at runtime. |
| 21 | |
| 22 | struct trx_link { |
| 23 | struct gsm_bts_trx *trx; |
| 24 | }; |
| 25 | |
| 26 | struct bts_link { |
| 27 | struct gsm_bts *bts; |
| 28 | struct trx_link trx_links[NUM_TRX]; |
| 29 | }; |
| 30 | |
| 31 | Interface from stack to input core: |
| 32 | ====================================================================== |
| 33 | int 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 | |
| 37 | int 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 | |
| 41 | int 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 | |
| 46 | int 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 | |
| 51 | int 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 | |
| 55 | int subch_demux_in(mx, const u_int8_t *data, int len); |
| 56 | receive 'len' bytes from a given E1 timeslot (TRAU frames) |
| 57 | |
| 58 | int subchan_mux_out(mx, u_int8_t *data, int len); |
| 59 | obtain 'len' bytes of output data to be sent on E1 timeslot |
| 60 | |
| 61 | Intrface by Input Core for Input Plugins |
| 62 | ====================================================================== |
| 63 | |
| 64 | int btslink_register_plugin(); |
| 65 | |
| 66 | |
| 67 | Configuration for the E1 input module |
| 68 | ====================================================================== |
| 69 | |
| 70 | BTS |
| 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 | |
| 92 | E1 input module data model |
| 93 | ====================================================================== |
| 94 | |
| 95 | |
| 96 | enum e1inp_sign_type { |
| 97 | E1INP_SIGN_NONE, |
| 98 | E1INP_SIGN_OML, |
| 99 | E1INP_SIGN_RSL, |
| 100 | }; |
| 101 | |
| 102 | struct 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 */ |
| 115 | u_int8_t sapi; |
| 116 | u_int8_t tei; |
| 117 | } |
| 118 | |
| 119 | enum 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 */ |
| 126 | struct 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 */ |
| 143 | struct bsc_fd; |
| 144 | } misdn; |
| 145 | } driver; |
| 146 | }; |
| 147 | |
| 148 | struct 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 */ |
| 159 | int e1inp_update_ts(struct e1inp_ts *ts); |
| 160 | |
| 161 | /* Receive a packet from the E1 driver */ |
| 162 | int e1inp_rx_ts(struct e1inp_ts *ts, struct msgb *msg, |
| 163 | u_int8_t tei, u_int8_t sapi); |
| 164 | |
| 165 | /* Send a packet, callback function in the driver */ |
| 166 | int e1driver_tx_ts(struct e1inp_ts *ts, struct msgb *msg) |
| 167 | |
| 168 | |
| 169 | struct e1inp_driver { |
| 170 | const char *name; |
| 171 | int (*want_write)(struct e1inp_ts *ts); |
| 172 | }; |