aboutsummaryrefslogtreecommitdiffstats
path: root/examples
AgeCommit message (Collapse)AuthorFilesLines
5 daysstream_{cli,srv}: Add 'res' param to read_cb2HEADpespin/streammasterPau Espin Pedrol4-4/+35
Notify user about read errors, similar to what is supported in the earlier ofd cb backend of osmo_stream_cli/srv: https://osmocom.org/issues/6405#note-15 Related: OS#6405 Fixes: 5fec34a9f20c3b8769373d1b28ae2062e5e2bdd6 Fixes: 0245cf5e07855abea72693272c55b50b5a93aff4 Change-Id: I395c75ff1e9904757ce1d767a9ac2f779593c4c8
7 daysexamples/ipa-stream-client: Fix memleaks in read_cb()Pau Espin Pedrol1-3/+5
Change-Id: I86fc159d928fc7ebce2f771670c5a198c52f5fc0
2024-03-07stream_{client,server} example: Cleanup on exitAndreas Eversberg2-4/+21
In order to detect memory leaks while debugging, stream server/client and keyboard is closed on exit. Related: OS#5753 Change-Id: I9dbb7f46b2a798e88ad4df8ff73c6ee40c07b843
2024-02-29stream_{cli,srv}: Fix memory leak, if sending a message failsAndreas Eversberg2-3/+3
Also the example client/server must not access msgb after sending it, especially if the msgb got freed due to a failure. Change-Id: I627a71b4f0183cd83835c328a5cdd67a413ae614
2024-02-28examples/stream-{server,client}: Generate talloc report on SIGUSR1Harald Welte2-0/+22
This can help with memleak debugging. Change-Id: Ia16632602b937db88e2da2b053192887bdb8a986
2024-02-28examples/stream-*: Add options, to set local/remote peerAndreas Eversberg2-7/+14
This helps to test connections via a network and failing connections. The client may add "-r <peer>" to the command line, to set the address of the remote peer. The server may add "-l <peer>" to the command line, to select address of local peer. By default "127.0.0.1" is used. Change-Id: Ie6da55ef248436e521c5d8f21f8053356c46a114
2024-02-28examples/stream-*: Support SCTP when called with "-s" argumentHarald Welte2-5/+35
Change-Id: I4137cdf1e21cb669b632fe5c126ec27475d98400
2023-10-09stream: Add and use helper function osmo_ipa_push_headers()arehbein2-6/+2
Related OS#5753, OS#5751 Change-Id: I61e1fe59166c46595efe8c1f32b8f2607cb6c529
2023-10-02stream: Add client-side (segmentation) support for IPAarehbein2-3/+8
With this commit, IPA segmentation is taken care of by setting the segmentation callback provided by libosmo-netif. The ipa-stream-server example needs to prepend IPA headers now because those are stripped by the segm. cb on both sides. Depends: libosmocore.git I3a639e6896cc3b3fc8e9b2e1a58254710efa0d3f Related: OS#5753, OS#5751 Change-Id: I822abf52c6ae396c90b5c50228a0a39c848d3de6
2023-08-25stream: Add server-side (segmentation) support for IPAarehbein1-6/+1
With this commit, IPA segmentation can be taken care of by setting the segmentation callback osmo_ipa_segmentation_cb(). Depends: libosmocore.git I3a639e6896cc3b3fc8e9b2e1a58254710efa0d3f Related: OS#5753, OS#5751 Change-Id: I6c91ff385cb5f36ab6b6c96d0e44997995d0d24c
2023-08-07examples: Add extension header octet to examplearehbein1-2/+3
Mainly to make data/packets look (pseudo-)correct in Wireshark. Also: Add helper for allocating message buffers with extended headroom for IPA. Change-Id: I962b9edcba65cdc98da00d2f8753dc5acd481502
2023-06-20stream: Drop name param from recently added API osmo_stream_srv_create2()Pau Espin Pedrol2-2/+4
It was later decided that since setting a name is not really required, it is best to leave it out of the create() function and let the user use the osmo_stream_srv_set_name() API if needed (otherwise a dynamic name based on socket is selected) Change-Id: I5d677ef57b7db0aedd8c43282568c845097cb12b
2023-06-20stream: Drop recently added API osmo_stream_cli_create2Pau Espin Pedrol2-2/+4
It was later decided that since setting a name is not really required, it is best to leave it out of the create() function and let the user use the osmo_stream_cli_set_name() API if needed (otherwise a dynamic name based on socket is selected). Change-Id: I2a2fad318ef22c2ac117f95588a078ca3beccea5
2023-06-16examples: Set logging level to DEBUG in {,ipa-}stream-{client,server}Daniel Willmann4-6/+4
Change-Id: I8c37bbe3db9823a399773d6790000ba508e79377
2023-06-14examples: Use new stream API in {ipa-,}stream-{client,server}Daniel Willmann4-75/+20
Change-Id: I97a9979199c816686b32080534627f6f033e009e
2023-05-31ipa-stream-server: Return -EBADF in read_cb after osmo_stream_srv_destroy()Daniel Willmann1-1/+2
This fixes a potential heap-use-after-free error. When there is still data to be written the osmo_stream_srv_cb() will call osmo_stream_srv_write() which will try to dereference conn even though it has already been freed. Change-Id: I5ac1920b8d4ce3b0205f00d253e7ed878fb745e3
2022-10-03osmux: Replace deprecated osmux_xfrm_input_* APIs in examples & testsPau Espin Pedrol1-8/+7
Change-Id: I7f3f8d40f89ffdd135a73316ee60fd429ba2a5b0
2022-09-02osmux: Allocate struct osmux_out_handle through APIPau Espin Pedrol1-5/+7
Until now, the osmux_out_handle was allocated by the client, and passed to the API to initialize it. This makes it really hard to improve the implementation without breaking the ABI. Let's break the ABI now one last time (hopefully) by allocating the struct through an API. With only this change, the already built users (osmo-mgw, openbsc) can still work fine, since there's no change on the struct osmux_out_handle. However, they will somehow break next time the struct is changed until they are ported to the same API (easy to do). Related: OS#5987 Change-Id: Ie8df581f375c9a183a7af60b431561bda82f6e34
2022-08-31examples/osmux-test-output: Avoid using deprecated Osmux APIPau Espin Pedrol1-1/+1
Change-Id: I408bfc84b9c1740df946fa29191f0e286f5b46e1
2021-02-11Don't depend on libosmo-abis (by default)Harald Welte1-2/+3
The only reason we have a libosmo-netif -> libosmo-abis dependency is the lapd examples whihc are built but not even installed. Let's build those only if --enable-lapd-examples is specified at the command line, and remove the dependency to libosmo-abis in all other cases. Change-Id: Ida8157cd9111b196e4bf08782c45d0e3d393f1c9 Closes: OS#4726
2020-10-18Use osmo_fd_setup() wherever applicableHarald Welte3-12/+3
Change-Id: Ifb90e00036cc51ef02f3cf4dda1ff7dcd1f8a5b5
2020-10-14examples: Use osmo_stream_*_set_nodelay in ipa examplesDaniel Willmann2-18/+2
We have functions to help with/abstract the nodelay settings so use those. Change-Id: Icb143c6e5fc3063f942a744deb576865674a4c62
2020-05-09Use OSMO_FD_* instead of deprecated BSC_FD_*Pau Espin Pedrol3-3/+3
New define is available since libosmocore 1.1.0, and we already require 1.3.0, so no need to update dependenices. Let's change it to avoid people re-using old BSC_FD_* symbols when copy-pasting somewhere else. Change-Id: I269690c1c9e4d19b5b69eef206b95e71f7931188
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