diff options
Diffstat (limited to 'src/host/virt_phy/src/virtphy.c')
-rw-r--r-- | src/host/virt_phy/src/virtphy.c | 52 |
1 files changed, 34 insertions, 18 deletions
diff --git a/src/host/virt_phy/src/virtphy.c b/src/host/virt_phy/src/virtphy.c index d0a2ddbf..0aa21adc 100644 --- a/src/host/virt_phy/src/virtphy.c +++ b/src/host/virt_phy/src/virtphy.c @@ -20,10 +20,6 @@ * */ -#include <osmocom/core/msgb.h> -#include <osmocom/core/select.h> -#include <osmocom/core/gsmtap.h> -#include <osmocom/core/application.h> #include <stdint.h> #include <string.h> #include <stdio.h> @@ -31,15 +27,22 @@ #include <getopt.h> #include <errno.h> #include <signal.h> -#include <virtphy/virtual_um.h> -#include <virtphy/l1ctl_sock.h> -#include <virtphy/virt_l1_model.h> -#include <virtphy/l1ctl_sap.h> -#include <virtphy/gsmtapl1_if.h> -#include <virtphy/logging.h> -#include <virtphy/virt_l1_sched.h> -#define DEFAULT_LOG_MASK "DL1C,2:DL1P,2:DVIRPHY,2:DMAIN,1" +#include <osmocom/core/msgb.h> +#include <osmocom/core/select.h> +#include <osmocom/core/gsmtap.h> +#include <osmocom/core/application.h> + +#include <osmocom/bb/virtphy/virtual_um.h> +#include <osmocom/bb/virtphy/l1ctl_sock.h> +#include <osmocom/bb/virtphy/virt_l1_model.h> +#include <osmocom/bb/virtphy/l1ctl_sap.h> +#include <osmocom/bb/virtphy/gsmtapl1_if.h> +#include <osmocom/bb/virtphy/logging.h> +#include <osmocom/bb/virtphy/virt_l1_sched.h> +#include <osmocom/bb/l1gprs.h> + +#define DEFAULT_LOG_MASK "DL1C,2:DL1P,2:DVIRPHY,2:DGPRS,1:DMAIN,1" /* this exists once in the program, and contains the state that we * only keep once: L1CTL server socket, GSMTAP/VirtUM socket */ @@ -59,13 +62,15 @@ static char *log_mask = DEFAULT_LOG_MASK; static char *l1ctl_sock_path = L1CTL_SOCK_PATH; static char *arfcn_sig_lev_red_mask = NULL; static char *pm_timeout = NULL; +static char *mcast_netdev = NULL; +static int mcast_ttl = -1; -static void print_usage() +static void print_usage(void) { printf("Usage: virtphy\n"); } -static void print_help() +static void print_help(void) { printf(" Some useful help...\n"); printf(" -h --help This text.\n"); @@ -76,6 +81,8 @@ static void print_help() printf(" -s --l1ctl-sock l1ctl socket path path.\n"); printf(" -r --arfcn-sig-lev-red reduce signal level (e.g. 666,12:888,43:176,22).\n"); printf(" -t --pm-timeout power management timeout.\n"); + printf(" -T --mcast-ttl TTL set TTL of Virtual Um GSMTAP multicast frames\n"); + printf(" -D --mcast-deav NETDEV bind to given network device for Virtual Um\n"); } static void handle_options(int argc, char **argv) @@ -91,9 +98,11 @@ static void handle_options(int argc, char **argv) {"l1ctl-sock", required_argument, 0, 's'}, {"arfcn-sig-lev-red", required_argument, 0, 'r'}, {"pm-timeout", required_argument, 0, 't'}, + {"mcast-ttl", required_argument, 0, 'T'}, + {"mcast-dev", required_argument, 0, 'D'}, {0, 0, 0, 0}, }; - c = getopt_long(argc, argv, "hz:y:x:d:s:r:t:", long_options, + c = getopt_long(argc, argv, "hz:y:x:d:s:r:t:T:D:", long_options, &option_index); if (c == -1) break; @@ -124,6 +133,12 @@ static void handle_options(int argc, char **argv) case 't': pm_timeout = optarg; break; + case 'T': + mcast_ttl = atoi(optarg); + break; + case 'D': + mcast_netdev = optarg; + break; default: break; } @@ -227,12 +242,13 @@ int main(int argc, char *argv[]) /* init loginfo */ handle_options(argc, argv); - ms_log_init(log_mask); + ms_log_init(tall_vphy_ctx, log_mask); + l1gprs_logging_init(DGPRS); LOGP(DVIRPHY, LOGL_INFO, "Virtual physical layer starting up...\n"); - g_vphy.virt_um = virt_um_init(tall_vphy_ctx, ul_tx_grp, port, dl_rx_grp, port, - gsmtapl1_rx_from_virt_um_inst_cb); + g_vphy.virt_um = virt_um_init(tall_vphy_ctx, ul_tx_grp, port, dl_rx_grp, port, mcast_ttl, + mcast_netdev, gsmtapl1_rx_from_virt_um_inst_cb); g_vphy.l1ctl_sock = l1ctl_sock_init(tall_vphy_ctx, l1ctl_sap_rx_from_l23_inst_cb, l1ctl_accept_cb, l1ctl_close_cb, l1ctl_sock_path); |