osmux: Introduce API osmux_xfrm_input_set_name()
This will be used internally by osmux code to print more meaningful lines. Related: SYS#6161 Change-Id: Ibbcfdb23a6015ce45840bb64b2b560c2806f7ff6
This commit is contained in:
parent
c798429cb0
commit
22b4e8159d
|
@ -107,6 +107,7 @@ int osmux_snprintf(char *buf, size_t size, struct msgb *msg);
|
||||||
struct osmux_in_handle *osmux_xfrm_input_alloc(void *ctx);
|
struct osmux_in_handle *osmux_xfrm_input_alloc(void *ctx);
|
||||||
void osmux_xfrm_input_init(struct osmux_in_handle *h) OSMO_DEPRECATED("Use osmux_xfrm_input_alloc() instead");
|
void osmux_xfrm_input_init(struct osmux_in_handle *h) OSMO_DEPRECATED("Use osmux_xfrm_input_alloc() instead");
|
||||||
void osmux_xfrm_input_fini(struct osmux_in_handle *h) OSMO_DEPRECATED("Use talloc_free() instead");
|
void osmux_xfrm_input_fini(struct osmux_in_handle *h) OSMO_DEPRECATED("Use talloc_free() instead");
|
||||||
|
void osmux_xfrm_input_set_name(struct osmux_in_handle *h, const char *name);
|
||||||
int osmux_xfrm_input_set_batch_factor(struct osmux_in_handle *h, uint8_t batch_factor);
|
int osmux_xfrm_input_set_batch_factor(struct osmux_in_handle *h, uint8_t batch_factor);
|
||||||
void osmux_xfrm_input_set_batch_size(struct osmux_in_handle *h, uint16_t batch_size);
|
void osmux_xfrm_input_set_batch_size(struct osmux_in_handle *h, uint16_t batch_size);
|
||||||
void osmux_xfrm_input_set_initial_seqnum(struct osmux_in_handle *h, uint8_t osmux_seqnum);
|
void osmux_xfrm_input_set_initial_seqnum(struct osmux_in_handle *h, uint8_t osmux_seqnum);
|
||||||
|
|
|
@ -75,6 +75,7 @@ struct osmux_link {
|
||||||
unsigned int remaining_bytes;
|
unsigned int remaining_bytes;
|
||||||
uint32_t nmsgs;
|
uint32_t nmsgs;
|
||||||
int ndummy;
|
int ndummy;
|
||||||
|
char *name;
|
||||||
struct osmux_in_handle *h; /* backpointer to parent object */
|
struct osmux_in_handle *h; /* backpointer to parent object */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -686,6 +687,7 @@ static int osmux_xfrm_input_talloc_destructor(struct osmux_in_handle *h)
|
||||||
* stack outgoing network Osmux messages.
|
* stack outgoing network Osmux messages.
|
||||||
* Returned pointer can be freed with regular talloc_free, all pending messages
|
* Returned pointer can be freed with regular talloc_free, all pending messages
|
||||||
* in queue and all internal data will be freed. */
|
* in queue and all internal data will be freed. */
|
||||||
|
static unsigned int next_default_name_idx = 0;
|
||||||
struct osmux_in_handle *osmux_xfrm_input_alloc(void *ctx)
|
struct osmux_in_handle *osmux_xfrm_input_alloc(void *ctx)
|
||||||
{
|
{
|
||||||
struct osmux_in_handle *h;
|
struct osmux_in_handle *h;
|
||||||
|
@ -701,11 +703,13 @@ struct osmux_in_handle *osmux_xfrm_input_alloc(void *ctx)
|
||||||
INIT_LLIST_HEAD(&link->circuit_list);
|
INIT_LLIST_HEAD(&link->circuit_list);
|
||||||
link->h = h;
|
link->h = h;
|
||||||
link->remaining_bytes = h->batch_size;
|
link->remaining_bytes = h->batch_size;
|
||||||
|
link->name = talloc_asprintf(link, "input-%u", next_default_name_idx++);
|
||||||
osmo_timer_setup(&link->timer, osmux_link_timer_expired, h);
|
osmo_timer_setup(&link->timer, osmux_link_timer_expired, h);
|
||||||
|
|
||||||
h->internal_data = (void *)link;
|
h->internal_data = (void *)link;
|
||||||
|
|
||||||
LOGP(DLMUX, LOGL_DEBUG, "initialized osmux input converter\n");
|
LOGP(DLMUX, LOGL_DEBUG, "[%s] Initialized osmux input converter\n",
|
||||||
|
link->name);
|
||||||
|
|
||||||
talloc_set_destructor(h, osmux_xfrm_input_talloc_destructor);
|
talloc_set_destructor(h, osmux_xfrm_input_talloc_destructor);
|
||||||
return h;
|
return h;
|
||||||
|
@ -726,11 +730,13 @@ void osmux_xfrm_input_init(struct osmux_in_handle *h)
|
||||||
INIT_LLIST_HEAD(&link->circuit_list);
|
INIT_LLIST_HEAD(&link->circuit_list);
|
||||||
link->h = h;
|
link->h = h;
|
||||||
link->remaining_bytes = h->batch_size;
|
link->remaining_bytes = h->batch_size;
|
||||||
|
link->name = talloc_asprintf(link, "%u", next_default_name_idx++);
|
||||||
osmo_timer_setup(&link->timer, osmux_link_timer_expired, h);
|
osmo_timer_setup(&link->timer, osmux_link_timer_expired, h);
|
||||||
|
|
||||||
h->internal_data = (void *)link;
|
h->internal_data = (void *)link;
|
||||||
|
|
||||||
LOGP(DLMUX, LOGL_DEBUG, "initialized osmux input converter\n");
|
LOGP(DLMUX, LOGL_DEBUG, "[%s] Initialized osmux input converter\n",
|
||||||
|
link->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
int osmux_xfrm_input_set_batch_factor(struct osmux_in_handle *h, uint8_t batch_factor)
|
int osmux_xfrm_input_set_batch_factor(struct osmux_in_handle *h, uint8_t batch_factor)
|
||||||
|
@ -766,6 +772,12 @@ void *osmux_xfrm_input_get_deliver_cb_data(struct osmux_in_handle *h)
|
||||||
return h->data;
|
return h->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void osmux_xfrm_input_set_name(struct osmux_in_handle *h, const char *name)
|
||||||
|
{
|
||||||
|
struct osmux_link *link = (struct osmux_link *)h->internal_data;
|
||||||
|
osmo_talloc_replace_string(link, &link->name, name);
|
||||||
|
}
|
||||||
|
|
||||||
int osmux_xfrm_input_open_circuit(struct osmux_in_handle *h, int ccid,
|
int osmux_xfrm_input_open_circuit(struct osmux_in_handle *h, int ccid,
|
||||||
int dummy)
|
int dummy)
|
||||||
{
|
{
|
||||||
|
|
|
@ -277,6 +277,7 @@ int main(void)
|
||||||
|
|
||||||
/* Check if marker bit features work correctly */
|
/* Check if marker bit features work correctly */
|
||||||
h_input = osmux_xfrm_input_alloc(tall_ctx);
|
h_input = osmux_xfrm_input_alloc(tall_ctx);
|
||||||
|
osmux_xfrm_input_set_name(h_input, "first");
|
||||||
osmux_xfrm_input_set_initial_seqnum(h_input, 0);
|
osmux_xfrm_input_set_initial_seqnum(h_input, 0);
|
||||||
osmux_xfrm_input_set_batch_factor(h_input, 4);
|
osmux_xfrm_input_set_batch_factor(h_input, 4);
|
||||||
osmux_xfrm_input_set_deliver_cb(h_input, osmux_deliver, NULL);
|
osmux_xfrm_input_set_deliver_cb(h_input, osmux_deliver, NULL);
|
||||||
|
@ -289,6 +290,7 @@ int main(void)
|
||||||
TALLOC_FREE(h_input);
|
TALLOC_FREE(h_input);
|
||||||
|
|
||||||
h_input = osmux_xfrm_input_alloc(tall_ctx);
|
h_input = osmux_xfrm_input_alloc(tall_ctx);
|
||||||
|
osmux_xfrm_input_set_name(h_input, "second");
|
||||||
osmux_xfrm_input_set_initial_seqnum(h_input, 0);
|
osmux_xfrm_input_set_initial_seqnum(h_input, 0);
|
||||||
osmux_xfrm_input_set_batch_factor(h_input, 4);
|
osmux_xfrm_input_set_batch_factor(h_input, 4);
|
||||||
osmux_xfrm_input_set_deliver_cb(h_input, osmux_deliver, NULL);
|
osmux_xfrm_input_set_deliver_cb(h_input, osmux_deliver, NULL);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
DLMUX initialized osmux input converter
|
DLMUX [input-0] Initialized osmux input converter
|
||||||
sys={23.444242}, mono={0.020000}: clock_override_add
|
sys={23.444242}, mono={0.020000}: clock_override_add
|
||||||
sys={23.464242}, mono={0.040000}: clock_override_add
|
sys={23.464242}, mono={0.040000}: clock_override_add
|
||||||
sys={23.484242}, mono={0.060000}: clock_override_add
|
sys={23.484242}, mono={0.060000}: clock_override_add
|
||||||
|
@ -358,7 +358,7 @@ sys={26.704242}, mono={3.280000}: extracted packet: RTP ver=2 ssrc=117440512 typ
|
||||||
sys={26.704242}, mono={3.280000}: extracted packet: RTP ver=2 ssrc=117440512 type=98 marker=0 ext=0 csrc_count=0 sequence=9219 timestamp=1681702537 [20 14 ff d4 f9 ff fb e7 eb f9 9f f8 f2 26 33 65 54 ]
|
sys={26.704242}, mono={3.280000}: extracted packet: RTP ver=2 ssrc=117440512 type=98 marker=0 ext=0 csrc_count=0 sequence=9219 timestamp=1681702537 [20 14 ff d4 f9 ff fb e7 eb f9 9f f8 f2 26 33 65 54 ]
|
||||||
sys={26.704242}, mono={3.280000}: extracted packet: RTP ver=2 ssrc=117440512 type=98 marker=0 ext=0 csrc_count=0 sequence=9220 timestamp=1681702697 [20 14 ff d4 f9 ff fb e7 eb f9 9f f8 f2 26 33 65 54 ]
|
sys={26.704242}, mono={3.280000}: extracted packet: RTP ver=2 ssrc=117440512 type=98 marker=0 ext=0 csrc_count=0 sequence=9220 timestamp=1681702697 [20 14 ff d4 f9 ff fb e7 eb f9 9f f8 f2 26 33 65 54 ]
|
||||||
sys={26.704242}, mono={3.280000}: extracted packet: RTP ver=2 ssrc=117440512 type=98 marker=1 ext=0 csrc_count=0 sequence=9221 timestamp=1681702857 [20 14 ff d4 f9 ff fb e7 eb f9 9f f8 f2 26 33 65 54 ]
|
sys={26.704242}, mono={3.280000}: extracted packet: RTP ver=2 ssrc=117440512 type=98 marker=1 ext=0 csrc_count=0 sequence=9221 timestamp=1681702857 [20 14 ff d4 f9 ff fb e7 eb f9 9f f8 f2 26 33 65 54 ]
|
||||||
DLMUX initialized osmux input converter
|
DLMUX [input-1] Initialized osmux input converter
|
||||||
sys={26.704242}, mono={3.280000}: adding to ccid=1 RTP ver=2 ssrc=118030434 type=98 marker=1 ext=0 csrc_count=0 sequence=16396 timestamp=108399 [20 14 ff d4 f9 ff fb e7 eb f9 9f f8 f2 26 33 65 54 ]
|
sys={26.704242}, mono={3.280000}: adding to ccid=1 RTP ver=2 ssrc=118030434 type=98 marker=1 ext=0 csrc_count=0 sequence=16396 timestamp=108399 [20 14 ff d4 f9 ff fb e7 eb f9 9f f8 f2 26 33 65 54 ]
|
||||||
sys={26.704242}, mono={3.280000}: adding to ccid=0 RTP ver=2 ssrc=118030434 type=98 marker=1 ext=0 csrc_count=0 sequence=16397 timestamp=108399 [20 14 ff d4 f9 ff fb e7 eb f9 9f f8 f2 26 33 65 54 ]
|
sys={26.704242}, mono={3.280000}: adding to ccid=0 RTP ver=2 ssrc=118030434 type=98 marker=1 ext=0 csrc_count=0 sequence=16397 timestamp=108399 [20 14 ff d4 f9 ff fb e7 eb f9 9f f8 f2 26 33 65 54 ]
|
||||||
sys={26.704242}, mono={3.280000}: adding to ccid=1 RTP ver=2 ssrc=118030434 type=98 marker=0 ext=0 csrc_count=0 sequence=16398 timestamp=108399 [20 14 ff d4 f9 ff fb e7 eb f9 9f f8 f2 26 33 65 54 ]
|
sys={26.704242}, mono={3.280000}: adding to ccid=1 RTP ver=2 ssrc=118030434 type=98 marker=0 ext=0 csrc_count=0 sequence=16398 timestamp=108399 [20 14 ff d4 f9 ff fb e7 eb f9 9f f8 f2 26 33 65 54 ]
|
||||||
|
|
Loading…
Reference in New Issue