blob: d970240e43cc1afb01ba5a41c89c18060b5f3dd7 [file] [log] [blame]
Harald Weltef78a3b22010-06-30 17:21:19 +02001#ifndef _INT_SNDCP_H
2#define _INT_SNDCP_H
3
4#include <stdint.h>
Harald Welted36ff762011-03-23 18:26:56 +01005#include <osmocom/core/linuxlist.h>
Harald Weltef78a3b22010-06-30 17:21:19 +02006
7/* A fragment queue header, maintaining list of fragments for one N-PDU */
8struct 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 Ayusobf540cb2011-05-06 12:11:06 +020023 struct osmo_timer_list timer;
Philippf1f34362016-08-26 17:00:21 +020024
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 Weltef78a3b22010-06-30 17:21:19 +020034};
35
36/* See 6.7.1.2 Reassembly */
37enum sndcp_rx_state {
38 SNDCP_RX_S_FIRST,
39 SNDCP_RX_S_SUBSEQ,
40 SNDCP_RX_S_DISCARD,
41};
42
43struct gprs_sndcp_entity {
44 struct llist_head list;
45
Harald Welte8911cef2010-07-01 19:56:19 +020046 /* FIXME: move this RA_ID up to the LLME or even higher */
47 struct gprs_ra_id ra_id;
Harald Weltef78a3b22010-06-30 17:21:19 +020048 /* 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
61extern struct llist_head gprs_sndcp_entities;
62
Philippf1f34362016-08-26 17:00:21 +020063/* Set of SNDCP-XID negotiation (See also: TS 144 065,
64 * Section 6.8 XID parameter negotiation) */
65int 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) */
69int 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) */
75int 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 Weltef78a3b22010-06-30 17:21:19 +020079#endif /* INT_SNDCP_H */