aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2011-09-03 15:33:24 +0200
committerHarald Welte <laforge@gnumonks.org>2011-09-03 15:33:24 +0200
commit41d0d84fd61a178f524eca001932807702bcafb7 (patch)
tree6dde97b11d62da5dc3ac78e86298add64efc7f86 /include
parentd6216405b7363c94174a6d301b96f5ed4a8730ce (diff)
add 'libosmotrau' for TRAU/RTP related code
This new library is intended to include everything related to interfacing actual voice channels either via E1 or via RTP. The first module in the library is osmo_rtp, based on the ortp library.
Diffstat (limited to 'include')
-rw-r--r--include/osmocom/Makefile.am2
-rw-r--r--include/osmocom/trau/Makefile.am3
-rw-r--r--include/osmocom/trau/osmo_ortp.h56
3 files changed, 60 insertions, 1 deletions
diff --git a/include/osmocom/Makefile.am b/include/osmocom/Makefile.am
index f9d5e7c..a8574ba 100644
--- a/include/osmocom/Makefile.am
+++ b/include/osmocom/Makefile.am
@@ -1 +1 @@
-SUBDIRS=abis
+SUBDIRS=abis trau
diff --git a/include/osmocom/trau/Makefile.am b/include/osmocom/trau/Makefile.am
new file mode 100644
index 0000000..d796c7c
--- /dev/null
+++ b/include/osmocom/trau/Makefile.am
@@ -0,0 +1,3 @@
+osmotrau_HEADERS = osmo_ortp.h
+
+osmotraudir = $(includedir)/osmocom/trau
diff --git a/include/osmocom/trau/osmo_ortp.h b/include/osmocom/trau/osmo_ortp.h
new file mode 100644
index 0000000..278423b
--- /dev/null
+++ b/include/osmocom/trau/osmo_ortp.h
@@ -0,0 +1,56 @@
+#ifndef _OSMO_ORTP_H
+#define _OSMO_ORTP_H
+
+#include <stdint.h>
+
+#include <osmocom/core/linuxlist.h>
+#include <osmocom/core/select.h>
+
+//#include <ortp/ortp.h>
+struct _RtpSession;
+
+
+#define RTP_PT_GSM_FULL 3
+#define RTP_PT_GSM_HALF 96
+#define RTP_PT_GSM_EFR 97
+#define RTP_PT_AMR 98
+
+struct osmo_rtp_socket {
+ /*! \biref list header for global list of sockets */
+ struct llist_head list;
+
+ /*! \brief libortp RTP session pointer */
+ struct _RtpSession *sess;
+ /*! \brief Osmo file descriptor for RTP socket FD */
+ struct osmo_fd rtp_bfd;
+ /*! \brief Osmo file descriptor for RTCP socket FD */
+ struct osmo_fd rtcp_bfd;
+
+ /*! \brief callback for incoming data */
+ void (*rx_cb)(struct osmo_rtp_socket *rs, const uint8_t *payload,
+ unsigned int payload_len);
+
+ /* Rx related */
+ uint32_t rx_user_ts;
+
+ /* Tx related */
+ uint32_t tx_timestamp;
+
+ void *priv;
+};
+
+void osmo_rtp_init(void *ctx);
+struct osmo_rtp_socket *osmo_rtp_socket_create(void *talloc_ctx);
+int osmo_rtp_socket_bind(struct osmo_rtp_socket *rs, const char *ip, int port);
+int osmo_rtp_socket_connect(struct osmo_rtp_socket *rs, const char *ip, uint16_t port);
+int osmo_rtp_socket_set_pt(struct osmo_rtp_socket *rs, int payload_type);
+int osmo_rtp_socket_free(struct osmo_rtp_socket *rs);
+int osmo_rtp_send_frame(struct osmo_rtp_socket *rs, const uint8_t *payload,
+ unsigned int payload_len, unsigned int duration);
+
+int osmo_rtp_get_bound_ip_port(struct osmo_rtp_socket *rs,
+ uint32_t *ip, int *port);
+int osmo_rtp_get_bound_addr(struct osmo_rtp_socket *rs,
+ const char **addr, int *port);
+
+#endif /* _OSMO_ORTP_H */