udpate it

This commit is contained in:
Sukchan Lee 2017-03-12 23:07:17 +09:00
parent 35bac5a6ff
commit a9b6bb2c34
7 changed files with 31 additions and 30 deletions

View File

@ -1,18 +1,19 @@
#ifndef __TLV_MSG_H__
#define __TLV_MSG_H__
#include "core_tlv.h"
#include "core_pkbuf.h"
#define TLV_HEADER_LEN 12
#define TLV_VARIABLE 0
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
typedef struct _tlv_header_t {
c_uint64_t set_ind;
} tlv_header_t;
#define TLV_MAX_HEADROOM 16
#define TLV_VARIABLE_LEN 0
#define TLV_MAX_MORE 8
#define TLV_1_OR_MORE(__v) __v[TLV_MAX_MORE]
#define VALUE_SET(__m, __value) \
__m.v = __value; __m.h.set_ind = 1
@ -69,6 +70,12 @@ typedef struct _tlv_desc_t {
void *child_descs[];
} tlv_desc_t;
extern tlv_desc_t tlv_desc_more;
typedef struct _tlv_header_t {
c_uint64_t set_ind;
} tlv_header_t;
/* 8-bit Unsigned integer */
typedef struct _tlv_uint8_t {
tlv_header_t h;
@ -129,11 +136,6 @@ typedef struct _tlv_null {
tlv_header_t h;
} tlv_null_t;
#define TLV_MORE 8
#define TLV_1_OR_MORE(__v) __v[TLV_MORE]
extern tlv_desc_t tlv_desc_more;
CORE_DECLARE(status_t) tlv_build_msg(
pkbuf_t **msg, tlv_desc_t *msg_desc, void *asn);

View File

@ -16,10 +16,11 @@ libcore_la_SOURCES = \
../include/core_rwlock.h ../include/core_semaphore.h ../include/core_sha1.h \
../include/core_sha1_hmac.h ../include/core_sha2.h ../include/core_sha2_hmac.h \
../include/core_signal.h ../include/core_thread.h ../include/core_time.h \
../include/core_timer.h ../include/core_tlv.h ../include/core_version.h
../include/core_timer.h ../include/core_tlv.h ../include/core_tlv_msg.h \
../include/core_version.h
nodist_libcore_la_SOURCES = \
debug.c fsm.c msgq.c ringbuf.c timer.c tlv.c \
debug.c fsm.c msgq.c ringbuf.c timer.c tlv.c tlv_msg.c \
aes.c aes_cmac.c sha1.c sha1_hmac.c sha2.c sha2_hmac.c misc.c
libcore_la_DEPENDENCIES = \

View File

@ -1,8 +1,7 @@
#define TRACE_MODULE _tlv_msg
#include "core_debug.h"
#include "core_tlv.h"
#include "asn_msg.h"
#include "core_debug.h"
#include "core_tlv_msg.h"
tlv_desc_t tlv_desc_more =
{
@ -258,7 +257,7 @@ status_t tlv_build_msg(pkbuf_t **msg, tlv_desc_t *msg_desc, void *asn)
"Can't build TLV message");
length = tlv_calc_length(root, TLV_MODE_T1_L2_I1);
*msg = pkbuf_alloc(TLV_HEADER_LEN, length);
*msg = pkbuf_alloc(TLV_MAX_HEADROOM, length);
d_assert(*msg, tlv_free_all(root); return CORE_ENOMEM,
"pkbuf_alloc() failed");
(*msg)->len = length;

View File

@ -3,10 +3,10 @@
noinst_LTLIBRARIES = libgtp.la
libgtp_la_SOURCES = \
asn_msg.h asn_tlv_desc.h
gtpv2c_tlv.h
nodist_libgtp_la_SOURCES = \
asn_msg.c asn_tlv_desc.c
gtpv2c_tlv.c
AM_CPPFLAGS = \
-I$(top_srcdir)/lib/core/include \

View File

@ -1,4 +1,4 @@
#include "asn_tlv_desc.h"
#include "gtpv2c_tlv.h"
tlv_desc_t tlv_desc_authorization_policy_support =
{

View File

@ -1,7 +1,7 @@
#ifndef __TLV_TLV_DESC_H__
#define __TLV_TLV_DESC_H__
#ifndef __GTPV2C_TLV_H__
#define __GTPV2C_TLV_H__
#include "asn_msg.h"
#include "core_tlv_msg.h"
#ifdef __cplusplus
extern "C" {
@ -13,7 +13,7 @@ typedef tlv_uint8_t tlv_authorization_policy_support_t;
extern tlv_desc_t tlv_desc_authorization_policy_support;
#define TLV_MS_SECURITY_HISTORY_TYPE 108
#define TLV_MS_SECURITY_HISTORY_LEN TLV_VARIABLE
#define TLV_MS_SECURITY_HISTORY_LEN TLV_VARIABLE_LEN
typedef struct _tlv_ms_security_history_t {
tlv_header_t h;
tlv_authorization_policy_support_t authorization_policy_support;
@ -21,7 +21,7 @@ typedef struct _tlv_ms_security_history_t {
extern tlv_desc_t tlv_desc_ms_security_history;
#define TLV_MS_INFO_TYPE 103
#define TLV_MS_INFO_LEN TLV_VARIABLE
#define TLV_MS_INFO_LEN TLV_VARIABLE_LEN
typedef struct _tlv_ms_info_t {
tlv_header_t h;
tlv_ms_security_history_t ms_security_history;
@ -29,12 +29,12 @@ typedef struct _tlv_ms_info_t {
extern tlv_desc_t tlv_desc_ms_info;
#define TLV_BS_ID_TYPE 25
#define TLV_BS_ID_LEN TLV_VARIABLE
#define TLV_BS_ID_LEN TLV_VARIABLE_LEN
typedef tlv_octets_t tlv_bs_id_t;
extern tlv_desc_t tlv_desc_bs_id;
#define TLV_BS_INFO_TYPE 26
#define TLV_BS_INFO_LEN TLV_VARIABLE
#define TLV_BS_INFO_LEN TLV_VARIABLE_LEN
typedef struct _tlv_bs_info_t {
tlv_header_t h;
tlv_bs_id_t bs_id;
@ -52,4 +52,4 @@ extern tlv_desc_t tlv_desc_msg_ms_preattachment_req;
}
#endif /* __cplusplus */
#endif /* __TLV_TLV_DESC_H__ */
#endif /* __GTPV2C_TLV_H__ */

View File

@ -3,8 +3,7 @@
#include "core_debug.h"
#include "testutil.h"
#include "asn_msg.h"
#include "asn_tlv_desc.h"
#include "gtpv2c_tlv.h"
static void gtp_message_test1(abts_case *tc, void *data)
{