Commit Graph

137 Commits

Author SHA1 Message Date
Holger Hans Peter Freyther c8fcc5b8d6 debian: Build a new package 2013-05-24 07:45:44 +02:00
Pablo Neira Ayuso 479fba171b add testsuite infrastructure and osmux test
This patch adds the testsuite infrastructure and it populates it
with one test for osmux.

The osmux tests makes sure that:

* We get the same number of RTP messages in the input and the output path.
* The payload of the RTP message is reconstructed correctly.
* The reconstructed timing is correct.
2013-05-24 02:20:50 +02:00
Pablo Neira Ayuso dd34adea7a osmux: remove trailing line break from osmux_snprintf 2013-05-23 20:59:13 +02:00
Pablo Neira Ayuso 92b9a4c6a2 rtp: fix wrong time arithmetics in osmo_rtp_build
rtp.c:154:26: warning: The left operand to '/' is always 0
        frame_diff = (usec_diff / 20000);
                      ~~~~~~~~~ ^
rtp.c:157:43: warning: The left operand to '-' is always 0
                long int frame_diff_excess = frame_diff - 1;
                                             ~~~~~~~~~~ ^
rtp.c:153:39: warning: The right operand to '+' is always 0
        usec_diff = tv_diff.tv_sec * 1000000 + tv_diff.tv_usec;
                                             ^ ~~~~~~~~~~~~~~~
rtp.c:153:29: warning: The left operand to '*' is always 0
        usec_diff = tv_diff.tv_sec * 1000000 + tv_diff.tv_usec;
                    ~~~~~~~~~~~~~~ ^
4 warnings generated.

Reported by Holger Hans Peter Freyther.
2013-05-22 12:21:29 +02:00
Holger Hans Peter Freyther 90d4407b64 debian: Increase the version number to 0.0.2
git-version-gen was printing the version as UNKNOWN, create a new
tag to overcome this.
2013-05-22 11:13:26 +02:00
Holger Hans Peter Freyther c0afa36f1e debian: Increase the version to 0.0.1 2013-05-22 11:06:51 +02:00
Holger Hans Peter Freyther ebfec6efbc debian: Add libortp-dev to the dependencies of this package 2013-05-22 08:32:43 +02:00
Pablo Neira Ayuso 3cf3a732ea osmux: fix warning spotted by clang --analyze
osmux.c:622:20: warning: Value stored to 'osmuxh' during its
      initialization is never read
        struct osmux_hdr *osmuxh = (struct osmux_hdr *)msg->data;
                          ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Reported by Holger Hans Peter Freyther.
2013-05-22 02:06:33 +02:00
Holger Hans Peter Freyther 3eef26fc8a debian: Initial attempt at a debian package for libosmo-netif 2013-05-21 19:05:40 +02:00
Holger Hans Peter Freyther 23d866eff9 misc: Add missing header files to fix the make distcheck 2013-05-21 18:46:28 +02:00
Pablo Neira Ayuso 56c4681d83 osmux: replay last RTP packet seen under packet loss scenario
If osmux notices a gap between two RTP packets, fill it with
the last RTP packet seen. Without this patch, 10% of packet loss
is enough to get garbage, with it we get glitches in the conversation
with 30%, and pretty much broken conversation with 40% of it.
2013-05-21 00:48:13 +02:00
Pablo Neira Ayuso a9ab95c2c4 osmux: use ccid to identify batches instead of the RTP SSRC
This should reduce the amount of batch nodes that are created
by the maximum number of allowed circuit IDs.
2013-05-20 22:37:31 +02:00
Pablo Neira Ayuso a2c7f909ef osmux: add sanity checking to osmux_snprintf
Add sanity checking to avoid crashes on malformed OSMUX packets
2013-05-12 20:44:00 +02:00
Pablo Neira Ayuso 282aee422f osmux: allow to set initial RTP SSRC
Instead of using the osmuxh->circuit_id.
2013-05-12 19:56:21 +02:00
Pablo Neira Ayuso d32caea9ea osmux: add osmux_snprintf
Useful for debugging purposes. Modify also examples to use it.
2013-02-19 17:14:33 +01:00
Pablo Neira Ayuso aeeb4399a2 examples: use DOSMUX_TEST instead of DLINP in logging messages 2013-02-19 17:13:37 +01:00
Pablo Neira Ayuso 1f43121ef0 osmux: osmux-test-input: fix compilation warning
CC     osmux-test-input.o
osmux-test-input.c:85:2: warning: initialization from incompatible pointer type [enabled by default]
osmux-test-input.c:85:2: warning: (near initialization for ‘h_input.deliver’) [enabled by default]
2013-02-19 16:21:09 +01:00
Pablo Neira Ayuso e0ae0d25c0 osmux: RTP payload type for voice is dynamic
Don't make any assumption on the payload type.
2013-02-19 16:14:32 +01:00
Pablo Neira Ayuso 5cbdd8797a osmux: add talloc context
Good for debugging leaks.
2013-02-19 13:18:48 +01:00
Pablo Neira Ayuso 01537a3678 osmux: initialize batch appropriately in osmux_xfrm_input_init
Use talloc_size not talloc. Should fix:

