#include <osmocom/core/select.h>
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/gsmtap_util.h>
+#include <osmocom/core/gsmtap.h>
#include <osmocom/core/utils.h>
#include <arpa/inet.h>
struct log_target *stderr_target;
void *l23_ctx = NULL;
+
static char *layer2_socket_path = "/tmp/osmocom_l2";
static char *sap_socket_path = "/tmp/osmocom_sap";
struct llist_head ms_list;
static struct osmocom_ms *ms = NULL;
-static uint32_t gsmtap_ip = 0;
+static char *gsmtap_ip = NULL;
+
unsigned short vty_port = 4247;
int (*l23_app_work) (struct osmocom_ms *ms) = NULL;
int (*l23_app_exit) (struct osmocom_ms *ms) = NULL;
int quit = 0;
+struct gsmtap_inst *gsmtap_inst;
const char *openbsc_copyright =
"%s"
static void handle_options(int argc, char **argv)
{
- struct sockaddr_in gsmtap;
struct l23_app_info *app = l23_app_info();
struct option *long_options;
char *opt;
ms->test_arfcn = atoi(optarg);
break;
case 'i':
- if (!inet_aton(optarg, &gsmtap.sin_addr)) {
- perror("inet_aton");
- exit(2);
- }
- gsmtap_ip = ntohl(gsmtap.sin_addr.s_addr);
+ gsmtap_ip = optarg;
break;
case 'v':
vty_port = atoi(optarg);
if (rc < 0)
fprintf(stderr, "Failed during sap_open(), no SIM reader\n");
- lapdm_init(&ms->l2_entity.lapdm_dcch, ms);
- lapdm_init(&ms->l2_entity.lapdm_acch, ms);
+ ms->lapdm_channel.lapdm_dcch.l1_ctx = ms;
+ ms->lapdm_channel.lapdm_dcch.l3_ctx = ms;
+ ms->lapdm_channel.lapdm_acch.l1_ctx = ms;
+ ms->lapdm_channel.lapdm_acch.l3_ctx = ms;
+ lapdm_channel_init(&ms->lapdm_channel, LAPDM_MODE_MS);
+ lapdm_channel_set_l1(&ms->lapdm_channel, l1ctl_ph_prim_cb, ms);
rc = l23_app_init(ms);
if (rc < 0)
exit(1);
if (gsmtap_ip) {
- rc = gsmtap_init(gsmtap_ip);
- if (rc < 0) {
+ gsmtap_inst = gsmtap_source_init(gsmtap_ip, GSMTAP_UDP_PORT, 1);
+ if (!gsmtap_inst) {
fprintf(stderr, "Failed during gsmtap_init()\n");
exit(1);
}
+ gsmtap_source_add_sink(gsmtap_inst);
}
signal(SIGINT, sighandler);