aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/include/openbsc/sip_client.h
blob: 23eaa7f75ae4267fa6a08ccf58a0f7bbb6ca6975 (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
#pragma once

#include <osmocom/core/timer.h>

#define SIP_RECONNECT_INTERVAL 10

struct msgb;
struct ipa_client_conn;
struct sip_client;

/* Expects message in msg->l2h */
typedef int (*sip_read_cb_t)(struct sip_client *sip_client, struct msgb *msg);

struct sip_client {
	struct tcp_client_conn	*link;
	sip_read_cb_t	read_cb;
	void			*data;

	struct osmo_timer_list	connect_timer;
	int			is_connected;

	char *src_ip;
	char *dst_ip;
	u_int16_t src_port;
	u_int16_t dst_port;
};

struct sip_client *sip_client_create(const char *src_ip, u_int16_t src_port,
                                     const char *dst_ip, u_int16_t dst_port,
                                          sip_read_cb_t read_cb, void *data);

void sip_client_destroy(struct sip_client *sip_client);
int sip_client_send(struct sip_client *sip_client, struct msgb *msg);
struct msgb *sip_msgb_alloc(void);