diff --git a/targets/RT/USER/rrh_gw.c b/targets/RT/USER/rrh_gw.c index 8042be78858da09c2660efd8afe4f5a075cffde2..d9394a866eaa6c238bd178dd7a54f74828226b4b 100644 --- a/targets/RT/USER/rrh_gw.c +++ b/targets/RT/USER/rrh_gw.c @@ -113,6 +113,7 @@ unsigned int rt_period; struct itimerspec timerspec; +char* if_name="eth0"; int main(int argc, char **argv) { @@ -188,6 +189,7 @@ static rrh_module_t new_module (unsigned int id, dev_type_t type) { rrh_mod.eth_dev.func_type=RRH_FUNC; /* each module is associated with an ethernet device */ rrh_mod.eth_dev.type=ETH_IF; + get_ip_addreess(if_name); openair0_cfg.my_ip=&rrh_ip[0]; openair0_cfg.my_port=rrh_port; @@ -458,7 +460,7 @@ static void get_options(int argc, char *argv[]) { int opt; - while ((opt = getopt(argc, argv, "xvhlte:n:u:g:r:w:")) != -1) { + while ((opt = getopt(argc, argv, "xvhlte:n:u:g:r:w:i:")) != -1) { switch (opt) { case 'n': @@ -472,6 +474,12 @@ static void get_options(int argc, char *argv[]) { case 'g': glog_level=atoi(optarg); break; + case 'i': + if (optarg) { + if_name=strdup(optarg); + printf("RRH interface name is set to %s\n", if_name); + } + break; case 'r': //rrh_log_level=atoi(optarg); break; @@ -510,6 +518,28 @@ static void get_options(int argc, char *argv[]) { } +int get_ip_addreess(char* if_name){ + + int fd; + struct ifreq ifr; + + fd = socket(AF_INET, SOCK_DGRAM, 0); + + /* I want to get an IPv4 IP address */ + ifr.ifr_addr.sa_family = AF_INET; + + /* I want IP address attached to "eth0" */ + strncpy(ifr.ifr_name, if_name, IFNAMSIZ-1); + + ioctl(fd, SIOCGIFADDR, &ifr); + + close(fd); + + /* display result */ + snprintf(&rrh_ip[0],20,"%s", inet_ntoa(((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr)); + printf("Got IP address %s from interface %s\n", rrh_ip,if_name); + return 0; +} /*!\fn void print_help(void) * \brief this function @@ -527,6 +557,7 @@ static void print_help(void) { puts("\t -n create eNB module\n"); puts("\t -u create UE module\n"); puts("\t -g define global log level\n"); + puts("\t -i set the RRH interface (default eth0)\n"); puts("\t -r define rrh log level\n"); puts("\t -e define eNB log level\n"); puts("\t -x enable real time bahaviour\n"); diff --git a/targets/SIMU/USER/oaisim.c b/targets/SIMU/USER/oaisim.c index 8e1e3a98c90db14f7d48ebb4045006412c162eb4..cd87d304955616d6aaf07a26b19af8cf0046a2df 100644 --- a/targets/SIMU/USER/oaisim.c +++ b/targets/SIMU/USER/oaisim.c @@ -26,6 +26,16 @@ Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE *******************************************************************************/ +/*! \file oaisim.c +* \brief oaisim top level +* \author Navid Nikaein +* \date 2013-2015 +* \version 1.0 +* \company Eurecom +* \email: openair_tech@eurecom.fr +* \note +* \warning +*/ #include <string.h> #include <math.h> diff --git a/targets/SIMU/USER/oaisim_config.c b/targets/SIMU/USER/oaisim_config.c index f6d94ee31bbac2297fc4e8470a67e33c02ef7d69..2a81a8619d1101cd788cc479338f7d4251d48fba 100644 --- a/targets/SIMU/USER/oaisim_config.c +++ b/targets/SIMU/USER/oaisim_config.c @@ -29,8 +29,8 @@ /*! \file oaisim_config.c * \brief Configuration of oaisim -* \author Navid Nikaein & Andre Gomes (One source) -* \date 2014 +* \author Navid Nikaein +* \date 2013-2015 * \version 1.0 * \company Eurecom * \email: openair_tech@eurecom.fr diff --git a/targets/SIMU/USER/oaisim_functions.c b/targets/SIMU/USER/oaisim_functions.c index faf6878f2556187bafdd578a2114f6ae85a6973c..5dfa8f424deb970d0c63d0d88f430c155afd95d6 100644 --- a/targets/SIMU/USER/oaisim_functions.c +++ b/targets/SIMU/USER/oaisim_functions.c @@ -26,6 +26,16 @@ Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE *******************************************************************************/ +/*! \file oaisim_functions.c +* \brief function primitives of oaisim +* \author Navid Nikaein +* \date 2013-2015 +* \version 1.0 +* \company Eurecom +* \email: openair_tech@eurecom.fr +* \note +* \warning +*/ #include <stdlib.h>