Commit Graph

63 Commits

Author SHA1 Message Date
Pablo Neira Ayuso fe9fccd412 osmux: cleanup tx path
This patch cleans up the transmission path for osmux, this involves
the functions that extract the messages from the batch and the one
that reconstruct the timing.

They now take a list that contains the reconstructed RTP messages:

 osmux_xfrm_output(osmuxh, &h_output, &list);
 osmux_tx_sched(&list, &tv, tx_cb, NULL);
2012-08-04 19:59:33 +02:00
Pablo Neira Ayuso fdc6538986 fix wrong delta between two RTP messages
it should 20 ms, not 160 ms. Thanks for Holger for spotting this.
2012-08-04 18:39:45 +02:00
Pablo Neira Ayuso ffd20f3f1c 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 20:36:19 +02:00
Pablo Neira Ayuso b03de23120 tests: osmux: initialize input handler before first run
Make sure we don't segfault due to uninitiliazed handler.
2012-08-02 20:35:31 +02:00
Pablo Neira Ayuso 5e8fab1419 tests: osmo-pcap: callback control the release of the emulated packet
The callback is now in charge of releasing the packet.
2012-08-02 20:34:04 +02:00
Pablo Neira Ayuso 969db946d4 osmux: osmux_get_payload returns uint8_t * instead void *
So we easily add offsets without any casting.
2012-08-02 20:25:36 +02:00
Pablo Neira Ayuso 52c7649e23 osmux: fix wrong maximum batch size
Missing UDP header in calculation.
2012-08-02 20:24:31 +02:00
Pablo Neira Ayuso 4aa55450a3 tests: osmo-pcap: cleanup for osmux test receiver loop 2012-08-02 17:39:02 +02:00
Pablo Neira Ayuso 8a8c47aaba osmux: use logging infrastructure
so far, printf was used instead.
2012-07-19 13:04:39 +02:00
Pablo Neira Ayuso 937ab515cb tests: osmo-pcap: use logging infrastructure
so far, it was missing and printf was used instead of the generic
logging infrastructure that osmocom provides.
2012-07-19 13:03:39 +02:00
Pablo Neira Ayuso 0db9b568f2 osmux: add DEBUG_TIMING to make sure timing reconstruction is OK
by now, it is set on by default.
2012-07-19 12:53:04 +02:00
Pablo Neira Ayuso 6071c652cf osmux: always use osmux_tx_cb in osmux_tx_sched
This is required by the follow-up patch to debug timing issues.
2012-07-19 12:49:55 +02:00
Pablo Neira Ayuso 004d5aad0e tests: osmo-pcap: split packet replay from osmux_test code
This patch splits in two files the code that contains the packet replay
based on PCAP from the osmux test.
2012-07-19 12:21:25 +02:00
Pablo Neira Ayuso 413513a704 tests: osmo-pcap: adapt it to use new osmux_tx_sched
Adapt the test to use the function that allows reconstructing the
RTP timing sequence.
2012-07-19 11:43:08 +02:00
Pablo Neira Ayuso 8ba490fd96 osmux: add osmux_tx_sched to reconstruct the timing of RTP messages
This function schedules the transmission of a RTP message that was
obtained from one osmux batch. It takes the time (in microseconds)
after which the message should be transmitted.
2012-07-19 11:38:50 +02:00
Pablo Neira Ayuso d3c21b3cad osmux: use osmo_amr_bytes instead of hardcoded 15 bytes for CMR 2
I was using AMR CMR 2 (15 bytes) as the initial tests were done
with the codec variant.

