blob: 4e15b9be2339568963a5e2cab51283c2cfbb9ad1 [file] [log] [blame]
Philippf1f34362016-08-26 17:00:21 +02001/* GPRS SNDCP header compression handler */
2
3/* (C) 2016 by sysmocom s.f.m.c. GmbH <info@sysmocom.de>
4 * All Rights Reserved
5 *
6 * Author: Philipp Maier
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU Affero General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Affero General Public License for more details.
17 *
18 * You should have received a copy of the GNU Affero General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#pragma once
23
24#include <stdint.h>
25#include <osmocom/core/linuxlist.h>
26#include <openbsc/gprs_sndcp_comp.h>
27
28/* Note: The decompressed packet may have a maximum size of:
29 * Return value + MAX_DECOMPR_INCR */
30#define MAX_HDRDECOMPR_INCR 64
31
32/* Initalize header compression */
33int gprs_sndcp_pcomp_init(const void *ctx, struct gprs_sndcp_comp *comp_entity,
34 const struct gprs_sndcp_comp_field *comp_field);
35
36/* Terminate header compression */
37void gprs_sndcp_pcomp_term(struct gprs_sndcp_comp *comp_entity);
38
39/* Expand packet header */
40int gprs_sndcp_pcomp_expand(uint8_t *data, unsigned int len, uint8_t pcomp,
41 const struct llist_head *comp_entities);
42
43/* Compress packet header */
44int gprs_sndcp_pcomp_compress(uint8_t *data, unsigned int len, uint8_t *pcomp,
45 const struct llist_head *comp_entities,
46 uint8_t nsapi);