Separated E2Sim lib from E2SM-specific code
Issue-ID: SIM-18
Signed-off-by: Ron Shacham <rshacham@research.att.com>
Change-Id: Ic4b1edc9011130a5f92a169012cbaeab56f9bc1d
Signed-off-by: Ron Shacham <rshacham@research.att.com>
diff --git a/e2sim/src/SCTP/CMakeLists.txt b/e2sim/src/SCTP/CMakeLists.txt
new file mode 100644
index 0000000..b069924
--- /dev/null
+++ b/e2sim/src/SCTP/CMakeLists.txt
@@ -0,0 +1,37 @@
+#/*****************************************************************************
+# *
+# Copyright 2020 AT&T Intellectual Property *
+# *
+# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 *
+# *
+# 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 clarity: this generates object, not a lib as the CM command implies.
+#
+add_library( sctp_objects OBJECT e2sim_sctp.cpp e2sim_sctp.c)
+
+target_include_directories (sctp_objects PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
+ $<INSTALL_INTERFACE:include>
+ PRIVATE src)
+
+
+if( DEV_PKG )
+ install( FILES
+ e2sim_sctp.hpp
+ e2sim_sctp.h
+ DESTINATION ${install_inc}
+ )
+endif()
+# ---------------------------------------------------------------------------
diff --git a/e2sim/src/SCTP/e2sim_sctp.cpp b/e2sim/src/SCTP/e2sim_sctp.cpp
index de68ec7..ce9d649 100644
--- a/e2sim/src/SCTP/e2sim_sctp.cpp
+++ b/e2sim/src/SCTP/e2sim_sctp.cpp
@@ -206,6 +206,7 @@
//Blocking call
client_fd = accept(server_fd, &client_addr, &client_addr_size);
+ fprintf(stderr, "client fd is %d\n", client_fd);
if(client_fd == -1){
perror("accept()");
close(client_fd);
@@ -231,7 +232,10 @@
int sctp_send_data(int &socket_fd, sctp_buffer_t &data)
{
+ fprintf(stderr,"in sctp send data func\n");
+ fprintf(stderr,"data.len is %d", data.len);
int sent_len = send(socket_fd, (void*)(&(data.buffer[0])), data.len, 0);
+ fprintf(stderr,"after getting sent_len\n");
if(sent_len == -1) {
perror("[SCTP] sctp_send_data");
@@ -243,6 +247,7 @@
int sctp_send_data_X2AP(int &socket_fd, sctp_buffer_t &data)
{
+ /*
int sent_len = sctp_sendmsg(socket_fd, (void*)(&(data.buffer[0])), data.len,
NULL, 0, (uint32_t) X2AP_PPID, 0, 0, 0, 0);
@@ -250,7 +255,8 @@
perror("[SCTP] sctp_send_data");
exit(1);
}
-
+ */
+ return 1;
}
/*
@@ -263,11 +269,15 @@
int sctp_receive_data(int &socket_fd, sctp_buffer_t &data)
{
//clear out the data before receiving
+ fprintf(stderr, "receive data1\n");
memset(data.buffer, 0, sizeof(data.buffer));
+ fprintf(stderr, "receive data2\n");
data.len = 0;
//receive data from the socket
int recv_len = recv(socket_fd, &(data.buffer), sizeof(data.buffer), 0);
+ fprintf(stderr, "receive data3\n");
+
if(recv_len == -1)
{
perror("[SCTP] recv");