blob: d340d40b75117230d938664be7f1a95f1ae809c0 [file] [log] [blame]
Philippa536fc62016-08-10 12:14:57 +02001/* GPRS LLC XID field encoding/decoding as per 3GPP TS 44.064 */
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
27/* 3GPP TS 44.064 6.4.1.6 Exchange Identification (XID)
28 command/response parameter field */
29struct gprs_llc_xid_field {
30 struct llist_head list;
31 uint8_t type; /* See also Table 6: LLC layer parameter
32 negotiation */
33 uint8_t *data; /* Payload data (memory is owned by the
34 * creator of the struct) */
35 unsigned int data_len; /* Payload length */
36};
37
38/* Transform a list with XID fields into a XID message (dst) */
39int gprs_llc_compile_xid(uint8_t *dst, int dst_maxlen,
40 const struct llist_head *xid_fields);
41
42/* Transform a XID message (dst) into a list of XID fields */
43struct llist_head *gprs_llc_parse_xid(const void *ctx, const uint8_t *src,
44 int src_len);
45
46/* Create a duplicate of an XID-Field */
47struct gprs_llc_xid_field *gprs_llc_dup_xid_field(const void *ctx,
48 const struct gprs_llc_xid_field *xid_field);
49
50/* Copy an llist with xid fields */
51struct llist_head *gprs_llc_copy_xid(const void *ctx,
52 const struct llist_head *xid_fields);
53
54/* Dump a list with XID fields (Debug) */
55void gprs_llc_dump_xid_fields(const struct llist_head *xid_fields,
56 unsigned int logl);
57