0xb779401a in rb_erase (node=0x200200, root=0xb779c908) at rbtree.c:230
0xb779401a in rb_erase (node=0x200200, root=0xb779c908) at rbtree.c:230
0xb778ee48 in osmo_timer_del (timer=0x94aacd0) at timer.c:110
0xb778ef65 in osmo_timer_add (timer=0x94aacd0) at timer.c:72
0xb778f03c in osmo_timer_schedule (timer=0x94aacd0, seconds=0, microseconds=64000)
0xb77360ff in osmux_xfrm_input (h=0x94a4280, msg=0x94b8a50, ccid=18) at osmux.c:390

Due to uninitialization batch structures.
2013-02-19 13:17:02 +01:00
Pablo Neira Ayuso 5e9c67ea20 fix osmux-test-input
ccid array was not initialized appropriately
2013-02-12 19:53:02 +01:00
Pablo Neira Ayuso 3f00a9b95f fix osmux_test with pcap file 2013-02-12 19:49:57 +01:00
Pablo Neira Ayuso 92601d0a20 osmux: use ft instead of the cmr
The cmr is the requested codec for the other peer, the ft actually
contains the current codec mode. cmr may contain 15 which means
"don't care".
2013-02-12 19:29:42 +01:00
Pablo Neira Ayuso c92810eccd osmux: remove arrays from osmux_out_handle
there will be one osmux_out_handle per endpoint.
2013-02-12 17:24:13 +01:00
Pablo Neira Ayuso 7ff7a5cd6d osmux: allow to pass data to osmux_deliver 2013-02-11 22:49:27 +01:00
Pablo Neira Ayuso 0f1f41411f osmux: fix missing data set in osmux_tx_sched 2012-10-21 04:12:29 +02:00
Pablo Neira Ayuso 4aa540ae27 dgram: add osmo_dgram_get_data 2012-10-21 03:08:37 +02:00
Pablo Neira Ayuso 5654c43f80 osmux: remove generic functions to register and get ccid
Remove these functions:

- osmux_xfrm_input_get_ccid
- osmux_xfrm_input_register_ccid

The ccid will be managed by the BSC and it will be stored in the
mgcp_endpoint structure.

Also adjust all tests and examples using the API.
2012-10-20 20:17:28 +02:00
Pablo Neira Ayuso 631c6fe0ad ipa: fix compilation warning
Shows up with gcc-4.7

