mirror of
https://github.com/open5gs/open5gs.git
synced 2026-05-04 22:30:09 +00:00
contine to re-archi GTP
This commit is contained in:
parent
829047f763
commit
faf8268a3d
17 changed files with 175 additions and 90 deletions
|
|
@ -383,7 +383,7 @@ type_list["APN Restriction"]["size"] = 1 # Type : 127
|
|||
type_list["Selection Mode"]["size"] = 1 # Type : 128
|
||||
type_list["Node Type"]["size"] = 1 # Type : 128
|
||||
|
||||
f = open(outdir + 'gtp_tlv.h', 'w')
|
||||
f = open(outdir + 'gtp_message.h', 'w')
|
||||
output_header_to_file(f)
|
||||
f.write("""#ifndef __GTP_TLV_H__
|
||||
#define __GTP_TLV_H__
|
||||
|
|
@ -394,6 +394,46 @@ f.write("""#ifndef __GTP_TLV_H__
|
|||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* 5.1 General format */
|
||||
#define GTPV2C_HEADER_LEN 12
|
||||
#define GTPV2C_TEID_LEN 4
|
||||
typedef struct _gtp_header_t {
|
||||
union {
|
||||
struct {
|
||||
ED4(c_uint8_t version:3;,
|
||||
c_uint8_t piggybacked:1;,
|
||||
c_uint8_t teid_presence:1;,
|
||||
c_uint8_t spare1:3;)
|
||||
};
|
||||
/* GTU-U flags */
|
||||
#define GTPU_FLAGS_PN 0x1
|
||||
#define GTPU_FLAGS_S 0x2
|
||||
c_uint8_t flags;
|
||||
};
|
||||
c_uint8_t type;
|
||||
c_uint16_t length;
|
||||
union {
|
||||
struct {
|
||||
c_uint32_t teid;
|
||||
/* sqn : 31bit ~ 8bit, spare : 7bit ~ 0bit */
|
||||
#define GTP_XID_TO_SQN(__xid) htonl(((__xid) << 8))
|
||||
#define GTP_SQN_TO_XID(__sqn) (ntohl(__sqn) >> 8)
|
||||
c_uint32_t sqn;
|
||||
};
|
||||
/* sqn : 31bit ~ 8bit, spare : 7bit ~ 0bit */
|
||||
c_uint32_t sqn_only;
|
||||
};
|
||||
} __attribute__ ((packed)) gtp_header_t;
|
||||
|
||||
/* GTP-U message type, defined in 3GPP TS 29.281 Release 11 */
|
||||
#define GTPU_MSGTYPE_ECHO_REQ 1
|
||||
#define GTPU_MSGTYPE_ECHO_RSP 2
|
||||
#define GTPU_MSGTYPE_ERR_IND 26
|
||||
#define GTPU_MSGTYPE_SUPP_EXTHDR_NOTI 31
|
||||
#define GTPU_MSGTYPE_END_MARKER 254
|
||||
#define GTPU_MSGTYPE_GPDU 255
|
||||
|
||||
/* GTPv2-C message type */
|
||||
""")
|
||||
|
||||
tmp = [(k, v["type"]) for k, v in msg_list.items()]
|
||||
|
|
@ -482,6 +522,7 @@ for (k, v) in sorted_msg_list:
|
|||
f.write("\n")
|
||||
|
||||
f.write("typedef struct _gtp_message_t {\n")
|
||||
f.write(" gtp_header_t h;\n")
|
||||
f.write(" union {\n")
|
||||
for (k, v) in sorted_msg_list:
|
||||
if "ies" in msg_list[k]:
|
||||
|
|
@ -502,10 +543,10 @@ CORE_DECLARE(status_t) gtp_build_msg(
|
|||
""")
|
||||
f.close()
|
||||
|
||||
f = open(outdir + 'gtp_tlv.c', 'w')
|
||||
f = open(outdir + 'gtp_message.c', 'w')
|
||||
output_header_to_file(f)
|
||||
f.write("""#include "core_debug.h"
|
||||
#include "gtp_tlv.h"
|
||||
#include "gtp_message.h"
|
||||
|
||||
""")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue