Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
canghaiwuhen
OpenXG-RAN
Commits
5105766e
Commit
5105766e
authored
Sep 07, 2018
by
Bing-Kai Hong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unwanted files and function for sctp and f1 unit test
parent
021d7abf
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
7 additions
and
595 deletions
+7
-595
cmake_targets/CMakeLists.txt
cmake_targets/CMakeLists.txt
+0
-36
openair2/F1AP/CU_F1AP.c
openair2/F1AP/CU_F1AP.c
+0
-55
openair2/F1AP/DU_F1AP.c
openair2/F1AP/DU_F1AP.c
+7
-139
openair2/F1AP/sctp_cu.c
openair2/F1AP/sctp_cu.c
+0
-128
openair2/F1AP/sctp_cu.h
openair2/F1AP/sctp_cu.h
+0
-40
openair2/F1AP/sctp_du.c
openair2/F1AP/sctp_du.c
+0
-139
openair2/F1AP/sctp_du.h
openair2/F1AP/sctp_du.h
+0
-42
openair2/F1AP/test_f1ap_cu.c
openair2/F1AP/test_f1ap_cu.c
+0
-11
openair2/F1AP/test_f1ap_du.c
openair2/F1AP/test_f1ap_du.c
+0
-5
No files found.
cmake_targets/CMakeLists.txt
View file @
5105766e
...
...
@@ -517,19 +517,10 @@ if (NOT ${ret} STREQUAL 0)
endif
(
NOT
${
ret
}
STREQUAL 0
)
file
(
GLOB F1AP_source
${
F1AP_C_DIR
}
/*.c
)
#set(F1AP_OAI_generated
# ${F1AP_C_DIR}/per_decoder.c
# ${F1AP_C_DIR}/per_encoder.c
#${F1AP_C_DIR}/f1ap_xer_print.c
# ${F1AP_C_DIR}/F1AP_ProtocolIE-Field.h
# )
file
(
GLOB f1ap_h
${
F1AP_C_DIR
}
/*.h
)
set
(
f1ap_h
${
f1ap_h
}
)
add_library
(
F1AP_LIB
#${F1AP_OAI_generated}
#${f1ap_h}
${
F1AP_source
}
)
...
...
@@ -538,9 +529,7 @@ include_directories ("${F1AP_DIR}")
message
(
${
F1AP_C_DIR
}
)
message
(
${
F1AP_DIR
}
)
add_library
(
F1AP
#${F1AP_DIR}/test.c
${
F1AP_DIR
}
/DU_F1AP.c
${
F1AP_DIR
}
/CU_F1AP.c
${
F1AP_DIR
}
/f1ap_itti_messaging.c
...
...
@@ -548,33 +537,8 @@ add_library(F1AP
${
F1AP_DIR
}
/f1ap_decoder.c
${
F1AP_DIR
}
/f1ap_handlers.c
${
F1AP_DIR
}
/f1ap_common.c
${
F1AP_DIR
}
/sctp_du.c
${
F1AP_DIR
}
/sctp_cu.c
)
add_executable
(
test_f1ap_du
${
F1AP_DIR
}
/test_f1ap_du.c
${
F1AP_DIR
}
/DU_F1AP.c
${
F1AP_DIR
}
/f1ap_decoder.c
${
F1AP_DIR
}
/f1ap_handlers.c
${
F1AP_DIR
}
/sctp_du.c
)
target_link_libraries
(
test_f1ap_du
-Wl,--start-group F1AP_LIB
${
T_LIB
}
sctp pthread -Wl,--end-group
)
add_executable
(
test_f1ap_cu
${
F1AP_DIR
}
/test_f1ap_cu.c
${
F1AP_DIR
}
/CU_F1AP.c
${
F1AP_DIR
}
/f1ap_decoder.c
${
F1AP_DIR
}
/f1ap_handlers.c
${
F1AP_DIR
}
/sctp_cu.c
)
target_link_libraries
(
test_f1ap_cu
-Wl,--start-group F1AP_LIB
${
T_LIB
}
sctp pthread -Wl,--end-group
)
# Hardware dependant options
###################################
...
...
openair2/F1AP/CU_F1AP.c
View file @
5105766e
...
...
@@ -36,7 +36,6 @@
#include "f1ap_encoder.h"
#include "f1ap_decoder.h"
#include "cu_f1ap_task.h"
#include "sctp_cu.h"
#include "platform_types.h"
#include "common/utils/LOG/log.h"
#include "intertask_interface.h"
...
...
@@ -352,60 +351,6 @@ void CU_send_F1_SETUP_RESPONSE(instance_t instance, sctp_new_association_ind_t *
}
// int f1ap_decode_pdu(F1AP_F1AP_PDU_t *message, uint8_t *buffer, uint32_t length) {
// //LOG_I(F1AP,"Entering main loop of DU F1AP pdu receiver\n");
// F1AP_F1AP_PDU_t pdu;
// F1AP_F1AP_PDU_t *pdu_p = &pdu;
// asn_dec_rval_t dec_ret;
// DevAssert(buffer != NULL);
// printf("buffer = \n");
// int i_ret;
// for (i_ret = 0; i_ret < length; i_ret++) {
// printf("%x ", *(buffer+i_ret));
// }
// printf("\n");
// memset((void *)pdu_p, 0, sizeof(F1AP_F1AP_PDU_t));
// dec_ret = aper_decode(NULL,
// &asn_DEF_F1AP_F1AP_PDU,
// (void **)&pdu_p,
// buffer,
// length,
// 0,
// 0);
// xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu_p);
// printf("\n");
// printf("dec_ret.code = %d \n", dec_ret.code);
// AssertFatal(dec_ret.code == RC_OK,"Failed to decode pdu\n");
// // switch(pdu_p->present) {
// // case F1AP_F1AP_PDU_PR_initiatingpdu:
// // return F1AP_DU_decode_initiating_pdu(&pdu_p->choice.initiatingpdu);
// // case F1AP_F1AP_PDU_PR_successfulOutcome:
// // return F1AP_DU_decode_successful_outcome(&pdu_p->choice.successfulOutcome);
// // case F1AP_F1AP_PDU_PR_unsuccessfulOutcome:
// // return F1AP_DU_decode_unsuccessful_outcome(&pdu_p->choice.unsuccessfulOutcome);
// // default:
// // /*AssertFatal(1==0,"Unknown presence (%d) or not implemented\n", (int)pdu_p->present);*/
// // break;
// // }
// //AssertFatal(1==0,"Shouldn't get here\n");
// return -1;
// }
void
CU_send_F1_SETUP_FAILURE
(
F1AP_F1SetupFailure_t
*
F1SetupFailure
)
{
AssertFatal
(
1
==
0
,
"Not implemented yet
\n
"
);
//AssertFatal(1==0,"Not implemented yet\n");
...
...
openair2/F1AP/DU_F1AP.c
View file @
5105766e
...
...
@@ -38,7 +38,6 @@
#include "du_f1ap_task.h"
#include "platform_types.h"
#include "common/utils/LOG/log.h"
#include "sctp_du.h"
#include "intertask_interface.h"
#include "f1ap_itti_messaging.h"
...
...
@@ -477,145 +476,14 @@ void DU_send_F1_SETUP_REQUEST(instance_t instance, sctp_new_association_resp_t *
}
ASN_SEQUENCE_ADD
(
&
out
->
protocolIEs
.
list
,
ie
);
//printf("F1 setup request present = %d\n", ie.value.present);
/* encode */
if
(
f1ap_encode_pdu
(
&
pdu
,
&
buffer
,
&
len
)
<
0
)
{
printf
(
"Failed to encode F1 setup request
\n
"
);
}
du_f1ap_itti_send_sctp_data_req
(
instance
,
f1ap_setup_req
->
assoc_id
,
buffer
,
len
,
0
);
// printf("\n");
/* decode */
// if (f1ap_decode_pdu(&pdu, buffer, len) > 0) {
// printf("Failed to decode F1 setup request\n");
// }
// int req;
// req = s1ap_eNB_encode_s1_setup_request(&ie, &buffer, &len);
//printf("encode F1 setup request, req = %d \n", req);
//f1ap_eNB_itti_send_sctp_data_req(instance_p->instance, f1ap_mme_data_p->assoc_id, buffer, len, 0);
/* send Not Use ITTI */
//f1ap_send_sctp_data_req(instance_p->instance, f1ap_mme_data_p->assoc_id, buffer, len, 0);
}
// int f1ap_decode_pdu(F1AP_F1AP_PDU_t *message, uint8_t *buffer, uint32_t length) {
// //LOG_I(F1AP,"Entering main loop of DU F1AP pdu receiver\n");
// F1AP_F1AP_PDU_t pdu;
// F1AP_F1AP_PDU_t *pdu_p = &pdu;
// asn_dec_rval_t dec_ret;
// DevAssert(buffer != NULL);
// printf("buffer = \n");
// int i_ret;
// for (i_ret = 0; i_ret < length; i_ret++) {
// printf("%x ", *(buffer+i_ret));
// }
// printf("\n");
// memset((void *)pdu_p, 0, sizeof(F1AP_F1AP_PDU_t));
// dec_ret = aper_decode(NULL,
// &asn_DEF_F1AP_F1AP_PDU,
// (void **)&pdu_p,
// buffer,
// length,
// 0,
// 0);
// xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu_p);
// printf("\n");
// printf("dec_ret.code = %d \n", dec_ret.code);
// AssertFatal(dec_ret.code == RC_OK,"Failed to decode pdu\n");
// // switch(pdu_p->present) {
// // case F1AP_F1AP_PDU_PR_initiatingpdu:
// // return F1AP_DU_decode_initiating_pdu(&pdu_p->choice.initiatingpdu);
// // case F1AP_F1AP_PDU_PR_successfulOutcome:
// // return F1AP_DU_decode_successful_outcome(&pdu_p->choice.successfulOutcome);
// // case F1AP_F1AP_PDU_PR_unsuccessfulOutcome:
// // return F1AP_DU_decode_unsuccessful_outcome(&pdu_p->choice.unsuccessfulOutcome);
// // default:
// // /*AssertFatal(1==0,"Unknown presence (%d) or not implemented\n", (int)pdu_p->present);*/
// // break;
// // }
// //AssertFatal(1==0,"Shouldn't get here\n");
// return -1;
// }
// ssize_t s1ap_generate_initiating_pdu(
// uint8_t **buffer,
// uint32_t *length,
// F1AP_ProcedureCode_t procedureCode,
// F1AP_Criticality_t criticality,
// asn_TYPE_descriptor_t *td,
// void *sptr)
// {
// F1AP_F1AP_PDU_t pdu;
// ssize_t encoded;
// memset(&pdu, 0, sizeof(F1AP_F1AP_PDU_t));
// pdu.present = F1AP_F1AP_PDU_PR_initiatingpdu;
// pdu.choice.initiatingpdu = (F1AP_Initiatingpdu_t *)calloc(1, sizeof(F1AP_Initiatingpdu_t));
// pdu.choice.initiatingpdu->procedureCode = procedureCode;
// pdu.choice.initiatingpdu->criticality = criticality;
// //ANY_fromType_aper(&pdu.choice.initiatingpdu->value, td, sptr);
// //if (asn1_xer_print) {
// xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, (void *)&pdu);
// //}
// /* We can safely free list of IE from sptr */
// ASN_STRUCT_FREE_CONTENTS_ONLY(*td, sptr);
// if ((encoded = aper_encode_to_new_buffer(&asn_DEF_F1AP_F1AP_PDU, 0, &pdu,
// (void **)buffer)) < 0) {
// return -1;
// }
// *length = encoded;
// return encoded;
// }
// int s1ap_eNB_encode_s1_setup_request(
// F1AP_F1SetupRequestIEs_t *s1SetupRequestIEs,
// uint8_t **buffer,
// uint32_t *length)
// {
// F1AP_F1SetupRequestIEs_t s1SetupRequest;
// F1AP_F1SetupRequestIEs_t *s1SetupRequest_p = &s1SetupRequest;
// memset((void *)s1SetupRequest_p, 0, sizeof(s1SetupRequest));
// if (s1ap_encode_s1ap_s1setuprequesties(s1SetupRequest_p, s1SetupRequestIEs) < 0) {
// return -1;
// }
// return s1ap_generate_initiating_pdu(buffer,
// length,
// F1AP_ProcedureCode_id_F1Setup,
// F1AP_Criticality_reject,
// &asn_DEF_F1AP_F1SetupRequest,
// s1SetupRequest_p);
// }
// SETUP SUCCESSFUL
void
DU_handle_F1_SETUP_RESPONSE
()
{
...
...
@@ -633,7 +501,7 @@ void DU_handle_F1_SETUP_RESPONSE() {
// SETUP FAILURE
void
DU_handle_F1_SETUP_FAILURE
(
struct
F1AP_F1AP_PDU_t
*
pdu_p
)
{
//
AssertFatal(1==0,"Not implemented yet\n");
AssertFatal
(
1
==
0
,
"Not implemented yet
\n
"
);
//F1AP_F1SetupFailureIEs_t *f1_setup_failure_p;
//f1_setup_failure_p = &pdu_p.choice.unsuccessfulOutcome.value.choice.F1SetupFailureIEs.protocolIEs;
...
...
@@ -643,7 +511,7 @@ void DU_handle_F1_SETUP_FAILURE(struct F1AP_F1AP_PDU_t *pdu_p) {
void
DU_send_ERROR_INDICATION
(
struct
F1AP_F1AP_PDU_t
*
pdu_p
)
{
//
AssertFatal(1==0,"Not implemented yet\n");
AssertFatal
(
1
==
0
,
"Not implemented yet
\n
"
);
//F1AP_F1ErrorIndicationIEs_t *f1_error_indication_p;
//f1_error_indication_p = &pdu_p.choice.successfulOutcome.value.choice.F1ErrorIndicationIEs.protocolIEs;
...
...
@@ -770,7 +638,7 @@ void DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(
printf
(
"
\n
"
);
f1ap_du_send_message
(
buffer
,
len
);
//du_f1ap_itti_send_sctp_data_req(instance, f1ap_setup_req->assoc_id, buffer, len, 0
);
/* decode */
// if (f1ap_decode_pdu(&pdu, buffer, len) > 0) {
// printf("Failed to decode F1 setup request\n");
...
...
@@ -842,7 +710,7 @@ void DU_send_UL_RRC_MESSAGE_TRANSFER(void) {
printf
(
"
\n
"
);
f1ap_du_send_message
(
buffer
,
len
);
//du_f1ap_itti_send_sctp_data_req(instance, f1ap_setup_req->assoc_id, buffer, len, 0
);
/* decode */
// if (f1ap_decode_pdu(&pdu, buffer, len) > 0) {
// printf("Failed to decode F1 setup request\n");
...
...
@@ -1304,7 +1172,7 @@ void DU_send_gNB_DU_CONFIGURATION_UPDATE(module_id_t enb_mod_idP, module_id_t du
printf
(
"
\n
"
);
//
f1ap_du_send_message(buffer, len
);
//
du_f1ap_itti_send_sctp_data_req(instance, f1ap_setup_req->assoc_id, buffer, len, 0
);
/* decode */
if
(
f1ap_decode_pdu
(
&
pdu
,
buffer
,
len
)
>
0
)
{
...
...
@@ -1617,7 +1485,7 @@ void DU_send_UE_CONTEXT_SETUP_RESPONSE(void) {
// if (f1ap_decode_pdu(&pdu, buffer, len) > 0) {
// printf("Failed to decode F1 setup request\n");
// }
f1ap_du_send_message
(
buffer
,
len
);
//du_f1ap_itti_send_sctp_data_req(instance, f1ap_setup_req->assoc_id, buffer, len, 0
);
}
void
DU_send_UE_CONTEXT_SETUP_FAILURE
(
F1AP_UEContextSetupFailure_t
UEContextSetupFailure
)
{
...
...
@@ -2005,7 +1873,7 @@ void DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(void) {
// if (f1ap_decode_pdu(&pdu, buffer, len) > 0) {
// printf("Failed to decode F1 setup request\n");
// }
f1ap_du_send_message
(
buffer
,
len
);
//du_f1ap_itti_send_sctp_data_req(instance, f1ap_setup_req->assoc_id, buffer, len, 0
);
}
...
...
openair2/F1AP/sctp_cu.c
deleted
100644 → 0
View file @
021d7abf
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file sctp_server.c
* \brief sctp server procedures for f1ap
* \author EURECOM/NTUST
* \date 2018
* \version 0.1
* \company Eurecom
* \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr
* \note
* \warning
*/
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <netinet/sctp.h>
#include <arpa/inet.h>
#include <pthread.h>
#include <unistd.h> // for close
#include <stdlib.h>
#include "f1ap_handlers.h"
#define MAX_BUFFER 1024
/* server */
int
sfd
,
cfd
,
len
,
flags
;
struct
sctp_sndrcvinfo
sndrcvinfo
;
struct
sockaddr_in
saddr
,
caddr
;
struct
sctp_initmsg
initmsg
;
uint8_t
buff
[
INET_ADDRSTRLEN
];
void
send_func
(
int
cfd
)
{
uint8_t
buffer_send
[
MAX_BUFFER
+
1
];
/* Changing 9th character the character after # in the message buffer */
buffer_send
[
0
]
=
rand
();
sctp_sendmsg
(
cfd
,
(
void
*
)
buffer_send
,
(
size_t
)
strlen
(
buffer_send
),
NULL
,
0
,
htons
(
62
),
0
,
1
/* stream */
,
0
,
0
);
printf
(
"S - Sent: %s
\n
"
,
buffer_send
);
}
void
*
recv_func
(
void
*
cfd
)
{
int
ret
;
uint8_t
buffer_recv
[
MAX_BUFFER
+
1
];
//recv message
bzero
(
(
void
*
)
&
buffer_recv
,
sizeof
(
buffer_recv
)
);
while
(
ret
=
sctp_recvmsg
(
*
(
int
*
)
cfd
,
(
void
*
)
buffer_recv
,
sizeof
(
buffer_recv
),
(
struct
sockaddr
*
)
NULL
,
0
,
&
sndrcvinfo
,
&
flags
))
{
//send_func(*(int*)cfd);
//printf("S - cfd = %d\n", *(int*)cfd);
printf
(
"S - Received following data on ppid %d, data is: %x
\n
"
,
sndrcvinfo
.
sinfo_ppid
,
buffer_recv
);
printf
(
"S - Received following data on stream %d, data is:
\n
"
,
sndrcvinfo
.
sinfo_stream
);
int
i_ret
;
for
(
i_ret
=
0
;
i_ret
<
sizeof
(
buffer_recv
);
i_ret
++
)
{
printf
(
"%x "
,
*
(
buffer_recv
+
i_ret
));
}
printf
(
"
\n
"
);
f1ap_handle_message
(
1
/*sctp_data_ind->assoc_id*/
,
1
/*sctp_data_ind->stream*/
,
buffer_recv
,
sizeof
(
buffer_recv
));
//f1ap_decode_pdu(NULL , buffer_recv, sizeof(buffer_recv));
}
printf
(
"ret = %d
\n
"
,
ret
);
close
(
*
(
int
*
)
cfd
);
return
NULL
;
}
int
sctp_cu_init
(
void
)
{
pthread_t
threads
;
printf
(
"S - Waiting for socket_accept
\n
"
);
sfd
=
socket
(
AF_INET
,
SOCK_STREAM
,
IPPROTO_SCTP
);
bzero
(
(
void
*
)
&
saddr
,
sizeof
(
saddr
)
);
saddr
.
sin_family
=
AF_INET
;
saddr
.
sin_addr
.
s_addr
=
htonl
(
INADDR_ANY
);
saddr
.
sin_port
=
htons
(
29008
);
bind
(
sfd
,
(
struct
sockaddr
*
)
&
saddr
,
sizeof
(
saddr
)
);
/* Maximum of 3 streams will be available per socket */
memset
(
&
initmsg
,
0
,
sizeof
(
initmsg
)
);
initmsg
.
sinit_num_ostreams
=
3
;
initmsg
.
sinit_max_instreams
=
3
;
initmsg
.
sinit_max_attempts
=
2
;
setsockopt
(
sfd
,
IPPROTO_SCTP
,
SCTP_INITMSG
,
&
initmsg
,
sizeof
(
initmsg
)
);
listen
(
sfd
,
5
);
while
(
cfd
=
accept
(
sfd
,
(
struct
sockaddr
*
)
&
caddr
,
(
socklen_t
*
)
&
caddr
))
{
printf
(
"-------- S - Connected to %s
\n
"
,
inet_ntop
(
AF_INET
,
&
caddr
.
sin_addr
,
buff
,
sizeof
(
buff
)));
int
*
thread_args
=
malloc
(
sizeof
(
int
));
*
thread_args
=
cfd
;
pthread_create
(
&
threads
,
NULL
,
recv_func
,
thread_args
);
}
printf
(
"S - close
\n
"
);
return
0
;
}
openair2/F1AP/sctp_cu.h
deleted
100644 → 0
View file @
021d7abf
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file sctp_cu.h
* \brief sctp server procedures for F1AP
* \author Robert Schmidt
* \date 2018
* \version 0.1
* \company Eurecom
* \email: robert.schmidt@eurecom.fr
* \note
* \warning
*/
#ifndef SCTP_CU_H_
#define SCTP_CU_H_
//void send_func(int cfd);
//void *recv_func(void *cfd);
int
sctp_cu_init
(
void
);
#endif
/* SCTP_CU_H_ */
openair2/F1AP/sctp_du.c
deleted
100644 → 0
View file @
021d7abf
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file sctp_client.c
* \brief sctp client procedures for f1ap
* \author EURECOM/NTUST
* \date 2018
* \version 0.1
* \company Eurecom
* \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr
* \note
* \warning
*/
#include <stdio.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <netinet/sctp.h>
#include <pthread.h>
#include <arpa/inet.h>
#include <unistd.h> // for close
#include <stdlib.h>
#define MAX_BUFFER 1024
#define NUM_THREADS 1
int
cfd
,
i
,
flags
,
ret
;
struct
sockaddr_in
saddr
;
struct
sctp_sndrcvinfo
sndrcvinfo
;
struct
sctp_event_subscribe
events
;
struct
sctp_initmsg
initmsg
;
uint8_t
buffer_send
[
MAX_BUFFER
+
1
];
uint8_t
buffer_recv
[
MAX_BUFFER
+
1
];
void
f1ap_du_send_message
(
uint8_t
*
buffer_send
,
uint32_t
length
)
{
/* Changing 9th character the character after # in the message buffer */
//while (1) {
//buffer_send[0] = rand();
sctp_sendmsg
(
cfd
,
(
void
*
)
buffer_send
,
length
,
NULL
,
0
,
htonl
(
62
),
0
,
1
/* stream */
,
0
,
0
);
printf
(
"C - Sent: "
);
int
i_ret
;
for
(
i_ret
=
0
;
i_ret
<
length
;
i_ret
++
)
{
printf
(
"%x "
,
*
(
buffer_send
+
i_ret
));
}
printf
(
"
\n
"
);
//}
}
/* for test*/
void
*
send_func
(
void
*
argument
)
{
/* Changing 9th character the character after # in the message buffer */
while
(
1
)
{
buffer_send
[
0
]
=
rand
();
sctp_sendmsg
(
cfd
,
(
void
*
)
buffer_send
,
(
size_t
)
strlen
(
buffer_send
),
NULL
,
0
,
0
,
0
,
1
/* stream */
,
0
,
0
);
printf
(
"C - Sent: %s
\n
"
,
buffer_send
);
}
}
void
*
recv_func
(
void
*
argument
)
{
bzero
(
(
void
*
)
&
buffer_recv
,
sizeof
(
buffer_recv
)
);
while
(
ret
=
sctp_recvmsg
(
cfd
,
(
void
*
)
buffer_recv
,
sizeof
(
buffer_recv
),
(
struct
sockaddr
*
)
NULL
,
0
,
&
sndrcvinfo
,
&
flags
))
{
printf
(
"C - Received following data on stream %d, data is: %s
\n
"
,
sndrcvinfo
.
sinfo_stream
,
buffer_recv
);
}
close
(
cfd
);
printf
(
"C - close
\n
"
);
}
int
sctp_du_init
()
{
pthread_t
threads
[
NUM_THREADS
];
char
*
ipadd
;
ipadd
=
"127.0.0.1"
;
printf
(
"Use default ipaddress %s
\n
"
,
ipadd
);
cfd
=
socket
(
AF_INET
,
SOCK_STREAM
,
IPPROTO_SCTP
);
/* Specify that a maximum of 3 streams will be available per socket */
memset
(
&
initmsg
,
0
,
sizeof
(
initmsg
)
);
initmsg
.
sinit_num_ostreams
=
3
;
initmsg
.
sinit_max_instreams
=
3
;
initmsg
.
sinit_max_attempts
=
2
;
setsockopt
(
cfd
,
IPPROTO_SCTP
,
SCTP_INITMSG
,
&
initmsg
,
sizeof
(
initmsg
)
);
bzero
(
(
void
*
)
&
saddr
,
sizeof
(
saddr
)
);
saddr
.
sin_family
=
AF_INET
;
inet_pton
(
AF_INET
,
ipadd
,
&
saddr
.
sin_addr
);
saddr
.
sin_port
=
htons
(
29008
);
int
ret
;
ret
=
connect
(
cfd
,
(
struct
sockaddr
*
)
&
saddr
,
sizeof
(
saddr
)
);
if
(
ret
==
-
1
)
{
printf
(
"C - Not founded Server, close
\n
"
);
return
0
;
}
memset
(
(
void
*
)
&
events
,
0
,
sizeof
(
events
)
);
events
.
sctp_data_io_event
=
1
;
setsockopt
(
cfd
,
SOL_SCTP
,
SCTP_EVENTS
,
(
const
void
*
)
&
events
,
sizeof
(
events
)
);
/* Sending three messages on different streams */
// send message
//pthread_create(&threads[0], NULL, send_func, (void *)0);
pthread_create
(
&
threads
[
0
],
NULL
,
recv_func
,
(
void
*
)
0
);
return
0
;
}
\ No newline at end of file
openair2/F1AP/sctp_du.h
deleted
100644 → 0
View file @
021d7abf
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file sctp_du.h
* \brief sctp server procedures for F1AP
* \author Robert Schmidt
* \date 2018
* \version 0.1
* \company Eurecom
* \email: robert.schmidt@eurecom.fr
* \note
* \warning
*/
#ifndef SCTP_DU_H_
#define SCTP_DU_H_
//void f1ap_du_send_message(uint8_t *buffer_send, uint32_t length);
//void *send_func(void *argument);
//void *recv_func(void *argument);
int
sctp_du_init
(
void
);
#endif
/* SCTP_DU_H_ */
openair2/F1AP/test_f1ap_cu.c
deleted
100644 → 0
View file @
021d7abf
/* Test */
void
CU_handle_F1_SETUP_REQUEST
(
void
);
/**/
int
main
(
void
)
{
/* Test */
F1AP_CU_task
();
//CU_handle_F1_SETUP_REQUEST();
return
0
;
}
openair2/F1AP/test_f1ap_du.c
deleted
100644 → 0
View file @
021d7abf
int
main
(
void
)
{
F1AP_DU_task
();
return
0
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment