update it

This commit is contained in:
Sukchan Lee 2017-03-03 18:25:04 +09:00
parent f6652e69a9
commit 0f39f3295d
18 changed files with 51 additions and 32 deletions

16
lib/3gpp/3gpp_message.h Normal file
View File

@ -0,0 +1,16 @@
#ifndef __3GPP_COMMON_H__
#define __3GPP_COMMON_H__
#include "core.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#define MSG_SDU_SIZE 2048
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* !__3GPP_COMMON_H__ */

View File

@ -3,7 +3,7 @@
noinst_LTLIBRARIES = lib3gpp.la
lib3gpp_la_SOURCES = \
plmn_id.h
3gpp_common.h plmn_id.h
nodist_lib3gpp_la_SOURCES = \
plmn_id.c

View File

@ -1,8 +1,10 @@
#ifndef __PLNN_ID_H__
#define __PLNN_ID_H__
#ifndef __PLMN_ID_H__
#define __PLMN_ID_H__
#include "core_errno.h"
#define PLMN_ID_LEN 3
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
@ -19,4 +21,4 @@ CORE_DECLARE(void) plmn_id_to_buffer(plmn_id_t *plmn_id, c_uint8_t *buf);
}
#endif /* __cplusplus */
#endif /* !__PLNN_ID_H__ */
#endif /* !__PLMN_ID_H__ */

View File

@ -9,7 +9,8 @@ nodist_libnas_la_SOURCES = \
nas_decoder.c nas_encoder.c nas_ies.c
AM_CPPFLAGS = \
-I$(top_srcdir)/lib/core/include
-I$(top_srcdir)/lib/core/include \
-I$(top_srcdir)/lib/3gpp
AM_CFLAGS = \
-Wall -Werror

View File

@ -250,7 +250,7 @@ status_t nas_encode_pdu(pkbuf_t **pkbuf, nas_message_t *message)
d_assert(message, return CORE_ERROR, "Null param");
*pkbuf = pkbuf_alloc(0, NAS_SDU_SIZE);
*pkbuf = pkbuf_alloc(0, MSG_SDU_SIZE);
d_assert(*pkbuf, return -1, "Null Param");
size = sizeof(nas_header_t);

View File

@ -1,14 +1,13 @@
#ifndef _NAS_MESSAGE_H__
#define _NAS_MESSAGE_H__
#include "3gpp_message.h"
#include "nas_ies.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#define NAS_SDU_SIZE 2048
#define NAS_SECURITY_HEADER_PLAIN_NAS_MESSAGE 0
#define NAS_SECURITY_HEADER_INTEGRITY_PROTECTED 1
#define NAS_SECURITY_HEADER_INTEGRITY_PROTECTED_AND_CIPHERED 2

View File

@ -20,6 +20,7 @@ libs1ap_la_LIBADD = \
AM_CPPFLAGS = \
-I$(top_srcdir)/lib/core/include \
-I$(top_srcdir)/lib/3gpp \
-I$(top_srcdir)/lib/s1ap/asn1c
AM_CFLAGS = \

View File

