2012-07-09 17:39:55 +00:00
|
|
|
#ifndef _OSMUX_H_
|
|
|
|
#define _OSMUX_H_
|
|
|
|
|
|
|
|
/* OSmux header:
|
|
|
|
*
|
2013-05-24 10:44:46 +00:00
|
|
|
* ft (3 bits): 0=signalling, 1=voice
|
|
|
|
* ctr (3 bits): Number of batched AMR payloads (starting 0)
|
|
|
|
* amr_f (1 bit): AMR F field (RFC3267)
|
|
|
|
* amr_q (1 bit): AMR Q field (RFC3267)
|
|
|
|
* seq (8 bits): Combination of RTP timestamp and seq. number
|
|
|
|
* circuit_id (8 bits): Circuit ID, ie. Call identifier.
|
|
|
|
* amr_ft (4 bits): AMR FT field (RFC3267)
|
|
|
|
* amr_cmr (4 bits): AMR CMT field (RFC3267)
|
2012-07-09 17:39:55 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#define OSMUX_FT_SIGNAL 0
|
|
|
|
#define OSMUX_FT_VOICE_AMR 1
|
|
|
|
|
|
|
|
struct osmux_hdr {
|
|
|
|
#if __BYTE_ORDER == __BIG_ENDIAN
|
osmux: major rework to reduce batch message size (add counter field)
This patch adds the counter field to the osmux header, so we can
reduce the size of the batch even further, eg.
osmuxhdr (ctr=3)
speech
speech
speech
osmuxhdr (ctr=2)
speech
speech
...
The new header is the following:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| FT | CTR |F|Q| SeqNR | Circuit ID |AMR-FT |AMR-CMR|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
The counter field is 3 bits long, thus, we can batch up to 8
RTP speech frames into one single batch per circuit ID.
I have also removed the RTP marker, since it can be reconstructed
from the AMR information.
Moreover, the entire workflow has been also reworked. Whenever a
packet arrives, we introduce it into the batch list. This batch
list contains a list of RTP messages ordered by RTP SSRC. Then,
once the batch timer expires or the it gets full, we build the
batch from the list of RTP messages.
Note that this allows us to put several speech frame into one
single osmux header without actually worrying about the amount
of messages that we'll receive.
The functions that reconstruct the RTP messages has been also
adjusted. Now, it returns a list of RTP messages per RTP SSRC
that has been extracted from the batch.
2012-08-02 18:24:57 +00:00
|
|
|
uint8_t ft:3,
|
|
|
|
ctr:3,
|
|
|
|
amr_f:1,
|
|
|
|
amr_q:1;
|
2012-07-09 17:39:55 +00:00
|
|
|
#elif __BYTE_ORDER == __LITTLE_ENDIAN
|
osmux: major rework to reduce batch message size (add counter field)
This patch adds the counter field to the osmux header, so we can
reduce the size of the batch even further, eg.
osmuxhdr (ctr=3)
speech
speech
speech
osmuxhdr (ctr=2)
speech
speech
...
The new header is the following:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| FT | CTR |F|Q| SeqNR | Circuit ID |AMR-FT |AMR-CMR|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
The counter field is 3 bits long, thus, we can batch up to 8
RTP speech frames into one single batch per circuit ID.
I have also removed the RTP marker, since it can be reconstructed
from the AMR information.
Moreover, the entire workflow has been also reworked. Whenever a
packet arrives, we introduce it into the batch list. This batch
list contains a list of RTP messages ordered by RTP SSRC. Then,
once the batch timer expires or the it gets full, we build the
batch from the list of RTP messages.
Note that this allows us to put several speech frame into one
single osmux header without actually worrying about the amount
of messages that we'll receive.
The functions that reconstruct the RTP messages has been also
adjusted. Now, it returns a list of RTP messages per RTP SSRC
that has been extracted from the batch.
2012-08-02 18:24:57 +00:00
|
|
|
uint8_t amr_q:1,
|
|
|
|
amr_f:1,
|
|
|
|
ctr:3,
|
|
|
|
ft:3;
|
2012-07-09 17:39:55 +00:00
|
|
|
#endif
|
|
|
|
uint8_t seq;
|
2014-08-26 11:56:19 +00:00
|
|
|
#define OSMUX_CID_MAX 255 /* determined by circuit_id */
|
osmux: major rework to reduce batch message size (add counter field)
This patch adds the counter field to the osmux header, so we can
reduce the size of the batch even further, eg.
osmuxhdr (ctr=3)
speech
speech
speech
osmuxhdr (ctr=2)
speech
speech
...
The new header is the following:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| FT | CTR |F|Q| SeqNR | Circuit ID |AMR-FT |AMR-CMR|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
The counter field is 3 bits long, thus, we can batch up to 8
RTP speech frames into one single batch per circuit ID.
I have also removed the RTP marker, since it can be reconstructed
from the AMR information.
Moreover, the entire workflow has been also reworked. Whenever a
packet arrives, we introduce it into the batch list. This batch
list contains a list of RTP messages ordered by RTP SSRC. Then,
once the batch timer expires or the it gets full, we build the
batch from the list of RTP messages.
Note that this allows us to put several speech frame into one
single osmux header without actually worrying about the amount
of messages that we'll receive.
The functions that reconstruct the RTP messages has been also
adjusted. Now, it returns a list of RTP messages per RTP SSRC
that has been extracted from the batch.
2012-08-02 18:24:57 +00:00
|
|
|
uint8_t circuit_id;
|
2012-07-09 17:39:55 +00:00
|
|
|
#if __BYTE_ORDER == __BIG_ENDIAN
|
osmux: major rework to reduce batch message size (add counter field)
This patch adds the counter field to the osmux header, so we can
reduce the size of the batch even further, eg.
osmuxhdr (ctr=3)
speech
speech
speech
osmuxhdr (ctr=2)
speech
speech
...
The new header is the following:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| FT | CTR |F|Q| SeqNR | Circuit ID |AMR-FT |AMR-CMR|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
The counter field is 3 bits long, thus, we can batch up to 8
RTP speech frames into one single batch per circuit ID.
I have also removed the RTP marker, since it can be reconstructed
from the AMR information.
Moreover, the entire workflow has been also reworked. Whenever a
packet arrives, we introduce it into the batch list. This batch
list contains a list of RTP messages ordered by RTP SSRC. Then,
once the batch timer expires or the it gets full, we build the
batch from the list of RTP messages.
Note that this allows us to put several speech frame into one
single osmux header without actually worrying about the amount
of messages that we'll receive.
The functions that reconstruct the RTP messages has been also
adjusted. Now, it returns a list of RTP messages per RTP SSRC
that has been extracted from the batch.
2012-08-02 18:24:57 +00:00
|
|
|
uint8_t amr_ft:4,
|
|
|
|
amr_cmr:4;
|
2012-07-09 17:39:55 +00:00
|
|
|
#elif __BYTE_ORDER == __LITTLE_ENDIAN
|
osmux: major rework to reduce batch message size (add counter field)
This patch adds the counter field to the osmux header, so we can
reduce the size of the batch even further, eg.
osmuxhdr (ctr=3)
speech
speech
speech
osmuxhdr (ctr=2)
speech
speech
...
The new header is the following:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| FT | CTR |F|Q| SeqNR | Circuit ID |AMR-FT |AMR-CMR|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
The counter field is 3 bits long, thus, we can batch up to 8
RTP speech frames into one single batch per circuit ID.
I have also removed the RTP marker, since it can be reconstructed
from the AMR information.
Moreover, the entire workflow has been also reworked. Whenever a
packet arrives, we introduce it into the batch list. This batch
list contains a list of RTP messages ordered by RTP SSRC. Then,
once the batch timer expires or the it gets full, we build the
batch from the list of RTP messages.
Note that this allows us to put several speech frame into one
single osmux header without actually worrying about the amount
of messages that we'll receive.
The functions that reconstruct the RTP messages has been also
adjusted. Now, it returns a list of RTP messages per RTP SSRC
that has been extracted from the batch.
2012-08-02 18:24:57 +00:00
|
|
|
uint8_t amr_cmr:4,
|
|
|
|
amr_ft:4;
|
2012-07-09 17:39:55 +00:00
|
|
|
#endif
|
|
|
|
} __attribute__((packed));
|
|
|
|
|
|
|
|
/* one to handle all existing RTP flows */
|
|
|
|
struct osmux_in_handle {
|
|
|
|
uint8_t osmux_seq;
|
2012-08-06 16:45:18 +00:00
|
|
|
uint8_t batch_factor;
|
2014-08-28 13:01:03 +00:00
|
|
|
uint16_t batch_size;
|
2013-02-11 21:49:27 +00:00
|
|
|
void (*deliver)(struct msgb *msg, void *data);
|
|
|
|
void *data;
|
|
|
|
char *internal_data; /* internal data to store batch */
|
2012-07-09 17:39:55 +00:00
|
|
|
};
|
|
|
|
|
2012-08-06 18:20:57 +00:00
|
|
|
#define OSMUX_MAX_CONCURRENT_CALLS 8
|
|
|
|
|
2012-07-09 17:39:55 +00:00
|
|
|
/* one per OSmux circuit_id, ie. one per RTP flow. */
|
|
|
|
struct osmux_out_handle {
|
2013-02-12 16:23:29 +00:00
|
|
|
uint16_t rtp_seq;
|
|
|
|
uint32_t rtp_timestamp;
|
2013-05-12 16:03:50 +00:00
|
|
|
uint32_t rtp_ssrc;
|
2012-07-09 17:39:55 +00:00
|
|
|
};
|
|
|
|
|
2013-02-19 16:14:33 +00:00
|
|
|
struct osmux_hdr *osmux_get_hdr(struct msgb *msg);
|
|
|
|
|
2012-08-02 18:25:36 +00:00
|
|
|
static inline uint8_t *osmux_get_payload(struct osmux_hdr *osmuxh)
|
2012-07-09 17:39:55 +00:00
|
|
|
{
|
|
|
|
return (uint8_t *)osmuxh + sizeof(struct osmux_hdr);
|
|
|
|
}
|
|
|
|
|
2013-02-19 16:14:33 +00:00
|
|
|
int osmux_snprintf(char *buf, size_t size, struct msgb *msg);
|
|
|
|
|
2012-07-09 17:39:55 +00:00
|
|
|
void osmux_xfrm_input_init(struct osmux_in_handle *h);
|
2014-08-28 10:45:04 +00:00
|
|
|
void osmux_xfrm_input_fini(struct osmux_in_handle *h);
|
2012-08-06 16:41:49 +00:00
|
|
|
|
2012-10-20 18:10:31 +00:00
|
|
|
int osmux_xfrm_input(struct osmux_in_handle *h, struct msgb *msg, int ccid);
|
2012-07-09 17:39:55 +00:00
|
|
|
void osmux_xfrm_input_deliver(struct osmux_in_handle *h);
|
|
|
|
|
2013-05-12 16:03:50 +00:00
|
|
|
void osmux_xfrm_output_init(struct osmux_out_handle *h, uint32_t rtp_ssrc);
|
2012-08-04 17:56:47 +00:00
|
|
|
int osmux_xfrm_output(struct osmux_hdr *osmuxh, struct osmux_out_handle *h, struct llist_head *list);
|
2012-07-09 17:39:55 +00:00
|
|
|
struct osmux_hdr *osmux_xfrm_output_pull(struct msgb *msg);
|
|
|
|
|
2012-08-04 19:03:56 +00:00
|
|
|
void osmux_tx_sched(struct llist_head *list, void (*tx_cb)(struct msgb *msg, void *data), void *data);
|
2012-07-19 09:08:21 +00:00
|
|
|
|
2012-07-09 17:39:55 +00:00
|
|
|
#endif
|