diff options
Diffstat (limited to 'openbsc/include')
| -rw-r--r-- | openbsc/include/openbsc/gprs_bssgp.h | 71 | ||||
| -rw-r--r-- | openbsc/include/openbsc/gprs_ns.h | 51 | ||||
| -rw-r--r-- | openbsc/include/openbsc/gprs_ns_frgre.h | 6 |
3 files changed, 110 insertions, 18 deletions
diff --git a/openbsc/include/openbsc/gprs_bssgp.h b/openbsc/include/openbsc/gprs_bssgp.h index d3ccb12e..e432cf75 100644 --- a/openbsc/include/openbsc/gprs_bssgp.h +++ b/openbsc/include/openbsc/gprs_bssgp.h @@ -3,6 +3,10 @@ #include <stdint.h> +/* Section 5.4.1 */ +#define BVCI_SIGNALLING 0x0000 +#define BVCI_PTM 0x0001 + /* Section 11.3.26 / Table 11.27 */ enum bssgp_pdu_type { /* PDUs between RL and BSSGP SAPs */ @@ -149,9 +153,44 @@ int bssgp_tx_status(uint8_t cause, uint16_t *bvci, struct msgb *orig_msg); /* gprs_bssgp.c */ +#define BVC_S_BLOCKED 0x0001 + +/* The per-BTS context that we keep on the SGSN side of the BSSGP link */ +struct bssgp_bvc_ctx { + struct llist_head list; + + /* parsed RA ID and Cell ID of the remote BTS */ + struct gprs_ra_id ra_id; + uint16_t cell_id; + + /* NSEI and BVCI of underlying Gb link. Together they + * uniquely identify a link to a BTS (5.4.4) */ + uint16_t bvci; + uint16_t nsei; + + uint32_t state; + + struct rate_ctr_group *ctrg; + + /* we might want to add this as a shortcut later, avoiding the NSVC + * lookup for every packet, similar to a routing cache */ + //struct gprs_nsvc *nsvc; +}; +extern struct llist_head bssgp_bvc_ctxts; +/* Find a BTS Context based on parsed RA ID and Cell ID */ +struct bssgp_bvc_ctx *btsctx_by_raid_cid(const struct gprs_ra_id *raid, uint16_t cid); +/* Find a BTS context based on BVCI+NSEI tuple */ +struct bssgp_bvc_ctx *btsctx_by_bvci_nsei(uint16_t bvci, uint16_t nsei); + #include <osmocore/tlv.h> -extern int gprs_bssgp_rcvmsg(struct msgb *msg); +/* BSSGP-UL-UNITDATA.ind */ +int gprs_bssgp_rcvmsg(struct msgb *msg); + +/* BSSGP-DL-UNITDATA.req */ +struct sgsn_mm_ctx; +int gprs_bssgp_tx_dl_ud(struct msgb *msg, struct sgsn_mm_ctx *mmctx); + uint16_t bssgp_parse_cell_id(struct gprs_ra_id *raid, const uint8_t *buf); /* Wrapper around TLV parser to parse BSSGP IEs */ @@ -160,4 +199,34 @@ static inline int bssgp_tlv_parse(struct tlv_parsed *tp, uint8_t *buf, int len) return tlv_parse(tp, &tvlv_att_def, buf, len, 0, 0); } +enum bssgp_paging_mode { + BSSGP_PAGING_PS, + BSSGP_PAGING_CS, +}; + +enum bssgp_paging_scope { + BSSGP_PAGING_BSS_AREA, /* all cells in BSS */ + BSSGP_PAGING_LOCATION_AREA, /* all cells in LA */ + BSSGP_PAGING_ROUTEING_AREA, /* all cells in RA */ + BSSGP_PAGING_BVCI, /* one cell */ +}; + +struct bssgp_paging_info { + enum bssgp_paging_mode mode; + enum bssgp_paging_scope scope; + struct gprs_ra_id raid; + uint16_t bvci; + const char *imsi; + uint32_t *ptmsi; + uint16_t drx_params; + uint8_t qos[3]; +}; + +/* Send a single GMM-PAGING.req to a given NSEI/NS-BVCI */ +int gprs_bssgp_tx_paging(uint16_t nsei, uint16_t ns_bvci, + struct bssgp_paging_info *pinfo); + +/* gprs_bssgp_vty.c */ +int gprs_bssgp_vty_init(void); + #endif /* _GPRS_BSSGP_H */ diff --git a/openbsc/include/openbsc/gprs_ns.h b/openbsc/include/openbsc/gprs_ns.h index 4ccf4c7b..953c364b 100644 --- a/openbsc/include/openbsc/gprs_ns.h +++ b/openbsc/include/openbsc/gprs_ns.h @@ -107,6 +107,7 @@ enum ns_timeout { enum gprs_ns_ll { GPRS_NS_LL_UDP, GPRS_NS_LL_E1, + GPRS_NS_LL_FR_GRE, }; enum gprs_ns_evt { @@ -130,15 +131,18 @@ struct gprs_ns_inst { uint16_t timeout[NS_TIMERS_COUNT]; - /* which link-layer are we based on? */ - enum gprs_ns_ll ll; - - union { - /* NS-over-IP specific bits */ - struct { - struct bsc_fd fd; - } nsip; - }; + /* NS-over-IP specific bits */ + struct { + struct bsc_fd fd; + uint32_t local_ip; + uint16_t local_port; + } nsip; + /* NS-over-FR-over-GRE-over-IP specific bits */ + struct { + struct bsc_fd fd; + uint32_t local_ip; + int enabled:1; + } frgre; }; enum nsvc_timer_mode { @@ -168,10 +172,16 @@ struct gprs_nsvc { struct rate_ctr_group *ctrg; + /* which link-layer are we based on? */ + enum gprs_ns_ll ll; + union { struct { struct sockaddr_in bts_addr; } ip; + struct { + struct sockaddr_in bts_addr; + } frgre; }; }; @@ -181,15 +191,11 @@ struct gprs_ns_inst *gprs_ns_instantiate(gprs_ns_cb_t *cb); /* Destroy a NS protocol instance */ void gprs_ns_destroy(struct gprs_ns_inst *nsi); -/* Listen for incoming GPRS packets */ -int nsip_listen(struct gprs_ns_inst *nsi, uint16_t udp_port); +/* Listen for incoming GPRS packets via NS/UDP */ +int gprs_ns_nsip_listen(struct gprs_ns_inst *nsi); struct sockaddr_in; -/* main entry point, here incoming NS frames enter */ -int gprs_ns_rcvmsg(struct gprs_ns_inst *nsi, struct msgb *msg, - struct sockaddr_in *saddr); - /* main function for higher layers (BSSGP) to send NS messages */ int gprs_ns_sendmsg(struct gprs_ns_inst *nsi, struct msgb *msg); @@ -197,8 +203,8 @@ int gprs_ns_tx_reset(struct gprs_nsvc *nsvc, uint8_t cause); int gprs_ns_tx_block(struct gprs_nsvc *nsvc, uint8_t cause); int gprs_ns_tx_unblock(struct gprs_nsvc *nsvc); -/* Listen for incoming GPRS packets */ -int nsip_listen(struct gprs_ns_inst *nsi, uint16_t udp_port); +/* Listen for incoming GPRS packets via NS/FR/GRE */ +int gprs_ns_frgre_listen(struct gprs_ns_inst *nsi); /* Establish a connection (from the BSS) to the SGSN */ struct gprs_nsvc *nsip_connect(struct gprs_ns_inst *nsi, @@ -208,8 +214,19 @@ struct gprs_nsvc *nsip_connect(struct gprs_ns_inst *nsi, struct gprs_nsvc *nsvc_create(struct gprs_ns_inst *nsi, uint16_t nsvci); void nsvc_delete(struct gprs_nsvc *nsvc); struct gprs_nsvc *nsvc_by_nsei(struct gprs_ns_inst *nsi, uint16_t nsei); +struct gprs_nsvc *nsvc_by_nsvci(struct gprs_ns_inst *nsi, uint16_t nsvci); + +/* Initiate a RESET procedure (including timer start, ...)*/ +void gprs_nsvc_reset(struct gprs_nsvc *nsvc, uint8_t cause); /* Add NS-specific VTY stuff */ int gprs_ns_vty_init(struct gprs_ns_inst *nsi); +#define NS_ALLOC_SIZE 2048 +#define NS_ALLOC_HEADROOM 20 +static inline struct msgb *gprs_ns_msgb_alloc(void) +{ + return msgb_alloc_headroom(NS_ALLOC_SIZE, NS_ALLOC_HEADROOM, "GPRS/NS"); +} + #endif diff --git a/openbsc/include/openbsc/gprs_ns_frgre.h b/openbsc/include/openbsc/gprs_ns_frgre.h new file mode 100644 index 00000000..abcd43ff --- /dev/null +++ b/openbsc/include/openbsc/gprs_ns_frgre.h @@ -0,0 +1,6 @@ +#ifndef _GPRS_NS_FRGRE_H +#define _GPRS_NS_FRGRE_H + +int gprs_ns_frgre_sendmsg(struct gprs_nsvc *nsvc, struct msgb *msg); + +#endif |