This patch fixes this by using the new generic osmo_amr_bytes
extracted from 3GPP TS 26.101.
2012-07-13 21:17:51 +02:00
Pablo Neira Ayuso 42915068af src: add function to obtain bytes depending on AMR frame code 2012-07-13 21:12:32 +02:00
Pablo Neira Ayuso 51d408acee tests: osmo-pcap: test osmux functions 2012-07-12 13:03:56 +02:00
Pablo Neira Ayuso 00b6026f64 add osmux support 2012-07-12 13:03:07 +02:00
Pablo Neira Ayuso e53d2ed172 osmo-pcap-test: add -g compilation for debugging (valgrind) and use -losmonetif 2012-07-12 13:01:33 +02:00
Pablo Neira Ayuso efaae10304 rtp: add new parameter to osmo_rtp_get_payload to obtain payload length 2012-07-12 13:01:28 +02:00
Pablo Neira Ayuso c6dceb8cf7 amr: add osmo_amr_get_payload 2012-07-12 13:01:25 +02:00
Pablo Neira Ayuso 93b16cb871 rtp: add RTP_PT_RTCP (72-76 for RTCP)
As specified by RFC 3551, these are reserved to distinguish
RCTP from RTP.
2012-07-09 16:58:46 +02:00
Pablo Neira Ayuso 67b988a077 rtp: add missing RTP_PT_AMR for AMR-WB (type 98) and RTP_PT_GSM_HALF (96) 2012-07-09 16:58:12 +02:00
Pablo Neira Ayuso a359315c8b include: add AMR definitions in amr.h header
As defined by RFC3267 in Octed-Aligned mode.
2012-07-07 17:43:14 +02:00
Pablo Neira Ayuso e142ddfd77 rtp: split osmo_rtp_parse in two functions
This patch splits osmo_rtp_parse in two functions:

osmo_rtp_get_hdr
osmo_rtp_get_payload

So we can validate corrent RTP header to access its fields. Then,
obtain the payload.
2012-07-07 17:40:17 +02:00
Pablo Neira Ayuso d2de668547 tests: osmo-pcap: fix bad UDP header calculation
Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2012-07-04 10:21:50 +02:00
Pablo Neira Ayuso f52b3c8b11 rtp: remove unused rtp_handle parameter from osmo_rtp_parse
And also adjust example files to use the new function.

Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2012-07-03 20:03:01 +02:00
Pablo Neira Ayuso f04b5f66f3 rtp: move RTP header definitions to include rtp.h
Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2012-07-03 18:44:32 +02:00
Pablo Neira Ayuso 435f7a7dfe add .gitignore
Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2012-06-28 18:57:53 +02:00
Pablo Neira Ayuso 75755dd7d9 test: add osmo-pcap-test infrastructure
This patch adds the osmo-pcap-test infrastructure that allows you
to take packets stored in one pcap file, convert them to msgb and
pass it to some function.

The infrastructure also provides timing reconstruction based on
the pcap file information.

This is useful for easy protocol development, automated testing and
fuzzying of the existing code to validate the code.

Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2012-06-28 16:42:22 +02:00
Pablo Neira Ayuso 729a0917ac add rs232 support
This include an example to open /dev/ttyACM0 to receive data from
u-blox GPS and one to configure it in TIMEPULSE2 mode.
2012-04-04 19:08:27 +02:00
Pablo Neira Ayuso 163707ba12 build: use libosmo-netif.pc instead libosmonetif.pc
Otherwise, openbsc fails to find this new library by libosmo-netif.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2012-02-23 19:51:01 +01:00
Pablo Neira Ayuso bc4208095d build: fix wrong name for linking options
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2012-02-23 19:50:56 +01:00
Pablo Neira Ayuso 4cd6689587 examples: Display more details on RTP payload in rtp-udp-test-*
Minor change, more verbose output to make sure the functions in
the library are doing OK.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2012-02-23 19:50:54 +01:00
Pablo Neira Ayuso 59b4f79946 datagram: minor cleanup
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2012-02-23 19:50:47 +01:00
Pablo Neira Ayuso 72cd95b352 add RTP support
This patch adds the initial RTP support for libosmo-netif, it's based
on Harald's RTP support available in openBSC.

