summaryrefslogtreecommitdiff
path: root/common/include/decode_gtp.h
blob: 0d936a6b56652d7ca1e9788993c92809b140f845 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef _DECODE_GTP_H
#define _DECODE_GTP_H

#ifdef __cpluscplus
extern "C"
{
#endif

#include "public.h"

    /* According to 3GPP TS 29.060. */
    typedef struct gtp1_header_s
    {
        uint8_t flags;
        uint8_t type;
        uint16_t length;
        uint32_t tid;
    } __attribute__((packed)) gtp1_header_t;

    typedef struct gtp_info_s
    {
        gtp1_header_t *hdr;
        uint8_t *payload;

        uint32_t hdr_len;
        uint32_t payload_len;
    } gtp_info_t;

    int decode_gtp(gtp_info_t *packet, const uint8_t *data, uint32_t len);
    int dump_gtp_info(gtp_info_t *packet, char *buff, size_t size);

#ifdef __cpluscplus
}
#endif

#endif