Harald Welte | f78a3b2 | 2010-06-30 17:21:19 +0200 | [diff] [blame] | 1 | #ifndef _INT_SNDCP_H |
| 2 | #define _INT_SNDCP_H |
| 3 | |
| 4 | #include <stdint.h> |
Harald Welte | d36ff76 | 2011-03-23 18:26:56 +0100 | [diff] [blame] | 5 | #include <osmocom/core/linuxlist.h> |
Harald Welte | f78a3b2 | 2010-06-30 17:21:19 +0200 | [diff] [blame] | 6 | |
| 7 | /* A fragment queue header, maintaining list of fragments for one N-PDU */ |
| 8 | struct defrag_state { |
| 9 | /* PDU number for which the defragmentation state applies */ |
| 10 | uint16_t npdu; |
| 11 | /* highest segment number we have received so far */ |
| 12 | uint8_t highest_seg; |
| 13 | /* bitmask of the segments we already have */ |
| 14 | uint32_t seg_have; |
| 15 | /* do we still expect more segments? */ |
| 16 | unsigned int no_more; |
| 17 | /* total length of all segments together */ |
| 18 | unsigned int tot_len; |
| 19 | |
| 20 | /* linked list of defrag_queue_entry: one for each fragment */ |
| 21 | struct llist_head frag_list; |
| 22 | |
Pablo Neira Ayuso | bf540cb | 2011-05-06 12:11:06 +0200 | [diff] [blame] | 23 | struct osmo_timer_list timer; |
Philipp | f1f3436 | 2016-08-26 17:00:21 +0200 | [diff] [blame] | 24 | |
| 25 | /* Holds state to know which compression mode is used |
| 26 | * when the packet is re-assembled */ |
| 27 | uint8_t pcomp; |
| 28 | uint8_t dcomp; |
| 29 | |
| 30 | /* Holds the pointers to the compression entity list |
| 31 | * that is used when the re-assembled packet is decompressed */ |
| 32 | struct llist_head *proto; |
| 33 | struct llist_head *data; |
Harald Welte | f78a3b2 | 2010-06-30 17:21:19 +0200 | [diff] [blame] | 34 | }; |
| 35 | |
| 36 | /* See 6.7.1.2 Reassembly */ |
| 37 | enum sndcp_rx_state { |
| 38 | SNDCP_RX_S_FIRST, |
| 39 | SNDCP_RX_S_SUBSEQ, |
| 40 | SNDCP_RX_S_DISCARD, |
| 41 | }; |
| 42 | |
| 43 | struct gprs_sndcp_entity { |
| 44 | struct llist_head list; |
| 45 | |
Harald Welte | 8911cef | 2010-07-01 19:56:19 +0200 | [diff] [blame] | 46 | /* FIXME: move this RA_ID up to the LLME or even higher */ |
| 47 | struct gprs_ra_id ra_id; |
Harald Welte | f78a3b2 | 2010-06-30 17:21:19 +0200 | [diff] [blame] | 48 | /* reference to the LLC Entity below this SNDCP entity */ |
| 49 | struct gprs_llc_lle *lle; |
| 50 | /* The NSAPI we shall use on top of LLC */ |
| 51 | uint8_t nsapi; |
| 52 | |
| 53 | /* NPDU number for the GTP->SNDCP side */ |
| 54 | uint16_t tx_npdu_nr; |
| 55 | /* SNDCP eeceiver state */ |
| 56 | enum sndcp_rx_state rx_state; |
| 57 | /* The defragmentation queue */ |
| 58 | struct defrag_state defrag; |
| 59 | }; |
| 60 | |
| 61 | extern struct llist_head gprs_sndcp_entities; |
| 62 | |
Philipp | f1f3436 | 2016-08-26 17:00:21 +0200 | [diff] [blame] | 63 | /* Set of SNDCP-XID negotiation (See also: TS 144 065, |
| 64 | * Section 6.8 XID parameter negotiation) */ |
| 65 | int sndcp_sn_xid_req(struct gprs_llc_lle *lle, uint8_t nsapi); |
| 66 | |
| 67 | /* Process SNDCP-XID indication (See also: TS 144 065, |
| 68 | * Section 6.8 XID parameter negotiation) */ |
| 69 | int sndcp_sn_xid_ind(struct gprs_llc_xid_field *xid_field_indication, |
| 70 | struct gprs_llc_xid_field *xid_field_response, |
| 71 | struct gprs_llc_lle *lle); |
| 72 | |
| 73 | /* Process SNDCP-XID indication |
| 74 | * (See also: TS 144 065, Section 6.8 XID parameter negotiation) */ |
| 75 | int sndcp_sn_xid_conf(struct gprs_llc_xid_field *xid_field_conf, |
| 76 | struct gprs_llc_xid_field *xid_field_request, |
| 77 | struct gprs_llc_lle *lle); |
| 78 | |
Harald Welte | f78a3b2 | 2010-06-30 17:21:19 +0200 | [diff] [blame] | 79 | #endif /* INT_SNDCP_H */ |