|
|
|
@ -49,6 +49,10 @@ |
|
|
|
|
#include <osmocom/abis/abis.h> |
|
|
|
|
|
|
|
|
|
#include "logging.h" |
|
|
|
|
#include "v5x_internal.h" |
|
|
|
|
#include "v5x_protocol.h" |
|
|
|
|
#include "v51_le_ctrl.h" |
|
|
|
|
#include "lapv5.h" |
|
|
|
|
|
|
|
|
|
#define _GNU_SOURCE |
|
|
|
|
#include <getopt.h> |
|
|
|
@ -59,6 +63,7 @@ |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
void *tall_v5le_ctx = NULL; |
|
|
|
|
struct v5x_instance *v5i = NULL; |
|
|
|
|
|
|
|
|
|
struct v5le_config { |
|
|
|
|
}; |
|
|
|
@ -86,11 +91,33 @@ static const struct e1inp_line_ops v5le_e1_line_ops = { |
|
|
|
|
.sign_link = v5le_rx_sign, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
#include "v5x_protocol.h" |
|
|
|
|
/* data L1 -> L2 */ |
|
|
|
|
static void hdlc_rx_cb(struct e1inp_ts *ts, struct msgb *msg) |
|
|
|
|
{ |
|
|
|
|
LOGP(DLINP, LOGL_NOTICE, "HDLC Rx: %s\n", msgb_hexdump(msg)); |
|
|
|
|
#warning HACKING |
|
|
|
|
struct v5x_interface *v5if = (struct v5x_interface *)v5i->interfaces.next; |
|
|
|
|
struct v5x_user_port *v5up; |
|
|
|
|
uint16_t dladdr; |
|
|
|
|
|
|
|
|
|
msgb_free(msg); |
|
|
|
|
LOGP(DLINP, LOGL_NOTICE, "L1->L2: %s\n", msgb_hexdump(msg)); |
|
|
|
|
|
|
|
|
|
lapv5ef_rx(v5if->primary_link, msg); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* l2 -> L1 */ |
|
|
|
|
int ph_data_req(struct msgb *msg, void *cbdata) |
|
|
|
|
{ |
|
|
|
|
msg->l2h = msgb_push(msg, 2); |
|
|
|
|
msg->l2h[0] = msg->l2h[2] & 0xfd; |
|
|
|
|
msg->l2h[1] = msg->l2h[3]; |
|
|
|
|
LOGP(DLINP, LOGL_NOTICE, "L2->L1: %s\n", msgb_hexdump(msg)); |
|
|
|
|
|
|
|
|
|
#warning hacking |
|
|
|
|
struct e1inp_line *e1_line = e1inp_line_find(0); |
|
|
|
|
struct e1inp_ts *ts = &e1_line->ts[16-1]; |
|
|
|
|
|
|
|
|
|
return e1inp_ts_send_hdlc(ts, msg); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static int e1_init(void) |
|
|
|
@ -284,6 +311,9 @@ int main(int argc, char **argv) |
|
|
|
|
rate_ctr_init(tall_v5le_ctx); |
|
|
|
|
osmo_stats_init(tall_v5le_ctx); |
|
|
|
|
|
|
|
|
|
// FIXME:
|
|
|
|
|
osmo_fsm_register(&v51_ctrl_fsm); |
|
|
|
|
|
|
|
|
|
rc = vty_read_config_file(config_file, NULL); |
|
|
|
|
if (rc < 0) |
|
|
|
|
return rc; |
|
|
|
@ -297,6 +327,23 @@ int main(int argc, char **argv) |
|
|
|
|
if (rc < 0) |
|
|
|
|
return rc; |
|
|
|
|
|
|
|
|
|
/* create v5x instance */ |
|
|
|
|
v5i = v5x_instance_alloc(tall_v5le_ctx); |
|
|
|
|
if (!v5i) |
|
|
|
|
return -ENOMEM; |
|
|
|
|
|
|
|
|
|
// FIXME: move this to VTY code
|
|
|
|
|
/* create v5x interface */ |
|
|
|
|
struct v5x_interface *v5if; |
|
|
|
|
struct v5x_user_port *v5up; |
|
|
|
|
uint32_t interface_id = 1; |
|
|
|
|
uint8_t interface_variant = 1; |
|
|
|
|
v5if = v5x_interface_alloc(v5i, V5X_DIALECT_V51, interface_id, interface_variant, ph_data_req); |
|
|
|
|
if (!v5if) |
|
|
|
|
return -ENOMEM; |
|
|
|
|
v5up = v5x_user_port_create(v5if, 1001, 1); |
|
|
|
|
if (!v5up) |
|
|
|
|
return -ENOMEM; |
|
|
|
|
#if 0 |
|
|
|
|
cfg->ctrl = v5le_ctrl_interface_setup(cfg, ctrl_vty_get_bind_addr(), OSMO_CTRL_PORT_MGW); |
|
|
|
|
if (!cfg->ctrl) { |
|
|
|
|