blob: e9fc157cfefffa05b8e7b454f9f2fe41f7d42bda [file] [log] [blame]
Harald Welteead7a7b2009-07-28 00:01:58 +02001#ifndef _RTP_PROXY_H
2#define _RTP_PROXY_H
3
4/* RTP proxy handling for ip.access nanoBTS */
5
6/* (C) 2009 by Harald Welte <laforge@gnumonks.org>
7 * All Rights Reserved
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 *
23 */
24
25
26#include <netinet/in.h>
27
28#include <openbsc/linuxlist.h>
29#include <openbsc/select.h>
30
31enum rtp_rx_action {
32 RTP_NONE,
33 RTP_PROXY,
34 RTP_RECV_UPSTREAM,
35};
36
37struct rtp_sub_socket {
38 struct sockaddr_in sin_local;
39 struct sockaddr_in sin_remote;
40
41 struct bsc_fd bfd;
42 /* linked list of to-be-transmitted msgb's */
43 struct llist_head tx_queue;
44};
45
46struct rtp_socket {
47 struct llist_head list;
48
49 struct rtp_sub_socket rtp;
50 struct rtp_sub_socket rtcp;
51
52 /* what should we do on receive? */
53 enum rtp_rx_action rx_action;
54 union {
55 struct {
56 struct rtp_socket *other_sock;
57 } proxy;
58 struct {
59 void (*recv_cb)(struct msgb *msg);
60 } receive;
61 };
62};
63
64struct rtp_socket *rtp_socket_create(void);
65int rtp_socket_bind(struct rtp_socket *rs, u_int32_t ip);
66int rtp_socket_connect(struct rtp_socket *rs, u_int32_t ip, u_int16_t port);
67int rtp_socket_proxy(struct rtp_socket *this, struct rtp_socket *other);
68int rtp_socket_free(struct rtp_socket *rs);
69
70#endif /* _RTP_PROXY_H */