aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/include
diff options
context:
space:
mode:
authorPhilipp <pmaier@sysmocom.de>2016-08-26 17:00:21 +0200
committerHarald Welte <laforge@gnumonks.org>2016-09-24 03:17:58 +0000
commitf1f34360fb4680adc25a7e8b4b31062ba606e8dc (patch)
tree8862f4b69433e2006b96484d1ded322b84d283f1 /openbsc/include
parent2c7f83762ab28ef4051d379e295a824e83577d7f (diff)
SNDCP: add RFC1144 header compression functionality
- Add module to handle compression entities - Add module to control header compression - Introduce VTY commands for heade compression configuration - Add changes in sndcp and llc to integrate header compression Change-Id: Ia00260dc09978844c2865957b4d43000b78b5e43
Diffstat (limited to 'openbsc/include')
-rw-r--r--openbsc/include/openbsc/Makefile.am2
-rw-r--r--openbsc/include/openbsc/gprs_llc.h9
-rw-r--r--openbsc/include/openbsc/gprs_sndcp.h26
-rw-r--r--openbsc/include/openbsc/gprs_sndcp_comp.h82
-rw-r--r--openbsc/include/openbsc/gprs_sndcp_pcomp.h46
-rw-r--r--openbsc/include/openbsc/sgsn.h7
6 files changed, 172 insertions, 0 deletions
diff --git a/openbsc/include/openbsc/Makefile.am b/openbsc/include/openbsc/Makefile.am
index 12e1a664e..e28c507a9 100644
--- a/openbsc/include/openbsc/Makefile.am
+++ b/openbsc/include/openbsc/Makefile.am
@@ -25,6 +25,8 @@ noinst_HEADERS = \
gprs_llc_xid.h \
gprs_sgsn.h \
gprs_sndcp.h \
+ gprs_sndcp_comp.h \
+ gprs_sndcp_pcomp.h \
gprs_sndcp_xid.h \
gprs_utils.h \
gsm_04_08.h \
diff --git a/openbsc/include/openbsc/gprs_llc.h b/openbsc/include/openbsc/gprs_llc.h
index c3b82b146..8b014670d 100644
--- a/openbsc/include/openbsc/gprs_llc.h
+++ b/openbsc/include/openbsc/gprs_llc.h
@@ -174,6 +174,15 @@ struct gprs_llc_llme {
* able to create the compression entity. */
struct llist_head *xid;
+ /* Compression entities */
+ struct {
+ /* In these two list_heads we will store the
+ * data and protocol compression entities,
+ * together with their compression states */
+ struct llist_head *proto;
+ struct llist_head *data;
+ } comp;
+
/* Internal management */
uint32_t age_timestamp;
};
diff --git a/openbsc/include/openbsc/gprs_sndcp.h b/openbsc/include/openbsc/gprs_sndcp.h
index fef871aa1..d970240e4 100644
--- a/openbsc/include/openbsc/gprs_sndcp.h
+++ b/openbsc/include/openbsc/gprs_sndcp.h
@@ -21,6 +21,16 @@ struct defrag_state {
struct llist_head frag_list;
struct osmo_timer_list timer;
+
+ /* Holds state to know which compression mode is used
+ * when the packet is re-assembled */
+ uint8_t pcomp;
+ uint8_t dcomp;
+
+ /* Holds the pointers to the compression entity list
+ * that is used when the re-assembled packet is decompressed */
+ struct llist_head *proto;
+ struct llist_head *data;
};
/* See 6.7.1.2 Reassembly */
@@ -50,4 +60,20 @@ struct gprs_sndcp_entity {
extern struct llist_head gprs_sndcp_entities;
+/* Set of SNDCP-XID negotiation (See also: TS 144 065,
+ * Section 6.8 XID parameter negotiation) */
+int sndcp_sn_xid_req(struct gprs_llc_lle *lle, uint8_t nsapi);
+
+/* Process SNDCP-XID indication (See also: TS 144 065,
+ * Section 6.8 XID parameter negotiation) */
+int sndcp_sn_xid_ind(struct gprs_llc_xid_field *xid_field_indication,
+ struct gprs_llc_xid_field *xid_field_response,
+ struct gprs_llc_lle *lle);
+
+/* Process SNDCP-XID indication
+ * (See also: TS 144 065, Section 6.8 XID parameter negotiation) */
+int sndcp_sn_xid_conf(struct gprs_llc_xid_field *xid_field_conf,
+ struct gprs_llc_xid_field *xid_field_request,
+ struct gprs_llc_lle *lle);
+
#endif /* INT_SNDCP_H */
diff --git a/openbsc/include/openbsc/gprs_sndcp_comp.h b/openbsc/include/openbsc/gprs_sndcp_comp.h
new file mode 100644
index 000000000..87ab6382a
--- /dev/null
+++ b/openbsc/include/openbsc/gprs_sndcp_comp.h
@@ -0,0 +1,82 @@
+/* GPRS SNDCP header compression entity management tools */
+
+/* (C) 2016 by sysmocom s.f.m.c. GmbH <info@sysmocom.de>
+ * All Rights Reserved
+ *
+ * Author: Philipp Maier
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#include <stdint.h>
+#include <osmocom/core/linuxlist.h>
+#include <openbsc/gprs_sndcp_xid.h>
+
+/* Header / Data compression entity */
+struct gprs_sndcp_comp {
+ struct llist_head list;
+
+ /* Serves as an ID in case we want to delete this entity later */
+ unsigned int entity; /* see also: 6.5.1.1.3 and 6.6.1.1.3 */
+
+ /* Specifies to which NSAPIs the compression entity is assigned */
+ uint8_t nsapi_len; /* Number of applicable NSAPIs (default 0) */
+ uint8_t nsapi[MAX_NSAPI]; /* Applicable NSAPIs (default 0) */
+
+ /* Assigned pcomp values */
+ uint8_t comp_len; /* Number of contained PCOMP / DCOMP values */
+ uint8_t comp[MAX_COMP]; /* see also: 6.5.1.1.5 and 6.6.1.1.5 */
+
+ /* Algorithm parameters */
+ int algo; /* Algorithm type (see gprs_sndcp_xid.h) */
+ int compclass; /* See gprs_sndcp_xid.h/c */
+ void *state; /* Algorithm status and parameters */
+};
+
+#define MAX_COMP 16 /* Maximum number of possible pcomp/dcomp values */
+#define MAX_NSAPI 11 /* Maximum number usable NSAPIs */
+
+/* Allocate a compression enitiy list */
+struct llist_head *gprs_sndcp_comp_alloc(const void *ctx);
+
+/* Free a compression entitiy list */
+void gprs_sndcp_comp_free(struct llist_head *comp_entities);
+
+/* Delete a compression entity */
+void gprs_sndcp_comp_delete(struct llist_head *comp_entities, unsigned int entity);
+
+/* Create and Add a new compression entity
+ * (returns a pointer to the compression entity that has just been created) */
+struct gprs_sndcp_comp *gprs_sndcp_comp_add(const void *ctx,
+ struct llist_head *comp_entities,
+ const struct gprs_sndcp_comp_field
+ *comp_field);
+
+/* Find which compression entity handles the specified pcomp/dcomp */
+struct gprs_sndcp_comp *gprs_sndcp_comp_by_comp(const struct llist_head
+ *comp_entities, uint8_t comp);
+
+/* Find which compression entity handles the specified nsapi */
+struct gprs_sndcp_comp *gprs_sndcp_comp_by_nsapi(const struct llist_head
+ *comp_entities, uint8_t nsapi);
+
+/* Find a comp_index for a given pcomp/dcomp value */
+uint8_t gprs_sndcp_comp_get_idx(const struct gprs_sndcp_comp *comp_entity,
+ uint8_t comp);
+
+/* Find a pcomp/dcomp value for a given comp_index */
+uint8_t gprs_sndcp_comp_get_comp(const struct gprs_sndcp_comp *comp_entity,
+ uint8_t comp_index);
diff --git a/openbsc/include/openbsc/gprs_sndcp_pcomp.h b/openbsc/include/openbsc/gprs_sndcp_pcomp.h
new file mode 100644
index 000000000..4e15b9be2
--- /dev/null
+++ b/openbsc/include/openbsc/gprs_sndcp_pcomp.h
@@ -0,0 +1,46 @@
+/* GPRS SNDCP header compression handler */
+
+/* (C) 2016 by sysmocom s.f.m.c. GmbH <info@sysmocom.de>
+ * All Rights Reserved
+ *
+ * Author: Philipp Maier
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#include <stdint.h>
+#include <osmocom/core/linuxlist.h>
+#include <openbsc/gprs_sndcp_comp.h>
+
+/* Note: The decompressed packet may have a maximum size of:
+ * Return value + MAX_DECOMPR_INCR */
+#define MAX_HDRDECOMPR_INCR 64
+
+/* Initalize header compression */
+int gprs_sndcp_pcomp_init(const void *ctx, struct gprs_sndcp_comp *comp_entity,
+ const struct gprs_sndcp_comp_field *comp_field);
+
+/* Terminate header compression */
+void gprs_sndcp_pcomp_term(struct gprs_sndcp_comp *comp_entity);
+
+/* Expand packet header */
+int gprs_sndcp_pcomp_expand(uint8_t *data, unsigned int len, uint8_t pcomp,
+ const struct llist_head *comp_entities);
+
+/* Compress packet header */
+int gprs_sndcp_pcomp_compress(uint8_t *data, unsigned int len, uint8_t *pcomp,
+ const struct llist_head *comp_entities,
+ uint8_t nsapi);
diff --git a/openbsc/include/openbsc/sgsn.h b/openbsc/include/openbsc/sgsn.h
index 22809b794..9537c0afc 100644
--- a/openbsc/include/openbsc/sgsn.h
+++ b/openbsc/include/openbsc/sgsn.h
@@ -93,6 +93,13 @@ struct sgsn_config {
int dynamic_lookup;
struct oap_config oap;
+
+ /* RFC1144 TCP/IP header compression */
+ struct {
+ int active;
+ int passive;
+ int s01;
+ } pcomp_rfc1144;
};
struct sgsn_instance {