aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2012-08-06 20:20:57 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2012-08-06 21:04:25 +0200
commit7a01104b881153d1cbd73b7dd98149b16d53ee69 (patch)
treef06980104dfa48ddd23c445bf3e515cdb7fdc563
parent72a0aae500de36ef3fa528a9ce2e32a8ddde5080 (diff)
osmux: add OSMUX_MAX_CONCURRENT_CALLS which is 8
Instead of harcoding the number all around the code.
-rw-r--r--include/osmocom/netif/osmux.h6
-rw-r--r--src/osmux.c8
2 files changed, 8 insertions, 6 deletions
diff --git a/include/osmocom/netif/osmux.h b/include/osmocom/netif/osmux.h
index dd89973..f52fcb4 100644
--- a/include/osmocom/netif/osmux.h
+++ b/include/osmocom/netif/osmux.h
@@ -47,10 +47,12 @@ struct osmux_in_handle {
char *data; /* internal data */
};
+#define OSMUX_MAX_CONCURRENT_CALLS 8
+
/* one per OSmux circuit_id, ie. one per RTP flow. */
struct osmux_out_handle {
- uint16_t rtp_seq[8];
- uint32_t rtp_timestamp[8];
+ uint16_t rtp_seq[OSMUX_MAX_CONCURRENT_CALLS];
+ uint32_t rtp_timestamp[OSMUX_MAX_CONCURRENT_CALLS];
};
static inline uint8_t *osmux_get_payload(struct osmux_hdr *osmuxh)
diff --git a/src/osmux.c b/src/osmux.c
index ad18c36..5916edc 100644
--- a/src/osmux.c
+++ b/src/osmux.c
@@ -385,7 +385,7 @@ void osmux_xfrm_input_init(struct osmux_in_handle *h)
batch->timer.cb = osmux_batch_timer_expired;
batch->timer.data = h;
- for (i=0; i<8; i++)
+ for (i=0; i<OSMUX_MAX_CONCURRENT_CALLS; i++)
batch->ccid[i] = -1;
h->data = (void *)batch;
@@ -475,7 +475,7 @@ void osmux_xfrm_input_register_ccid(struct osmux_in_handle *h, uint32_t ssrc)
struct osmux_batch *batch = (struct osmux_batch *)h->data;;
int i, found = 0;
- for (i=0; i<8; i++) {
+ for (i=0; i<OSMUX_MAX_CONCURRENT_CALLS; i++) {
if (batch->ccid[i] == ssrc)
continue;
if (batch->ccid[i] < 0) {
@@ -498,7 +498,7 @@ int osmux_xfrm_input_get_ccid(struct osmux_in_handle *h, uint32_t ssrc)
struct osmux_batch *batch = (struct osmux_batch *)h->data;;
int i, found = 0;
- for (i=0; i<8; i++) {
+ for (i=0; i<OSMUX_MAX_CONCURRENT_CALLS; i++) {
if (batch->ccid[i] == ssrc) {
found = 1;
break;
@@ -512,7 +512,7 @@ void osmux_xfrm_output_init(struct osmux_out_handle *h)
{
int i;
- for (i=0; i<8; i++) {
+ for (i=0; i<OSMUX_MAX_CONCURRENT_CALLS; i++) {
h->rtp_seq[i] = (uint16_t)random();
h->rtp_timestamp[i] = (uint32_t)random();
}