1 #ifndef _OSMO_NETIF_IPA_H_
2 #define _OSMO_NETIF_IPA_H_
4 #include <osmocom/gsm/protocol/ipaccess.h>
5 #include <osmocom/gsm/ipa.h>
14 } __attribute__ ((packed));
19 } __attribute__ ((packed));
24 } __attribute__ ((packed));
32 #define OSMO_IPA_MSGB_CB(__msg) (&((( \
35 struct osmo_ipa_msgb_cb _cb; \
37 *)&((__msg)->cb[0]))->_cb))
39 #define osmo_ipa_msgb_cb_proto(__x) OSMO_IPA_MSGB_CB(__x)->proto
40 #define osmo_ipa_msgb_cb_proto_ext(__x) OSMO_IPA_MSGB_CB(__x)->proto_ext
42 struct msgb *osmo_ipa_msg_alloc(
int headroom);
43 struct msgb *osmo_ipa_ext_msg_alloc(
size_t headroom);
45 void osmo_ipa_msg_push_header(
struct msgb *msg, uint8_t proto);
47 int osmo_ipa_process_msg(
struct msgb *msg);
52 int osmo_ipa_rcvmsg_base(
struct msgb *msg,
struct osmo_fd *bfd,
int server);
53 int osmo_ipa_parse_unitid(
const char *str,
struct ipaccess_unit *unit_data);
55 int ipaccess_send_pong(
int fd);
56 int ipaccess_send_id_ack(
int fd);
57 int ipaccess_send_id_req(
int fd);
61 struct msgb *ipa_cli_id_resp(
struct osmo_ipa_unit *dev, uint8_t *data,
int len);
62 struct msgb *ipa_cli_id_ack(
void);
64 int osmo_ipa_parse_msg_id_resp(
struct msgb *msg,
struct ipaccess_unit *unit_data);
66 int osmo_ipa_segmentation_cb(
struct msgb *msg);
68 void osmo_ipa_msg_push_headers(
struct msgb *msg,
enum ipaccess_proto p,
enum ipaccess_proto_ext pe);
73 struct osmo_ipa_ka_fsm_inst;
74 typedef int (*osmo_ipa_ka_fsm_timeout_cb_t)(
struct osmo_ipa_ka_fsm_inst *ka_fi,
void *data);
76 typedef int (*osmo_ipa_ka_fsm_send_cb_t)(
struct osmo_ipa_ka_fsm_inst *ka_fi,
struct msgb *msg,
void *data);
78 struct osmo_ipa_ka_fsm_inst *osmo_ipa_ka_fsm_alloc(
void *ctx,
const char *
id);
79 void osmo_ipa_ka_fsm_free(
struct osmo_ipa_ka_fsm_inst *ka_fi);
81 int osmo_ipa_ka_fsm_set_id(
struct osmo_ipa_ka_fsm_inst *ka_fi,
const char *
id);
82 int osmo_ipa_ka_fsm_set_ping_interval(
struct osmo_ipa_ka_fsm_inst *ka_fi,
unsigned int interval);
83 int osmo_ipa_ka_fsm_set_pong_timeout(
struct osmo_ipa_ka_fsm_inst *ka_fi,
unsigned int timeout);
84 void osmo_ipa_ka_fsm_set_data(
struct osmo_ipa_ka_fsm_inst *ka_fi,
void *cb_data);
85 void *osmo_ipa_ka_fsm_get_data(
const struct osmo_ipa_ka_fsm_inst *ka_fi);
87 void osmo_ipa_ka_fsm_set_send_cb(
struct osmo_ipa_ka_fsm_inst *ka_fi, osmo_ipa_ka_fsm_send_cb_t send_cb);
88 void osmo_ipa_ka_fsm_set_timeout_cb(
struct osmo_ipa_ka_fsm_inst *ka_fi, osmo_ipa_ka_fsm_timeout_cb_t timeout_cb);
90 void osmo_ipa_ka_fsm_start(
struct osmo_ipa_ka_fsm_inst *ka_fi);
91 void osmo_ipa_ka_fsm_pong_received(
struct osmo_ipa_ka_fsm_inst *ka_fi);
92 void osmo_ipa_ka_fsm_stop(
struct osmo_ipa_ka_fsm_inst *ka_fi);