aboutsummaryrefslogtreecommitdiffstats
path: root/examples
AgeCommit message (Collapse)AuthorFilesLines
2019-02-20Stream client: add disconnect callbackMax2-0/+16
It's similar to connect_cb() but called once client has been disconnected. Change-Id: I905adb2d6191216551a3bcdcd1aec1f96f01612a
2019-02-06Stream examples: fix typos in error messageMax1-2/+2
Likely a copy-paste error from corresponding client example code. Change-Id: I47cc8c7340eb188d85a49d4f41c295bed0e1bee4
2019-02-05Add socket name functions to stream client/serverMax2-2/+2
Add functions to get the description of a server link or client connection which examine data on corresponding socket. Those functions use static buffers and intended for single use in log/printf statements as illustarted by corresponding example changes. Change-Id: If9a8e211da85956781479862a63c4fc6e53ed6be
2019-02-05Stream examples: print accepted client addressMax1-0/+6
Display socket information for accepted client. Change-Id: I5aa6757be79754cf7ffa4a276dae1cfb80fe904e
2019-01-29Stream examples: fix server's endless loopMax1-3/+6
Stream server example had an error which resulted in infinite loop on client disconnect. Fix this by properly handling client closing connection to allow it to reconnect multiple times. Change-Id: Icfc2cf7f971b9e3a4abc34cc18d8a44c811c5617
2019-01-29Stream examples: log sent/received bytesMax2-10/+23
Make client and server examples more verbose by logging actual bytes sent/received. Change-Id: I6979b2f92c96c2366f18bf31e4bc495a6709133a
2019-01-29Stream examples: filter internal loggingMax2-0/+2
Set category filter to make sure internal library logging won't interfere with example's own logging. It's also nice example illustrating log_set_category_filter() usage. Change-Id: I17d7878d302f011d8ff0d86708d677f5b559299e
2018-08-01Migrate from osmo_ipa_idtag_parse() to ipa_ccm_id_resp_parse()Harald Welte1-2/+2
In libosmocore Change-ID I1834d90fbcdbfcb05f5b8cfe39bfe9543737ef8f we have introduced ipa_ccm_id_resp_parse() as a bugfixed replacement of ipa_ccm_idtag_parse(). The main difference is that the returned "value" parts now have a correct reported "length", whereas before this commit they all reported a one-byte too-long "length" for each IE. Let's use this opportunity to remove the copy+pasted osmo_ipa_idtag_parse() function from the libosmo-netif codebase. Change-Id: I4626d247626543e032593bf226b6c233f6678562
2018-06-29remove "channel" layerHarald Welte4-187/+0
The "channel" layer on top of IPA client + server was introduced in 2011 but never used in any osmocom program/project so far. Contrary to the several other IPA multiplex related implementations in libosmo*, it did not deal properly with segmented IPA messages, i.e. where a single TCP segment (and hence recv/read call) does not contain a full IPA message. So rather than fixing it up and having yet another IPA related API in our libraries, let's remove it. Change-Id: I97c378750acb1637ee032fa88a968edf68d8979f
2018-04-19osmux: Move examples and tests to use new output APIsPau Espin Pedrol1-6/+4
Change-Id: Ie69c427308eb7d81aedab7fbb71f1bdaf43f0275
2018-04-17examples: use osmo_init_logging2Pau Espin Pedrol15-30/+30
Change-Id: I7f1f4503f254931edeebfbadf3953efa7b20f85f
2017-10-13examples: add simple UDP client/serverMax4-0/+225
In addition to showing basic UDP send/receive example, it helps to test corner-case when dealing with 0-length UDP packets. Change-Id: I08c0adf1cf9b6a6f1f7090b237d0497c2ec13cdf Related: OS#2219
2016-12-01examples/stream-server.c: use read() rc instead of strlen()Neels Hofmeyr1-2/+4
Fixes: CID#57922 Change-Id: Ibaafdd49d9446a12fe7d0e2f5b2039da3ffc7ea9
2016-12-01ipa-stream-{client,server}: Add missing #include <sys/socket.h>Harald Welte2-0/+2
This lead to compiler warnings on FreeBSD, as setsockopt() is undefined. Change-Id: Ie0ee3e48adfd0cd252703ec020cef28cf76ca223
2016-12-01stream-client: check read() return value before using it as length input to ↵Harald Welte1-1/+2
memcpy Change-Id: Id962821c71b3a1c4c01c1131eb809b8ec8eaa062 Fixes: Coverity CID 57859
2016-12-01stream-client: Check for osmo_fd_register() return valueHarald Welte1-1/+6
Change-Id: I1b5fa97d14e69ff502b6deba0fd898a01e53420f Fixes: Coverity CID 57633
2016-12-01rs232-write: Check return value of osmo_fd_register()Harald Welte1-1/+6
Change-Id: If40e85600ca1dfbda5975d7aa92cccdb11f9c34d Fixes: Coverity CID 57632
2016-11-11examples/lapd-over-datagram-network: Fix compiler warningHarald Welte1-1/+1
lapd-over-datagram-network.c:38:12: warning: ‘sapi’ defined but not used [-Wunused-variable] static int sapi = 63, tei = 0; ^~~~ Change-Id: If367deb0e0d7d5e031db2bd905179263d18703f0
2016-01-23Do not use strlen on binary inpitHolger Hans Peter Freyther1-1/+1
Coverity points out that buf might not be NULL terminated. For the memcpy ret was already used, so use ret for msgb_put as well. Fixes: CID#57922
2015-11-07teip is a pointer, not an intAlexander Huemer1-2/+2
2015-03-22endian: Use the new endian macros for portabilityHolger Hans Peter Freyther1-2/+3
Use the new macros to deal with little/big endian. Im a bit worried to make this change due the little test coverage in this module but in case of a typo the elements would not be defined.
2015-02-25Fix the compilation on FreeBSD.Nikola Kolev2-0/+4
2014-10-02build: remove all_includesJan Engelhardt2-2/+2
This variable is never set and could therefore be removed.
2014-09-11build: rename INCLUDES to AM_CPPFLAGS in Makefile.am to avoid warningsMartin Hauke2-2/+2
2013-05-12osmux: allow to set initial RTP SSRCPablo Neira Ayuso1-1/+1
Instead of using the osmuxh->circuit_id.
2013-02-19osmux: add osmux_snprintfPablo Neira Ayuso2-6/+15
Useful for debugging purposes. Modify also examples to use it.
2013-02-19examples: use DOSMUX_TEST instead of DLINP in logging messagesPablo Neira Ayuso2-4/+4
2013-02-19osmux: osmux-test-input: fix compilation warningPablo Neira Ayuso1-1/+1
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-12fix osmux-test-inputPablo Neira Ayuso1-1/+1
ccid array was not initialized appropriately
2012-10-20osmux: remove generic functions to register and get ccidPablo Neira Ayuso1-5/+46
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-15examples: add osmux-test-input and osmux-test-outputPablo Neira Ayuso3-1/+395
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-08-19ipa: add osmo_ipa_process_msg and remove osmo_ipa_recv_msgPablo Neira Ayuso2-4/+12
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-19consolidate ipa_unit infrastructurePablo Neira Ayuso1-2/+2
Provide unified infrastructure for handling IPA units and modify existing code to use it.
2012-08-19channel: add abis directory under channelPablo Neira Ayuso3-8/+8
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-19channel: add subtype ID to osmo_chan_createPablo Neira Ayuso2-2/+2
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-19channel: osmo_chan_init takes one pointer to set the talloc contextPablo Neira Ayuso2-4/+4
Also remove this parameter from osmo_chan_create
2012-08-19channel: rename CHAN_* to OSMO_CHAN_* for correct namespace policyPablo Neira Ayuso2-2/+2
Just to avoid unlikely possible problems while using this library with any other that decided to define the CHAN_* constants.
2012-08-19channel: use linked list instead of array of existing channelsPablo Neira Ayuso2-0/+6
This also adds osmo_chan_init() that needs to initialize the channel infrastructure.
2012-08-16add ABIS IPA example as client (BTS)Pablo Neira Ayuso2-1/+95
2012-08-15channel: abis-ipa: shorter function namesPablo Neira Ayuso1-3/+3
%s/_server_/_srv_/g %s/osmo_chan_abis/osmo_abis/g %s/SERVER/SRV/g
2012-08-15src: shorter stream function namesPablo Neira Ayuso4-82/+82
%s/_client_conn_/_cli_/g %s/_server_conn_/_srv_/g %s/_client_/cli/g %s/server/srv/g %s/RECONFIG/RECONF/g %s/SERVER/SRV/g %s/CLIENT/CLI/g
2012-08-15src: shorter names for datagram socketsPablo Neira Ayuso4-49/+49
%s/_conn_/_/g %s/_conn//g %s/_server_/_tx_/g %s/_client_/_rx_/g %s/_SERVER_/_TX_/g %s/_CLIENT_/_RX_/g %s/_RECONFIG/_RECONF/g
2012-07-07rtp: split osmo_rtp_parse in two functionsPablo Neira Ayuso2-10/+11
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-03rtp: remove unused rtp_handle parameter from osmo_rtp_parsePablo Neira Ayuso2-2/+2
And also adjust example files to use the new function. Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2012-04-04add rs232 supportPablo Neira Ayuso3-0/+486
This include an example to open /dev/ttyACM0 to receive data from u-blox GPS and one to configure it in TIMEPULSE2 mode.
2012-02-23examples: Display more details on RTP payload in rtp-udp-test-*Pablo Neira Ayuso2-6/+6
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-23add RTP supportPablo Neira Ayuso3-1/+299
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>
2011-11-08src: add generic channel infrastructure and A-bis IPA server supportPablo Neira Ayuso3-0/+87
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-10-17examples: disable Nagle in ipa-stream-*.cPablo Neira Ayuso2-0/+21
To emulate how openBSC behaves.
2011-10-17ipa: initial addition of helper functions and examplesPablo Neira Ayuso3-1/+317
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.