4 #include <osmocom/core/endian.h> 5 #include <osmocom/core/timer.h> 6 #include <osmocom/core/msgb.h> 16 #define OSMUX_DEFAULT_PORT 1984 31 #define OSMUX_FT_SIGNAL 0 32 #define OSMUX_FT_VOICE_AMR 1 33 #define OSMUX_FT_DUMMY 2 36 #if OSMO_IS_LITTLE_ENDIAN 42 #elif OSMO_IS_BIG_ENDIAN 44 uint8_t rtp_m:1, ft:2, ctr:3, amr_f:1, amr_q:1;
47 #define OSMUX_CID_MAX 255 49 #if OSMO_IS_LITTLE_ENDIAN 52 #elif OSMO_IS_BIG_ENDIAN 54 uint8_t amr_ft:4, amr_cmr:4;
56 } __attribute__((packed));
66 uint32_t input_rtp_msgs;
67 uint32_t output_osmux_msgs;
68 uint64_t input_rtp_bytes;
69 uint64_t output_osmux_bytes;
72 void (*deliver)(
struct msgb *msg,
void *data);
77 #define OSMUX_MAX_CONCURRENT_CALLS 8 79 typedef struct msgb *(*rtp_msgb_alloc_cb_t)(
void *rtp_msgb_alloc_priv_data,
80 unsigned int msg_len);
84 uint32_t rtp_timestamp;
86 uint8_t rtp_payload_type;
87 uint8_t osmux_seq_ack;
88 struct osmo_timer_list timer;
89 struct llist_head list;
90 void (*tx_cb)(
struct msgb *msg,
void *data);
92 rtp_msgb_alloc_cb_t rtp_msgb_alloc_cb;
93 void *rtp_msgb_alloc_cb_data;
96 static inline uint8_t *osmux_get_payload(
struct osmux_hdr *osmuxh)
98 return (uint8_t *)osmuxh +
sizeof(
struct osmux_hdr);
104 #define OSMUX_BATCH_DEFAULT_MAX 1472 107 void osmux_xfrm_input_init(
struct osmux_in_handle *h) OSMO_DEPRECATED(
"Use osmux_xfrm_input_alloc() instead");
108 void osmux_xfrm_input_fini(
struct osmux_in_handle *h) OSMO_DEPRECATED(
"Use talloc_free() instead");
109 int osmux_xfrm_input_set_batch_factor(
struct osmux_in_handle *h, uint8_t batch_factor);
110 void osmux_xfrm_input_set_batch_size(
struct osmux_in_handle *h, uint16_t batch_size);
111 void osmux_xfrm_input_set_initial_seqnum(
struct osmux_in_handle *h, uint8_t osmux_seqnum);
112 void osmux_xfrm_input_set_deliver_cb(
struct osmux_in_handle *h,
void (*deliver_cb)(
struct msgb *msg,
void *data),
void *data);
115 int osmux_xfrm_input_open_circuit(
struct osmux_in_handle *h,
int ccid,
int dummy);
116 void osmux_xfrm_input_close_circuit(
struct osmux_in_handle *h,
int ccid);
122 void osmux_xfrm_output_init(
struct osmux_out_handle *h, uint32_t rtp_ssrc) OSMO_DEPRECATED(
"Use osmux_xfrm_output_alloc() and osmux_xfrm_output_set_rtp_*() instead");
123 void osmux_xfrm_output_init2(
struct osmux_out_handle *h, uint32_t rtp_ssrc, uint8_t rtp_payload_type) OSMO_DEPRECATED(
"Use osmux_xfrm_output_alloc() and osmux_xfrm_output_set_rtp_*() instead");
130 struct osmux_hdr *osmux_xfrm_output_pull(
struct msgb *msg);
int osmux_xfrm_input(struct osmux_in_handle *h, struct msgb *msg, int ccid)
Definition: osmux_input.c:542
int osmux_snprintf(char *buf, size_t size, struct msgb *msg)
Definition: osmux.c:108
struct osmux_out_handle * osmux_xfrm_output_alloc(void *ctx)
Allocate a new osmux out handle.
Definition: osmux_output.c:306
void osmux_xfrm_output_set_rtp_pl_type(struct osmux_out_handle *h, uint32_t rtp_payload_type)
Set Payload Type of generated RTP packets from Osmux frames.
Definition: osmux_output.c:386
void osmux_xfrm_output_set_tx_cb(struct osmux_out_handle *h, void(*tx_cb)(struct msgb *msg, void *data), void *data)
Set transmission callback to call when a generated RTP packet is to be transmitted.
Definition: osmux_output.c:351
void osmux_xfrm_output_set_rtp_msgb_alloc_cb(struct osmux_out_handle *h, rtp_msgb_alloc_cb_t cb, void *cb_data)
Set callback to call when an RTP packet to be generated is to be allocated.
Definition: osmux_output.c:365
void osmux_xfrm_output_set_rtp_ssrc(struct osmux_out_handle *h, uint32_t rtp_ssrc)
Set SSRC of generated RTP packets from Osmux frames.
Definition: osmux_output.c:377
int osmux_xfrm_output_sched(struct osmux_out_handle *h, struct osmux_hdr *osmuxh)
Generate RTP packets from osmux frame AMR payload set and schedule them for transmission at appropria...
Definition: osmux_output.c:216
struct osmux_in_handle * osmux_xfrm_input_alloc(void *ctx)
Allocate a new osmux in handle (osmux source, tx side)
Definition: osmux_input.c:619
void osmux_xfrm_output_flush(struct osmux_out_handle *h)
Flush all scheduled RTP packets still pending to be transmitted.
Definition: osmux_output.c:268