2016-07-22 16:57:50 +00:00
|
|
|
#pragma once
|
|
|
|
|
2018-03-08 23:34:04 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2016-07-22 16:57:50 +00:00
|
|
|
#include <osmocom/core/write_queue.h>
|
|
|
|
#include <osmocom/core/select.h>
|
2017-07-14 03:46:23 +00:00
|
|
|
#include <osmocom/core/timer.h>
|
2016-07-22 16:57:50 +00:00
|
|
|
#include <osmocom/core/msgb.h>
|
2017-05-31 02:28:40 +00:00
|
|
|
#include <osmocom/core/fsm.h>
|
2016-07-22 16:57:50 +00:00
|
|
|
|
|
|
|
#define L1CTL_LENGTH 256
|
|
|
|
#define L1CTL_HEADROOM 32
|
|
|
|
|
2018-03-08 23:34:04 +00:00
|
|
|
/**
|
|
|
|
* Each L1CTL message gets its own length pushed
|
|
|
|
* as two bytes in front before sending.
|
|
|
|
*/
|
|
|
|
#define L1CTL_MSG_LEN_FIELD 2
|
|
|
|
|
2017-07-08 11:16:42 +00:00
|
|
|
/* Forward declaration to avoid mutual include */
|
|
|
|
struct trx_instance;
|
|
|
|
|
2017-05-31 02:28:40 +00:00
|
|
|
enum l1ctl_fsm_states {
|
|
|
|
L1CTL_STATE_IDLE = 0,
|
|
|
|
L1CTL_STATE_CONNECTED,
|
|
|
|
};
|
|
|
|
|
2016-07-22 16:57:50 +00:00
|
|
|
struct l1ctl_link {
|
2017-05-31 02:28:40 +00:00
|
|
|
struct osmo_fsm_inst *fsm;
|
2016-07-22 16:57:50 +00:00
|
|
|
struct osmo_fd listen_bfd;
|
|
|
|
struct osmo_wqueue wq;
|
2017-07-08 11:16:42 +00:00
|
|
|
|
|
|
|
/* Bind TRX instance */
|
|
|
|
struct trx_instance *trx;
|
2017-07-08 13:28:09 +00:00
|
|
|
|
|
|
|
/* L1CTL handlers specific */
|
2017-07-14 03:46:23 +00:00
|
|
|
struct osmo_timer_list fbsb_timer;
|
2019-03-21 10:40:39 +00:00
|
|
|
bool fbsb_conf_sent;
|
2017-07-27 02:53:38 +00:00
|
|
|
|
|
|
|
/* Shutdown callback */
|
|
|
|
void (*shutdown_cb)(struct l1ctl_link *l1l);
|
2016-07-22 16:57:50 +00:00
|
|
|
};
|
|
|
|
|
2019-01-17 04:12:00 +00:00
|
|
|
struct l1ctl_link *l1ctl_link_init(void *tall_ctx, const char *sock_path);
|
2016-07-22 16:57:50 +00:00
|
|
|
void l1ctl_link_shutdown(struct l1ctl_link *l1l);
|
|
|
|
|
|
|
|
int l1ctl_link_send(struct l1ctl_link *l1l, struct msgb *msg);
|
|
|
|
int l1ctl_link_close_conn(struct l1ctl_link *l1l);
|