Pablo Neira Ayuso | 96e8128 | 2011-06-09 15:06:11 +0200 | [diff] [blame] | 1 | #ifndef _OSMO_IPA_H_ |
| 2 | #define _OSMO_IPA_H_ |
| 3 | |
Pablo Neira Ayuso | 9b3a33c | 2011-06-21 13:52:41 +0200 | [diff] [blame] | 4 | #include <stdint.h> |
Pablo Neira Ayuso | 96e8128 | 2011-06-09 15:06:11 +0200 | [diff] [blame] | 5 | #include <osmocom/core/linuxlist.h> |
| 6 | #include <osmocom/core/timer.h> |
| 7 | |
| 8 | enum 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 | |
| 15 | struct 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 Ayuso | c00ee73 | 2011-06-21 12:22:49 +0200 | [diff] [blame] | 21 | const char *addr; |
Pablo Neira Ayuso | 9b3a33c | 2011-06-21 13:52:41 +0200 | [diff] [blame] | 22 | uint16_t port; |
Pablo Neira Ayuso | 591ddad | 2011-06-21 18:16:42 +0200 | [diff] [blame^] | 23 | int (*cb)(struct ipa_link *link, struct msgb *msg); |
Pablo Neira Ayuso | 96e8128 | 2011-06-09 15:06:11 +0200 | [diff] [blame] | 24 | }; |
| 25 | |
Pablo Neira Ayuso | 591ddad | 2011-06-21 18:16:42 +0200 | [diff] [blame^] | 26 | struct 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 Ayuso | 96e8128 | 2011-06-09 15:06:11 +0200 | [diff] [blame] | 27 | void ipa_client_link_destroy(struct ipa_link *link); |
| 28 | |
| 29 | int ipa_client_link_open(struct ipa_link *link); |
| 30 | void ipa_client_link_close(struct ipa_link *link); |
| 31 | |
| 32 | int ipa_msg_recv(int fd, struct msgb **rmsg); |
| 33 | |
| 34 | #endif |