summaryrefslogtreecommitdiffstats
path: root/src/host/trxcon/l1ctl_link.h
blob: f9d91f14dc8e1132cd4173d29a70513b8ea85575 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#pragma once

#include <osmocom/core/write_queue.h>
#include <osmocom/core/select.h>
#include <osmocom/core/timer.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/fsm.h>

#define L1CTL_LENGTH 256
#define L1CTL_HEADROOM 32

/* Forward declaration to avoid mutual include */
struct trx_instance;

enum l1ctl_fsm_states {
	L1CTL_STATE_IDLE = 0,
	L1CTL_STATE_CONNECTED,
};

struct l1ctl_link {
	struct osmo_fsm_inst *fsm;
	struct osmo_fd listen_bfd;
	struct osmo_wqueue wq;

	/* Bind TRX instance */
	struct trx_instance *trx;

	/* L1CTL handlers specific */
	struct osmo_timer_list fbsb_timer;
	uint8_t fbsb_conf_sent;

	/* Shutdown callback */
	void (*shutdown_cb)(struct l1ctl_link *l1l);
};

int l1ctl_link_init(struct l1ctl_link **l1l, const char *sock_path);
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);