aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
40 hoursstream_{cli,srv}: Add 'res' param to read_cb2HEADpespin/streammasterPau Espin Pedrol8-56/+158
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
40 hourstests/stream: Fix missing msgb_free()Pau Espin Pedrol1-4/+10
Rework a bit the function to early free the rx msg when it is no longer needed. Change-Id: I7e7579175aa6a7c1c22eb3bc147a67f6f62ad6bc
3 daysstream: Define types for each API callbackPau Espin Pedrol3-33/+50
The amount and complexity of callbacks is increasing over time. Use typedefs to define each of them so that callbacks: - Are easier to identify (which types is used where) - Are easier to document (have a 1st class place to write doxygen documentation) Change-Id: Ib0c4a9713fa4c755e457b8c2cbde6a7724d36e28
3 daysstream_cli: Remove unused write_cb fieldPau Espin Pedrol1-1/+0
Change-Id: I50bee754d01d8de01f4a25c14abf90275a1ac78e
3 daysexamples/ipa-stream-client: Fix memleaks in read_cb()Pau Espin Pedrol1-3/+5
Change-Id: I86fc159d928fc7ebce2f771670c5a198c52f5fc0
2024-03-22stream_cli.c: Handle read / recvfrom error and close connectionAndreas Eversberg1-3/+11
If read or recvfrom fails or returns 0, the connection must be closed. This is already done when a write / send fails. In both cases the disconnect callback is called to notify the user's client. Not handling the error may cause an infinite loop of read or recvfrom failures. Related: OS#6405 Change-Id: I55426de6b49cb4cb0797e50dfeae11f2efc29b15
2024-03-19docs: Improve/clean-up doxygen for datagram.[ch]Harald Welte2-10/+18
* make sure datagram.h is part of the group * don't expose private #defines from C files to API documentation Change-Id: I64a9ee3306bcc01ba785da476aea581ce31150bd
2024-03-19docs: various osmux API documentation updatesHarald Welte4-40/+42
Let's make sure * only exported / user-relevant #defines appear in the manual * deprecated functions are marked in a way doxygen can mark them * descriptive comments are using doxygen syntax Change-Id: I5af0133322ddd5345a13380f1c007474c0bea117
2024-03-17introduce osmo_stream_cli_get_iofd() APIHarald Welte3-0/+25
Using this, a user can obtain the osmo_io_fd, for example in order to perform configuration like osmo_iofd_set_alloc_info() or osmo_iofd_set_txqueue_max_length(). Change-Id: Ie19c8294ddb12dfe5e0fd44e047c47e6f9cbd384
2024-03-16Makefile.am: Remove $(SOURCES) which is not defined anywhereHarald Welte1-1/+1
Change-Id: I44ce77c937fa461445800bab393025f948077d55
2024-03-15docs: jibuf: Prevent internal #defines being documentedHarald Welte1-4/+5
Change-Id: Ic3c6e32acb52595875de89f6054a62d9565747f9
2024-03-15docs: Split Stream Server and Stream Client into separate groupsHarald Welte5-104/+98
This provides us with proper logical separation between client and server in the documentation. Change-Id: I9e037fedaecb78396f435577b1652284b4951ded
2024-03-15docs: Don't export internal structs declared in src filesHarald Welte1-1/+1
Change-Id: I5db8ce90c1e1e393195c9a146ba617ab980a9390
2024-03-15docs: More verbose stream_{cli,srv} API documentation/manualHarald Welte2-88/+231
Change-Id: Iae3c3af6533be408e5755ceeda0067606a3b0ca1
2024-03-15Ensure osmo_stream_{cli,srv}_recv() is used only in osmo_fd modeHarald Welte2-0/+2
The osmo_stream_{cli,srv}_recv() is only for osmo_fd mode users; in case osmo_io mode is used, the read_cb is called with pre-filled message buffers; no need to recv/read directly anymore. Change-Id: Ie96cf1241b2ba4e0a7dda584182d18cad2b4f061
2024-03-15docs: Don't export documentation about static (internal) functionsHarald Welte1-1/+1
The generated API documentation should be relevant to the API user, and hence only non-static/public functions are relevant Change-Id: I6fee052ad22877db85fe3207c7eac950d875873b
2024-03-15docs: Use \defgroup and avoid repeated boilerplate textHarald Welte4-17/+11
Change-Id: I1196c3b035f495c5dbaa4d47ce3f79a08d0727f2
2024-03-15docs: Enable AUTOBRIEF feauture in doxygenHarald Welte1-2/+2
We have that enabled in libosmcore.git for ages, somehow we missed it here, resulting in missing 'brief' descriptions in the output. Change-Id: I751036baa9a2b30d94a2a302c7072a5487d2c26e
2024-03-15Makefile.am: Fix dependency: rebuild doxygen on src/include changesHarald Welte1-1/+1
Change-Id: Id28f0927d01f82ceb969fb7c758cb391b86631c1
2024-03-13stream_srv: Fix retrieve of srv_link sockname for AF_UNIX socketsPau Espin Pedrol1-21/+49
Change-Id: Idd76ee3b5c9ad503eabd29d676a5d84e34d92071
2024-03-13prim: Introduce osmo_prim_srv{_link}_set_name APIsPau Espin Pedrol3-1/+14
This allows a user setting a name on the underlaying stream which in turns allows easily identifying the socket. Change-Id: Iba683e4d65e0aba81e13bdf1b9d5a9065b1fc89c
2024-03-13stream: Add osmo_stream_*_get_name() APIsPau Espin Pedrol4-0/+31
This allows users to retrieve a previously set name. Change-Id: If5054d3c207f8f5d58a448f1e58266ad9c4386dd
2024-03-12osmo_stream_cli_send(): Drop data if client is not connected [yet]Harald Welte1-0/+8
The behaviour is undefined on what should happen if a stream client user is trying to write data before the client socket is connected. In osmo_io mode we would actually crash due to a NULL-pointer dereference. Let's discard any sent data in this situation and print a related error log message. This problem actually shows up with osmo-bsc Change-Id Icce412e6ee69366c7b131c9bc1d51e8d44204917 where we convert CBSP over to osmo_io - here in situations where a CBSP client (using stream_cli) was previously connected but has lost its connection. Change-Id: I18d2e8e850c23a32f5983a715fa8a18747b296cd
2024-03-12osmo_prim_srv_send: assert prim_srv is not NULLPau Espin Pedrol1-0/+2
Related: SYS#6826 Change-Id: I1122a1de2c29ee46cce22cec907576719e9c3721
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-03-07stream_cli: Correctly setup and free osmo_io client instanceAndreas Eversberg1-2/+6
Free osmo_io instance when calling osmo_stream_cli_close(). Also free osmo_io instance when calling osmo_stream_cli_open() if not freed, to prevent memory leaks. osmo_iofd_notify_connected() must be called before any registration of read or write, because osmo_io_iouring does not allow this. Change-Id: I91a6a76b9ff96034a7b333edf87af27490202932
2024-03-05osmo_stream_cli_write(): fix double-free of msgbVadim Yanitskiy1-0/+1
Change-Id: I954678acd90593e5311d22a10033c7741f280be3 Fixes: 48f9a3c2 "stream_cli: Proper handling of send() socket errors"
2024-03-02stream_{cli,srv}: Free received messages when not forwardedAndreas Eversberg2-0/+8
If a message is not forwarded (to a read callback function, it must be freed, to prevent memory leaks. The message musst be freed before calling osmo_stream_srv_destroy() or stream_cli_handle_connecting(), because within the function calls the client/server instance may get destroyed and the message is 'owned' by it. Calling msgb_free(msg) afterwards may result in double free bug. Related: OS#5753 Change-Id: Ic043f11cdba0df9e0b78cac8db7206800098e0ba
2024-03-02osmo_io: make use of osmo_iofd_get_ioops()Harald Welte3-8/+3
This avoids resetting the callbacks with the wrong ones in the SCTP case. Change-Id: Id3cb11bc0000299faa79d980de8abc1980916d70
2024-02-29stream_{cli,srv}: Fix memory leak, if sending a message failsAndreas Eversberg4-7/+15
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-29stream_{cli,srv}: Add support for SCTP in OSMO_IO modeHarald Welte5-27/+198
Let's enable the OSMO_IO_FD_MODE_RECVMSG_SENDMSG mode for SCTP sockets, allowing OSMO_STREAM_MODE_OSMO_IO to be used with SCTP. Change-Id: I6cf5bad5f618e71c80017960c38009b089dbd6a1 Depends: libosmocore Change-Id: I89eb519b22d21011d61a7855b2364bc3c295df82 Closes: OS#5753
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
2024-01-26build: include git-version-gen into the release tarballVadim Yanitskiy1-0/+1
Change-Id: I6abf594cbe1677f53e99ceb046ed69d68b7528ba
2023-12-12stream_srv_link: osmo_stream_srv_link_get_sockname() now returns the full ↵Pau Espin Pedrol1-11/+31
set of addresses As a result, internal stream_srv_link logging will also show the whole set of listening addresses. This is mostly fine since it mainly happens only once, during connection accept(), and this way it provides full view of where from and where to the client connected. Depends: libosmocore.git Change-Id I18a0e1a652a3e8ef3e97154355eb1d07a14ef0bd Related: SYS#5581 Change-Id: I216502a9aeafe638940f110bc9fddf2504b2ac3a
2023-12-08stream_cli: Introduce API osmo_stream_srv_get_sockname()Pau Espin Pedrol3-0/+15
Similar to what osmo_stream_srv_link and osmo_stream_cli already have. Change-Id: I171befd1fdf40c3cbb3fc7e4c3eedf82128b0712 Related: SYS#5580
2023-12-08stream_cli: osmo_stream_cli_get_sockname() now returns the full set of addressesPau Espin Pedrol2-3/+5
This is used by API callers, and internally to log connected/disconnected events. Related: SYS#5581 Change-Id: I249ee7cad824cf971faabe06d10de2426c1b0c8b
2023-12-08netif: sctp.h: Introduce value_string for enum sctp_sstat_statePau Espin Pedrol2-0/+19
This can be used by apps retrieving struct sctp_status through getsockopt(SCTP_STATUS). The relevant field is spinfo_state: osmo_sctp_sstat_state_str(st.sstat_state); Change-Id: Id7d8a9ad7b32406ac603e520b33809d7ae5c762f Related: SYS#6636
2023-12-08netif: sctp.h: Introduce value_string for enum sctp_spinfo_statePau Espin Pedrol2-0/+15
This can be used by apps retrieving struct sctp_paddrinfo through getsockopt(SCTP_GET_PEER_ADDR_INFO). The relevant field is spinfo_state: osmo_sctp_spinfo_state_str(pinfo.spinfo_state); Related: SYS#6636 Change-Id: I78a0bd8279a04f4011c7273e0f542981308e482f
2023-12-06stream: Add missing osmo_stream_srv_link_get_fd() APIPau Espin Pedrol2-0/+9
osmo_stream_srv and osmo_stream_cli already had that API introduced in order to use it instead of *_get_ofd(), since the later will eventually be deprecated due to incoming osmo_io. Change-Id: I1bd3f790d93af74c150938a59108b882ad2820f3
2023-12-06stream_cli: Fix opening sctp client socket if no local address setPau Espin Pedrol2-4/+14
Properly call osmo_sock_init2_multiaddr2() to use default binding address if user of osmo_stream_cli didn't set one on the object through the API. osmo_sock_init2_multiaddr2() was also borken under that scenario until recently (see Depends below). Until now, users of osmo_stream for SCTP (mainly libosmo-sccp) relied on always setting a proper local address to overcome this limitation. Depends: libosmocore.git Change-Id I2641fbaca6f477404b094dbc53c0c1a3dd3fd2fd Related: OS#6279 Change-Id: I0d9d0e48690c915f7b51ad09f452e551e01368b5
2023-11-21Introduce generic osmo_stream_{cli,srv}_get_fd() APIHarald Welte3-6/+30
The old osmo_stream_{cli,srv}_get_ofd() API only works for streams in OSMO_FD mode. However, it is legitimate for an application wanting to get low-level access to the file descriptor, for example to issue some {get,set}sockopt() calls on it. Change-Id: Ib0737f21150f6ac8d524b92c7ddb098f2afdeaab Related: OS#5753
2023-11-20stream_srv: osmo_stream_srv_get_ofd() works only in OSMO_FD modeHarald Welte1-0/+1
The corresponding client function osmo_stream_cli_get_ofd() already contained an OSMO_ASSERT, but the server side was missing this so far. The 'ofd' member only has meaning in the context of OSMO_FD, so calling that function from generic code is wrong! Change-Id: I50df259040e011135a31fe1aee231eba430fa94a Fixes: Change-Id I2f52c7107c392b6f4b0bf2a84f8c873c084a200c Related: OS#5753
2023-10-24stream_srv: Make osmo_stream_srv_clear_tx_queue() aware of osmo_ioDaniel Willmann1-2/+13
Change-Id: I818fe4e3792ed88ae4d6fd6afb677b39264ab662
2023-10-18stream_test: Fix memleaksarehbein1-15/+33
- Clean up all allocations, introduce clean memory management to entire test Related: OS#6222 Change-Id: Ica25fcd71e8bf8946def3ea7ce320354ea6edb3a
2023-10-18stream_test: Improve mem mgmt, fix connection mgmtarehbein2-81/+79
- Use tall_test as root context everywhere, don't create any other contexts - change .*_(cli|srv)_run_client() signature by adding talloc context as parameter - Open and Close server link inside test_recon() Related: OS#6222 Change-Id: I9ef02ed113bc049ae430b93d0eb69641e2ee809b
2023-10-09stream: Add and use helper function osmo_ipa_push_headers()arehbein5-10/+27
Related OS#5753, OS#5751 Change-Id: I61e1fe59166c46595efe8c1f32b8f2607cb6c529
2023-10-05stream (test): Fix Coverity CID 323456arehbein1-1/+1
Fix Coverity CID 323456 ("Control flow issues (NO_EFFECT)") by removing 'greater than 0'-check on unsigned integer-type variable. Change-Id: I2efb28feae4d4fa7516702f01026af09aa3777ac
2023-10-02stream: Add client-side (segmentation) support for IPAarehbein7-18/+315
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