@ -2,6 +2,7 @@
#include "core_debug.h"
#include "core_lib.h"
#include "s1ap_message.h"
static inline int s1ap_encode_initiating_message(
@ -35,7 +36,7 @@ int s1ap_encode_pdu(pkbuf_t **pkb, s1ap_message *message_p)
d_assert (message_p, return -1, "Null param");
*pkb = pkbuf_alloc(0, S1AP_SDU_SIZE);
*pkb = pkbuf_alloc(0, MSG_SDU_SIZE);
d_assert(*pkb, return -1, "Null Param");
switch (message_p->direction)
@ -180,7 +181,7 @@ static inline int s1ap_encode_initial_context_setup_request(
td, &initialContextSetupRequest);
enc_ret = aper_encode_to_buffer(&asn_DEF_S1AP_PDU,
&pdu, pkbuf->payload, S1AP_SDU_SIZE);
&pdu, pkbuf->payload, MSG_SDU_SIZE);
ASN_STRUCT_FREE_CONTENTS_ONLY(*td, &initialContextSetupRequest);
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_S1AP_PDU, &pdu);
@ -217,7 +218,7 @@ static inline int s1ap_encode_s1setup_request(
ANY_fromType_aper(&pdu.choice.initiatingMessage.value, td, &s1SetupRequest);
enc_ret = aper_encode_to_buffer(&asn_DEF_S1AP_PDU,
&pdu, pkbuf->payload, S1AP_SDU_SIZE);
&pdu, pkbuf->payload, MSG_SDU_SIZE);
ASN_STRUCT_FREE_CONTENTS_ONLY(*td, &s1SetupRequest);
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_S1AP_PDU, &pdu);
@ -255,7 +256,7 @@ static inline int s1ap_encode_s1setup_response(
td, &s1SetupResponse);
enc_ret = aper_encode_to_buffer(&asn_DEF_S1AP_PDU,
&pdu, pkbuf->payload, S1AP_SDU_SIZE);
&pdu, pkbuf->payload, MSG_SDU_SIZE);
ASN_STRUCT_FREE_CONTENTS_ONLY(*td, &s1SetupResponse);
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_S1AP_PDU, &pdu);
@ -293,7 +294,7 @@ static inline int s1ap_encode_s1setup_failure(
td, &s1SetupFailure);
enc_ret = aper_encode_to_buffer(&asn_DEF_S1AP_PDU,
&pdu, pkbuf->payload, S1AP_SDU_SIZE);
&pdu, pkbuf->payload, MSG_SDU_SIZE);
ASN_STRUCT_FREE_CONTENTS_ONLY(*td, &s1SetupFailure);
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_S1AP_PDU, &pdu);
@ -331,7 +332,7 @@ static inline int s1ap_encode_downlink_nas_transport(
td, &downlinkNasTransport);
enc_ret = aper_encode_to_buffer(&asn_DEF_S1AP_PDU,
&pdu, pkbuf->payload, S1AP_SDU_SIZE);
&pdu, pkbuf->payload, MSG_SDU_SIZE);
ASN_STRUCT_FREE_CONTENTS_ONLY(*td, &downlinkNasTransport);
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_S1AP_PDU, &pdu);
@ -371,7 +372,7 @@ static inline int s1ap_encode_ue_context_release_command(
td, &ueContextReleaseCommand);
enc_ret = aper_encode_to_buffer(&asn_DEF_S1AP_PDU,
&pdu, pkbuf->payload, S1AP_SDU_SIZE);
&pdu, pkbuf->payload, MSG_SDU_SIZE);
ASN_STRUCT_FREE_CONTENTS_ONLY(*td, &ueContextReleaseCommand);
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_S1AP_PDU, &pdu);

View File

@ -2,14 +2,13 @@
#define _S1AP_MESSAGE_H__
#include "core_pkbuf.h"
#include "3gpp_message.h"
#include "s1ap_ies_defs.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#define S1AP_SDU_SIZE 2048
CORE_DECLARE(int) s1ap_decode_pdu(s1ap_message *message, pkbuf_t *pkbuf);
CORE_DECLARE(int) s1ap_encode_pdu(pkbuf_t **pkbuf, s1ap_message *message);
CORE_DECLARE(int) s1ap_free_pdu(s1ap_message *message);

View File

@ -5,11 +5,11 @@ SUBDIRS = freeDiameter
noinst_LTLIBRARIES = libs6a.la
libs6a_la_SOURCES = \
milenage.h 3gpp_kdf.h \
milenage.h kasme.h \
s6a_app.h
nodist_libs6a_la_SOURCES = \
milenage.c 3gpp_kdf.c \
milenage.c kasme.c \
s6a_init.c s6a_config.c s6a_fd.c s6a_app.c s6a_dict.c \
hss_main.c hss_ctx.c \
mme_init.c

View File

@ -4,7 +4,7 @@
#include "core_pool.h"
#include "core_lib.h"
#include "3gpp_kdf.h"
#include "kasme.h"
#include "milenage.h"
#include "hss_ctx.h"

View File

@ -111,7 +111,7 @@ int _s1ap_recv_cb(net_sock_t *net_sock, void *data)
d_assert(net_sock, return -1, "Null param");
d_assert(queue_id, return -1, "Null param");
pkb = pkbuf_alloc(0, S1AP_SDU_SIZE);
pkb = pkbuf_alloc(0, MSG_SDU_SIZE);
d_assert(pkb, return -1, "Can't allocate pkbuf");
r = net_read(net_sock, pkb->payload, pkb->len, 0);

