X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?p=sim%2Fe2-interface.git;a=blobdiff_plain;f=e2sim%2Fe2apv1sim%2Fsrc%2FDEF%2Fe2sim_defs.cpp;fp=e2sim%2Fe2apv1sim%2Fsrc%2FDEF%2Fe2sim_defs.cpp;h=0000000000000000000000000000000000000000;hp=f1730d3448228aae35cef8a20490d25d38c75760;hb=a9733dbcc47e93a3b2843056f1d587196296c324;hpb=3ebf932d23dcbec9ed19f4a51f9d00a0a54f5124 diff --git a/e2sim/e2apv1sim/src/DEF/e2sim_defs.cpp b/e2sim/e2apv1sim/src/DEF/e2sim_defs.cpp deleted file mode 100644 index f1730d3..0000000 --- a/e2sim/e2apv1sim/src/DEF/e2sim_defs.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/***************************************************************************** -# * -# Copyright 2019 AT&T Intellectual Property * -# Copyright 2019 Nokia * -# * -# 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. * -# * -******************************************************************************/ - -#include "e2sim_defs.h" -#include -#include -#include - -char* time_stamp(void) -{ - timeval curTime; - gettimeofday(&curTime, NULL); - int milli = curTime.tv_usec / 1000; - - char buffer [80]; - strftime(buffer, 80, "%Y-%m-%d %H:%M:%S", localtime(&curTime.tv_sec)); - - const int time_buffer_len = 84; - static char currentTime[time_buffer_len] = ""; - snprintf(currentTime, time_buffer_len, "%s:%03d", buffer, milli); - - return currentTime; -} - -options_t read_input_options_old(int argc, char* argv[]) -{ - options_t options; - - options.server_ip = (char*)DEFAULT_SCTP_IP; - options.server_port = X2AP_SCTP_PORT; - - // Parse command line options - static struct option long_options[] = - { - {"ipv4", required_argument, 0, 'i'}, - {"ipv6", required_argument, 0, 'I'}, - {"port", required_argument, 0, 'p'}, - {"verbose", no_argument, 0, 'v'}, - }; - - while(1) - { - int option_index = 0; - - char c = getopt_long(argc, argv, "i:I:p:", long_options, &option_index); - - if(c == -1) - break; - - switch(c) - { - case 'i': - options.server_ip = optarg; - break; - case 'I': - break; - case 'p': - options.server_port = atoi(optarg); - if(options.server_port < 1 || options.server_port > 65535) - { - LOG_E("Invalid port number (%d). Valid values are between 1 and 65535.\n", - options.server_port); - exit(1); - } - break; - - default: - LOG_E("Error: unknown input option: %c\n", optopt); - exit(1); - } - } - - return options; -} - -options_t read_input_options(int argc, char *argv[]) -{ - options_t options; - - options.server_ip = (char*)DEFAULT_SCTP_IP; - options.server_port = X2AP_SCTP_PORT; - - if(argc == 3) //user provided IP and PORT - { - options.server_ip = argv[1]; - options.server_port = atoi(argv[2]); - if(options.server_port < 1 || options.server_port > 65535) { - LOG_E("Invalid port number (%d). Valid values are between 1 and 65535.\n", - options.server_port); - exit(1); - } - } - else if(argc == 2) //user provided only IP - { - options.server_ip = argv[1]; - } - else if(argc == 1) - { - options.server_ip = (char*)DEFAULT_SCTP_IP; - } - else - { - LOG_I("Unrecognized option.\n"); - LOG_I("Usage: %s [SERVER IP ADDRESS] [SERVER PORT]\n", argv[0]); - exit(1); - } - - return options; -}