I have also added a couple of example to show how our new channel
infrastructure interacts with the RTP layer.

Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2012-02-23 13:44:26 +01:00
Pablo Neira Ayuso 2b5d3ce7c6 src: add generic channel infrastructure and A-bis IPA server support
This patch adds the generic channel infrastructure that allows to
create channel of different types. Each channel has their own
configuration functions.

  struct osmo_chan *chan;
  chan = osmo_chan_create(tall_example, CHAN_ABIS_IPA_SERVER);
  ...

  /* specific configuration functions per supported channel. */
  osmo_chan_abis_ipa_server_set_cb_signalmsg(chan, signal_msg_cb);
  osmo_chan_abis_ipa_unit_add(chan, 1801, 0);

  /* open channel. */
  osmo_chan_open(chan);

The input path requires a callback to be registered. The output path
is handled through:

  int osmo_chan_enqueue(struct osmo_chan *c, struct msgb *msg);

The msg->dst must be set (it can be taken from the original message
to route one reply).

This patch also adds A-bis IPA server support. It has been tested with
e1inp_ipa_bsc_test available in libosmo-abis.
2011-11-08 11:17:44 +01:00
Pablo Neira Ayuso ffe3cb3ef9 ipa: don't release message in osmo_ipa_msg_recv
The client of this code must control message freeing it self.
2011-11-08 11:17:44 +01:00
Pablo Neira Ayuso e57c7e1e3f stream: don't destroy server connection on error
This patch includes a minor fix. We don't destroy connection on
errors, it should be the caller which must control this.
2011-11-08 11:17:38 +01:00
Pablo Neira Ayuso d3ba14648c stream: allow to set reconnect timeout
This patch allows to set reconnect timeout. If zero, it will try
immediately. If negative, it will skip retrying.
2011-11-08 11:13:22 +01:00
Pablo Neira Ayuso e1a7ede826 examples: disable Nagle in ipa-stream-*.c
To emulate how openBSC behaves.
2011-10-17 23:02:39 +02:00
Pablo Neira Ayuso 20c660caec ipa: initial addition of helper functions and examples
This patch adds IPA helper function that can be use on top of stream
sockets.

The current API is just a copy and paste from libosmo-abis, it will
change in follow up patches to improve it.
2011-10-17 22:12:42 +02:00
Pablo Neira Ayuso 1434e40951 stream: add osmo_stream_*_conn_get_ofd(...) functions
To obtain the file description.
2011-10-17 22:12:37 +02:00
Pablo Neira Ayuso 96dbb24b50 stream: reconfiguration is only required if address and port change
No need to force reconfiguration if any of the callback or data
pointers are changed.
2011-10-17 12:52:39 +02:00
Pablo Neira Ayuso 98ec00d8d2 stream: add osmo_stream_*_conn_recv
Like c43bb08906 but for stream
sockets.
2011-10-17 12:51:18 +02:00
Pablo Neira Ayuso c43bb08906 datagram: add osmo_dgram_conn_recv
We provide osmo_dgram_conn_recv(...) which allows you to take control
on the message allocation and receival process. Instead of hiding this
details inside the datagram infrastructure.

Providing more control to clients of this code means more flexibility.
2011-10-17 12:34:40 +02:00
Pablo Neira Ayuso 60eb983964 stream: use debug loglevel instead of notice for spamming debug message 2011-10-17 12:10:30 +02:00
Pablo Neira Ayuso 4b83212dfb datagram: reconfiguration is only required if address and port change
We allow to change the callback and data pointers in runtime safely
without the need to reconfig.
2011-10-17 12:09:29 +02:00
Pablo Neira Ayuso 6c3c279489 examples: update LAPD over datagram tests
Now they can be used to generate a number of messages from the
user and to measure the RTT of LAPD over datagram messages.

Still, they need to be expanded to take the origin and remote
IPs as argument from the command line, later.
2011-10-14 21:03:52 +02:00