diff options
author | Harald Welte <laforge@gnumonks.org> | 2008-12-25 23:28:35 +0000 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2008-12-25 23:28:35 +0000 |
commit | 8470bf200de094ec362f3f7565ab3ccdf26ee664 (patch) | |
tree | 9a4d95be83b5f727f4ae4e3ab7b2cd4a6be7f72b /include/openbsc | |
parent | de729a139ecdb3b1d88cd5c50738749e8b1c9dcd (diff) |
no reasonable commit message possible. tons of changes of the last 2 days
Diffstat (limited to 'include/openbsc')
-rw-r--r-- | include/openbsc/abis_nm.h | 4 | ||||
-rw-r--r-- | include/openbsc/abis_rsl.h | 12 | ||||
-rw-r--r-- | include/openbsc/chan_alloc.h | 22 | ||||
-rw-r--r-- | include/openbsc/gsm_04_08.h | 7 | ||||
-rw-r--r-- | include/openbsc/gsm_data.h | 56 | ||||
-rw-r--r-- | include/openbsc/gsm_subscriber.h | 2 | ||||
-rw-r--r-- | include/openbsc/msgb.h | 27 | ||||
-rw-r--r-- | include/openbsc/select.h | 5 |
8 files changed, 127 insertions, 8 deletions
diff --git a/include/openbsc/abis_nm.h b/include/openbsc/abis_nm.h index 1108aa443..ca4de85a4 100644 --- a/include/openbsc/abis_nm.h +++ b/include/openbsc/abis_nm.h @@ -275,7 +275,7 @@ enum abis_nm_chan_comb { }; /* Section 9.4.1 */ -struct abis_nm_abis_channel { +struct abis_nm_channel { u_int8_t attrib; u_int8_t bts_port; u_int8_t timeslot; @@ -294,7 +294,7 @@ struct abis_nm_cfg { int (*sw_act_req)(struct msgb *); }; -extern int abis_nm_rx(struct msgb *msg); +extern int abis_nm_rcvmsg(struct msgb *msg); //extern struct abis_nm_h *abis_nm_init(struct abis_nm_cfg *cfg); //extern void abis_nm_fini(struct abis_nm_h *nmh); diff --git a/include/openbsc/abis_rsl.h b/include/openbsc/abis_rsl.h index 9413f6577..cbbb797fb 100644 --- a/include/openbsc/abis_rsl.h +++ b/include/openbsc/abis_rsl.h @@ -105,7 +105,7 @@ enum abis_rsl_msgtype { RSL_MT_PHY_CONTEXT_CONF, RSL_MT_RF_CHAN_REL, RSL_MT_MS_POWER_CONTROL, - RSL_MT_BS_POWER_CONTROL, + RSL_MT_BS_POWER_CONTROL, /* 0x30 */ RSL_MT_PREPROC_CONFIG, RSL_MT_PREPROC_MEAS_RES, RSL_MT_RF_CHAN_REL_ACK, @@ -290,14 +290,18 @@ int rsl_chan_activate(struct gsm_bts *bts, u_int8_t chan_nr, u_int8_t ta); int rsl_chan_activate_tch_f(struct gsm_bts_trx_ts *ts); int rsl_chan_activate_sdcch(struct gsm_bts_trx_ts *ts); -int rsl_chan_release(struct gsm_bts_trx_ts *ts, u_int8_t chan_nr); +int rsl_chan_release(struct gsm_lchan *lchan); int rsl_paging_cmd(struct gsm_bts *bts, u_int8_t paging_group, u_int8_t len, u_int8_t *ms_ident, u_int8_t chan_needed); int rsl_paging_cmd_imsi(struct gsm_bts *bts, u_int8_t chan_needed, const char *imsi_str); int rsl_imm_assign_cmd(struct gsm_bts *bts, u_int8_t len, u_int8_t *val); -int rsl_data_request(struct gsm_bts *bts, struct msgb *msg); -int abis_rsl_rx(struct msgb *msg); +int rsl_data_request(struct msgb *msg, u_int8_t link_id); + +int abis_rsl_rcvmsg(struct msgb *msg); + +/* to be provided by external code */ +int abis_rsl_sendmsg(struct msgb *msg); #endif /* RSL_MT_H */ diff --git a/include/openbsc/chan_alloc.h b/include/openbsc/chan_alloc.h new file mode 100644 index 000000000..0cbd03e72 --- /dev/null +++ b/include/openbsc/chan_alloc.h @@ -0,0 +1,22 @@ +#ifndef _CHAN_ALLOC_H +#define _CHAN_ALLOC_H + +/* Special allocator for C0 of BTS */ +struct gsm_bts_trx_ts *ts_c0_alloc(struct gsm_bts *bts, + enum gsm_phys_chan_config pchan); + +/* Regular physical channel allocator */ +struct gsm_bts_trx_ts *ts_alloc(struct gsm_bts *bts, + enum gsm_phys_chan_config pchan); + +/* Regular physical channel (TS) */ +void ts_free(struct gsm_bts_trx_ts *ts); + + +/* Allocate a logical channel (SDCCH, TCH, ...) */ +struct gsm_lchan *lchan_alloc(struct gsm_bts *bts, enum gsm_chan_t type); + +/* Free a logical channel (SDCCH, TCH, ...) */ +void lchan_free(struct gsm_lchan *lchan); + +#endif /* _CHAN_ALLOC_H */ diff --git a/include/openbsc/gsm_04_08.h b/include/openbsc/gsm_04_08.h index 7c51969dc..dc5eba9ae 100644 --- a/include/openbsc/gsm_04_08.h +++ b/include/openbsc/gsm_04_08.h @@ -235,4 +235,11 @@ struct gsm48_hdr { #define GSM_MI_TYPE_TMSI 0x04 #define GSM_MI_ODD 0x08 +struct msgb; +struct gsm_bts; + +int gsm0408_rcvmsg(struct msgb *msg); +enum gsm_chan_t get_ctype_by_chreq(struct gsm_bts *bts, u_int8_t ra); + + #endif diff --git a/include/openbsc/gsm_data.h b/include/openbsc/gsm_data.h index 51e246c2d..8bb219a11 100644 --- a/include/openbsc/gsm_data.h +++ b/include/openbsc/gsm_data.h @@ -3,8 +3,11 @@ #include <sys/types.h> +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) + #define GSM_MAX_BTS 8 #define BTS_MAX_TRX 8 +#define TS_MAX_LCHAN 8 #define HARDCODED_ARFCN 123 @@ -13,6 +16,35 @@ struct gsm_bts_link { struct gsm_bts *bts; }; +enum gsm_phys_chan_config { + GSM_PCHAN_NONE, + GSM_PCHAN_CCCH, + GSM_PCHAN_CCCH_SDCCH4, + GSM_PCHAN_TCH_F, + GSM_PCHAN_TCH_H, + GSM_PCHAN_SDCCH8_SACCH8C, + GSM_PCHAN_UNKNOWN, +}; + +enum gsm_chan_t { + GSM_LCHAN_NONE, + GSM_LCHAN_SDCCH, + GSM_LCHAN_TCH_F, + GSM_LCHAN_TCH_H, + GSM_LCHAN_UNKNOWN, +}; + +struct gsm_lchan { + /* The TS that we're part of */ + struct gsm_bts_trx_ts *ts; + /* The logical subslot number in the TS */ + u_int8_t nr; + /* The lotical channel type */ + enum gsm_chan_t type; + /* To whom we are allocated at the moment */ + struct gsm_subscriber *subscr; +}; + #define BTS_TRX_F_ACTIVATED 0x0001 /* One Timeslot in a TRX */ struct gsm_bts_trx_ts { @@ -20,7 +52,11 @@ struct gsm_bts_trx_ts { /* number of this timeslot at the TRX */ u_int8_t nr; + enum gsm_phys_chan_config pchan; + unsigned int flags; + + struct gsm_lchan lchan[TS_MAX_LCHAN]; }; /* One TRX in a BTS */ @@ -71,4 +107,24 @@ struct gsm_network { struct gsm_network *gsm_network_init(unsigned int num_bts, u_int8_t country_code, u_int8_t network_code); + +enum gsm_call_type { + GSM_CT_NONE, + GSM_CT_MO, + GSM_CT_MT, +}; + +enum gsm_call_state { + GSM_CSTATE_NONE, +}; + +/* One end of a call */ +struct gsm_call { + enum gsm_call_type type; + enum gsm_call_state state; + + /* the 'local' subscriber */ + struct gsm_subscriber *subscr; +}; + #endif diff --git a/include/openbsc/gsm_subscriber.h b/include/openbsc/gsm_subscriber.h index d5c6eff7a..5bdf57952 100644 --- a/include/openbsc/gsm_subscriber.h +++ b/include/openbsc/gsm_subscriber.h @@ -5,7 +5,7 @@ #include "gsm_data.h" struct gsm_subscriber { - u_int8_t *name; + char *name; u_int8_t tmsi[4]; }; diff --git a/include/openbsc/msgb.h b/include/openbsc/msgb.h index b0740edab..13631e7bc 100644 --- a/include/openbsc/msgb.h +++ b/include/openbsc/msgb.h @@ -20,12 +20,20 @@ * */ +#include <openbsc/linuxlist.h> + struct bts_link; struct msgb { - /* ptr to the incoming (RX) or outgoing (TX) BTS link */ + struct llist_head list; + + /* ptr to the physical E1 link to the BTS(s) */ struct gsm_bts_link *bts_link; + /* Part of which TRX logical channel we were received / transmitted */ + struct gsm_bts_trx *trx; + struct gsm_lchan *lchan; + u_int8_t l2_off; u_int8_t l3_off; @@ -40,6 +48,8 @@ struct msgb { extern struct msgb *msgb_alloc(u_int16_t size); extern void msgb_free(struct msgb *m); +extern void msgb_enqueue(struct llist_head *queue, struct msgb *msg); +extern struct msgb *msgb_dequeue(struct llist_head *queue); #define msgb_l2(m) ((void *)(m->data + m->l2_off)) #define msgb_l3(m) ((void *)(m->data + m->l3_off)) @@ -71,4 +81,19 @@ static inline int msgb_tailroom(const struct msgb *msgb) return (msgb->data + msgb->data_len) - msgb->tail; } +/* increase the headroom of an empty msgb, reducing the tailroom */ +static inline void msgb_reserve(struct msgb *msg, int len) +{ + msg->data += len; + msg->tail += len; +} + +static inline struct msgb *msgb_alloc_headroom(int size, int headroom) +{ + struct msgb *msg = msgb_alloc(size); + if (msg) + msgb_reserve(msg, headroom); + return msg; +} + #endif /* _MSGB_H */ diff --git a/include/openbsc/select.h b/include/openbsc/select.h index f98f72c61..b677162e6 100644 --- a/include/openbsc/select.h +++ b/include/openbsc/select.h @@ -1,6 +1,8 @@ #ifndef _BSC_SELECT_H #define _BSC_SELECT_H +#include <openbsc/linuxlist.h> + #define BSC_FD_READ 0x0001 #define BSC_FD_WRITE 0x0002 #define BSC_FD_EXCEPT 0x0004 @@ -14,4 +16,7 @@ struct bsc_fd { unsigned int priv_nr; }; +int bsc_register_fd(struct bsc_fd *fd); +void bsc_unregister_fd(struct bsc_fd *fd); +int bsc_select_main(void); #endif /* _BSC_SELECT_H */ |