View File

@ -96,12 +96,12 @@ int s6a_send_auth_info_req(s6a_auth_info_req_t *air)
/* Set the Visited-PLMN-Id AVP if needed*/
{
c_uint8_t buffer[3] = {0, };
plmn_id_to_buffer(&air->visited_plmn_id, buffer);
c_uint8_t plmn_id[PLMN_ID_LEN] = {0, };
plmn_id_to_buffer(&air->visited_plmn_id, plmn_id);
d_assert(fd_msg_avp_new(s6a_visited_plmn_id, 0, &avp) == 0, goto out,);
val.os.data = buffer;
val.os.len = 3;
val.os.data = plmn_id;
val.os.len = PLMN_ID_LEN;
d_assert(fd_msg_avp_setvalue(avp, &val) == 0, goto out,);
d_assert(fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp) == 0, goto out,);
}

View File

@ -73,7 +73,7 @@ static void enb_setup_test1(abts_case *tc, void *data)
status_t rv;
net_sock_t *sock[NUM_OF_TEST_DUPLICATED_ENB];
pkbuf_t *sendbuf;
pkbuf_t *recvbuf = pkbuf_alloc(0, S1AP_SDU_SIZE);
pkbuf_t *recvbuf = pkbuf_alloc(0, MSG_SDU_SIZE);
s1ap_message message;
int rc;
int i;
@ -121,7 +121,7 @@ static void enb_setup_test2(abts_case *tc, void *data)
status_t rv;
net_sock_t *sock[NUM_OF_TEST_ENB];
pkbuf_t *sendbuf;
pkbuf_t *recvbuf = pkbuf_alloc(0, S1AP_SDU_SIZE);
pkbuf_t *recvbuf = pkbuf_alloc(0, MSG_SDU_SIZE);
s1ap_message message;
int rc;
int i;

View File

@ -19,7 +19,7 @@ static void nas_message_test1(abts_case *tc, void *data)
pkbuf_t *pkbuf;
status_t rv;
pkbuf = pkbuf_alloc(0, NAS_SDU_SIZE);
pkbuf = pkbuf_alloc(0, MSG_SDU_SIZE);
ABTS_PTR_NOTNULL(tc, pkbuf);
pkbuf->len = 59;
memcpy(pkbuf->payload, payload[0], pkbuf->len);
@ -119,7 +119,7 @@ static void nas_message_test3(abts_case *tc, void *data)
pkbuf_t *pkbuf;
status_t rv;
pkbuf = pkbuf_alloc(0, NAS_SDU_SIZE);
pkbuf = pkbuf_alloc(0, MSG_SDU_SIZE);
ABTS_PTR_NOTNULL(tc, pkbuf);
pkbuf->len = 7;
memcpy(pkbuf->payload, payload[0], pkbuf->len);

View File

@ -21,7 +21,7 @@ static void s1ap_message_test1(abts_case *tc, void *data)
pkbuf_t *pkbuf;
int result;
pkbuf = pkbuf_alloc(0, S1AP_SDU_SIZE);
pkbuf = pkbuf_alloc(0, MSG_SDU_SIZE);
ABTS_PTR_NOTNULL(tc, pkbuf);
pkbuf->len = 49;
memcpy(pkbuf->payload, payload[0], pkbuf->len);
@ -44,7 +44,7 @@ static void s1ap_message_test2(abts_case *tc, void *data)
pkbuf_t *pkbuf;
int result;
pkbuf = pkbuf_alloc(0, S1AP_SDU_SIZE);
pkbuf = pkbuf_alloc(0, MSG_SDU_SIZE);
ABTS_PTR_NOTNULL(tc, pkbuf);
pkbuf->len = 115;
memcpy(pkbuf->payload, payload[0], pkbuf->len);
@ -67,7 +67,7 @@ static void s1ap_message_test3(abts_case *tc, void *data)
pkbuf_t *pkbuf;
int result;
pkbuf = pkbuf_alloc(0, S1AP_SDU_SIZE);
pkbuf = pkbuf_alloc(0, MSG_SDU_SIZE);
ABTS_PTR_NOTNULL(tc, pkbuf);
pkbuf->len = 41;
memcpy(pkbuf->payload, payload[0], pkbuf->len);