blob: 69888f58bd5be32f9d813c07ef113503b5ea392b [file] [log] [blame]
Pablo Neira Ayuso96e81282011-06-09 15:06:11 +02001#ifndef _OSMO_IPA_H_
2#define _OSMO_IPA_H_
3
Pablo Neira Ayuso9b3a33c2011-06-21 13:52:41 +02004#include <stdint.h>
Pablo Neira Ayuso96e81282011-06-09 15:06:11 +02005#include <osmocom/core/linuxlist.h>
6#include <osmocom/core/timer.h>
7
8enum ipa_link_state {
9 IPA_LINK_STATE_NONE = 0,
10 IPA_LINK_STATE_CONNECTING = 1,
11 IPA_LINK_STATE_CONNECTED = 2,
12 IPA_LINK_STATE_MAX
13};
14
15struct ipa_link {
16 struct e1inp_line *line;
17 struct osmo_fd ofd;
18 struct llist_head tx_queue;
19 struct osmo_timer_list timer;
20 enum ipa_link_state state;
Pablo Neira Ayusoc00ee732011-06-21 12:22:49 +020021 const char *addr;
Pablo Neira Ayuso9b3a33c2011-06-21 13:52:41 +020022 uint16_t port;
Pablo Neira Ayuso591ddad2011-06-21 18:16:42 +020023 int (*cb)(struct ipa_link *link, struct msgb *msg);
Pablo Neira Ayuso96e81282011-06-09 15:06:11 +020024};
25
Pablo Neira Ayuso591ddad2011-06-21 18:16:42 +020026struct ipa_link *ipa_client_link_create(void *ctx, struct e1inp_line *line, const char *addr, uint16_t port, int (*cb)(struct ipa_link *link, struct msgb *msgb));
Pablo Neira Ayuso96e81282011-06-09 15:06:11 +020027void ipa_client_link_destroy(struct ipa_link *link);
28
29int ipa_client_link_open(struct ipa_link *link);
30void ipa_client_link_close(struct ipa_link *link);
31
32int ipa_msg_recv(int fd, struct msgb **rmsg);
33
34#endif