ipa.c: In function 'osmo_ipa_rcvmsg_base':
ipa.c:210:6: warning: variable 'ret' set but not used [-Wunused-but-set-variabl
2012-10-15 23:09:36 +02:00
Pablo Neira Ayuso 7f9ebe2e56 osmux: fix DELTA_RTP_MSG
It should be 16000 and add DELTA_RTP_TIMESTAMP which is 160.
2012-10-15 23:09:36 +02:00
Pablo Neira Ayuso 8c9caa8607 osmux: rewrite batching function
Rework batching routine to reduce its complexity, updates:

* Now it uses a list of lists to store the messages that will be
  batched.

batch list
    |
    `-> node SSRC=a ---> ... ---> node SSRC=b
            |                         |
        msg seq=x1               msg seq=y1
            |                         |
        msg seq=x2               msg seq=y2
            |                         |
        msg seq=x3               msg seq=y3
            |                         |
        msg seq=x4               msg seq y4

This keeps easier the creation of the final batch that is sent from that
data structure.

* We also detect duplicate messages in the batch, ie. messages with the
  same sequence are skipped.

Still pending to resolve reordering, corruption and omissions (reliability
is desired).
2012-10-15 23:09:36 +02:00
Pablo Neira Ayuso e472f44dd3 osmux: RTP timestamp has to be bumped in 160
Between two RTP messages that were extracted from a batch, the
timestamp difference should be 160.

Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2012-10-15 23:09:36 +02:00
Pablo Neira Ayuso 4925acf297 examples: add osmux-test-input and osmux-test-output
You can use these utilities to test osmux:

1) in one console, run ./osmux-test-input
   This listens in port UDP 20000 and convert RTP traffic to osmux
   Then, it sends osmux traffic via port UDP 20001
2) in another console, run ./osmux-test-output
   This listens in port UDP 20001 and convert osmux to RTP traffic
   Then, it sends RTP traffic to UDP port 20002
3) in another console run, nc -u nc -u -l -p 20002
   This is the sink, just to avoid ICMP destination unreachable messages

Now you can run replay UDP traffic from one pcap trace that contains
RTP traffic with this tool:

http://1984.lsi.us.es/git/pcap-inject/

Example of command line invocation:

./traffic-inject /home/pablo/rtp-nanobts-2-phones-amr.pcap udp 20000

You can run wireshark in the loopback to make sure osmux is getting back
the traces looking like the original.

The tests also generate output files in AMR that you can validate via
mplayer: /tmp/output.amr and /tmp/input.amr respectively. This is to
make sure there are no reordering or problems of any sort.
2012-10-15 23:07:12 +02:00
Pablo Neira Ayuso 384bdf630a osmux: release of batch message is controled by caller
Instead of internally released. This is required if we use the
osmo_dgram infrastructure, to avoid a double release.

Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2012-10-15 18:14:59 +02:00
Pablo Neira Ayuso 6907ac37e1 osmux: use DLMIB instead of internal defined DOSMUX
Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2012-10-15 15:59:14 +02:00
Pablo Neira Ayuso aa33e591dc ipa: add osmo_ipa_parse_msg_id_resp
Code extracted from ipa_stream_server.c.
2012-08-21 02:28:46 +02:00
Pablo Neira Ayuso 06f49051c6 ipa: add ipa_cli_id_ack and ipa_cli_id_resp
This functions were before located in channel/abis/ipa_stream_client.c,
but they are generic for IPA units.
2012-08-19 20:14:25 +02:00
Pablo Neira Ayuso 169d2783a6 channel: abis: ipa-stream-server: fix crash while closing socket
This fixes the crash while closing socket with/without link with a
valid IPA unit.
2012-08-19 20:14:25 +02:00
Pablo Neira Ayuso 9ae91e594c ipa: add osmo_ipa_process_msg and remove osmo_ipa_recv_msg
This patch removes osmo_ipa_recv_msg, it performs two syscall invocations
and it's stream generic. Now we use the specific receival function
we want to use (no matter if stream or datagram based) and then we
call osmo_ipa_process_msg to check that the IPA message correct.
2012-08-19 20:14:25 +02:00
Pablo Neira Ayuso 7a3e8d01f5 consolidate ipa_unit infrastructure
Provide unified infrastructure for handling IPA units and modify
existing code to use it.
2012-08-19 20:14:17 +02:00
Pablo Neira Ayuso 5abf7f2ea4 stream: add osmo_stream_srv_get_master
To obtain the information of the server data that this connection
belongs to.
2012-08-19 18:35:10 +02:00
Pablo Neira Ayuso 060e46ea6d channel: add abis directory under channel
And move all existing A-bis channel implementation to channel/abis/
directory.

This is just a cleanup to reorganize the source code tree.
2012-08-19 01:06:57 +02:00
Pablo Neira Ayuso 775c1de089 channel: add subtype ID to osmo_chan_create
This adds the possibility to specify the variant of the channel.

This was discussed during the osmocom workshop. Harald wanted a way
to say if the channel is using TCP, UDP, DADHDI and so on.
2012-08-19 00:52:00 +02:00
Pablo Neira Ayuso b71627b1f7 channel: osmo_chan_init takes one pointer to set the talloc context
Also remove this parameter from osmo_chan_create
2012-08-19 00:50:01 +02:00
Pablo Neira Ayuso d73c757e6d channel: rename CHAN_* to OSMO_CHAN_* for correct namespace policy
Just to avoid unlikely possible problems while using this library
with any other that decided to define the CHAN_* constants.
2012-08-19 00:49:58 +02:00
Pablo Neira Ayuso c05485c90c channel: use linked list instead of array of existing channels
This also adds osmo_chan_init() that needs to initialize the
channel infrastructure.
2012-08-19 00:49:20 +02:00
Pablo Neira Ayuso 557e5c127a channel: define CHAN_SIGN_OML and CHAN_SIGN_RSL internally
These definitionsare not relevant for external client applications
using the library.
2012-08-19 00:12:18 +02:00
Pablo Neira Ayuso a7c1784937 channel: remove leftover unused definitions in header
They are not used anywhere in the code.
2012-08-19 00:10:37 +02:00
Pablo Neira Ayuso d092d6d4e8 channel: add name field
This will be useful to display some human-readable type in logs
and the VTY.
2012-08-18 23:58:28 +02:00
Pablo Neira Ayuso 487734e6d3 channel: abis-ipa-client: add missing header file
I forgot to commit this file:

osmocom/netif/channel/abis_ipa_client.h
2012-08-18 23:52:55 +02:00