aboutsummaryrefslogtreecommitdiffstats
path: root/include
AgeCommit message (Collapse)AuthorFilesLines
2023-08-25stream: Add server-side (segmentation) support for IPAarehbein1-0/+3
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-21stream: Refactor sctp_recvmsg_wrapper() loggingPau Espin Pedrol1-0/+1
*Move the helper function to stream.c and pass a logging prefix string so that it can be used by both client and server. * Adapt log level based on message type. * Rework logging code to log everything in one line Change-Id: I0ed84cc2effb71b6ef1f6efb3f8b663c602a5a31
2023-08-07stream_srv: Log SCTP REMOTE_ERROR eventsPau Espin Pedrol1-0/+21
The event was enabled but was not being logged. Change-Id: I49f5a648fd474e320101424fb6873a37442339bf
2023-08-07sctp: Document relevant RFC specsPau Espin Pedrol1-0/+6
Change-Id: Iae325b787fdb7fc95aa6922975a7e1fcf368527a
2023-08-07ipa: Add segmentation callbackarehbein1-0/+11
Related: OS#5753 Change-Id: I87ef4c7023126b783dd79e7ed47be31e1b76f975
2023-08-07examples: Add extension header octet to examplearehbein1-0/+2
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-08-04stream: Split cli/srv specific code out of stream.cPau Espin Pedrol2-0/+41
The dev/user in general is only interested about one side of the stream when looking at the code. Since the stream.c file is tarting to be quite large/bloated, this patch splits its content into stream_cli.c and stream_srv.c to make it easier to improve/extend and review. Keep common code between cli and srv in stream.c, and add a private header to contain references to it. Change-Id: I22af01bba2040eb320ba48fd1b46c090c98be159
2023-06-20stream: Drop name param from recently added API osmo_stream_srv_create2()Pau Espin Pedrol1-1/+1
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 Pedrol1-1/+0
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-20stream: Allow setting name printed during loggingPau Espin Pedrol1-0/+3
Depends: libosmocore.git Change-Id If2772a3ccaa98616e0189862a49ab0243435e343 Change-Id: I539a0d29d11348efe702f971965a55cf56db5c59
2023-06-14Add osmo_io support to osmo_stream_cli and osmo_stream_srvDaniel Willmann1-0/+5
Change-Id: I2f52c7107c392b6f4b0bf2a84f8c873c084a200c
2023-06-08stream: Properly name osmo_stream_srv read callbackDaniel Willmann1-1/+1
Change-Id: I12d74e9b407f1ea7af83fb3ec4d03ad7228a27cf
2023-02-27rtp.h: add RTP_PT_CSDATAOliver Smith1-0/+2
Related: OS#4393 Change-Id: I2ea378ba4d17e977da25ef9e6e86b3de2ccd0ad7
2023-02-20Run struct_endianness.pyOliver Smith3-5/+5
Ensure there is no diff to prepare to run this in CI. Related: OS#5884 Change-Id: Ib3459ebb2414dd1798dfda6d3c585232ceff741b
2023-02-10Add osmo_stream_srv_link_is_opened()Max1-1/+1
We use file descriptor of -1 as an indicator for unopened link internally. However, since all the structs of libosmo-netif are opaque, using it from external applications looks like a leaky abstraction. Let's remedy this by adding function which properly check this for the library user. Related: OS#5568 Change-Id: I91aa7da5f09ec4e8e2d21c827b45ed92e6b0e3d9
2022-12-21amr: Clarify size of AMR BWE header and ToCPau Espin Pedrol1-0/+3
Change-Id: I34c76b18ee45e12dba92864715e8ef91e6de3b01
2022-12-21amr: constify input buffer in osmo_amr_is_oa()Pau Espin Pedrol1-1/+1
Change-Id: I72ef6fc700f628ea158ea888a5f1e9dc8776ab7e
2022-12-21amr: Add missing header stdbool.hPau Espin Pedrol1-0/+1
Change-Id: I84e447960c4912147d2f3a6170393370d354625b
2022-12-21amr.h: Fix AMR_FT_{GSM,TDMA,PDC}_EFR_SID_LENPau Espin Pedrol1-13/+13
Fixes: 678c7fc8fe4fd11e09ccd642ad60c10c365bd19a Change-Id: I63c8082bec12bf81760330d1fc0b13de23ac6a24
2022-12-19amr: Support all SID and NO_DATA amr formatsPau Espin Pedrol1-19/+34
Related: SYS#6161 Change-Id: I0e766b3231f03ea87d89fad6ecdce3bd14769054
2022-12-19amr: Add struct definition for AMR BWE headerPau Espin Pedrol1-0/+28
Change-Id: I4b44257605bc5967d862ee29076ea6260d9a6bd8
2022-12-19amr.h: Fix missing include dependenciesPau Espin Pedrol1-0/+3
Needed for size_t uint8_t, etc. Change-Id: Ia808c2b6c426de79db5c88784dd7bce6096179aa
2022-11-18osmux: Introduce API osmux_xfrm_input_set_name()Pau Espin Pedrol1-0/+1
This will be used internally by osmux code to print more meaningful lines. Related: SYS#6161 Change-Id: Ibbcfdb23a6015ce45840bb64b2b560c2806f7ff6
2022-11-15osmux: Add data[0] field to osmux_hdrPau Espin Pedrol1-0/+1
This allows easy access to osmux_hdr payload. Change-Id: I27750c38f12d3d84dbaac5beff166d78ffa6c45b
2022-10-17stream: Introduce APIs osmo_stream_{cli,srv}_clear_tx_queue()Pau Espin Pedrol1-0/+4
Related: SYS#6113 Change-Id: Iecb0a4bc281647673d2930d1f1586a2df231af52
2022-10-17cosmetic: stream: Fix parameter namePau Espin Pedrol1-1/+1
The param is already "cli" in the .c file. Change-Id: I7e1e9902a39655e57e28d38a222bca850dd7de0e
2022-10-17stream: Improve logging of SCTP_PEER_ADDR_CHANGE notificationPau Espin Pedrol1-0/+10
Related: SYS#6113 Change-Id: Ieebc6e623874b4770ec7cd8b934244ffecaa089d
2022-10-03osmux: Introduce API osmux_xfrm_input_get_deliver_cb_data()Pau Espin Pedrol1-0/+1
This API allows retrieving back the private pointer set previously by osmux_xfrm_input_set_deliver_cb(). Change-Id: I95433b18802f73fa70e758f4aa02128eee940d88
2022-10-03osmux: Allocate struct osmux_out_handle through APIPau Espin Pedrol1-2/+7
Until now, the osmux_in_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, openbsci, osmo-bts) can still work fine, since there's no change on the struct osmux_in_handle. However, they will somehow break next time thestruct is changed until they are ported to the same API (easy to do). Change-Id: I752ab031f935f04731bb1a354333f1682a1aa5bd Related: SYS#5987
2022-10-03osmux: Take into account configured osmux_in_handle->osmux_seq fieldPau Espin Pedrol1-0/+1
It was not being used anywhere, yet older applications used to set it (always to 0, which was the default value applied internally). Let's make use of it and apply it as first seqnum to be used on a circuit. This value is applied upon call to osmux_xfrm_input_open_circuit(), hence it can be set independently for every new circuit. Change-Id: Ia26fcba5d7364a5744b2d64d0542a2b3880eee34
2022-09-28amr: Add data[0] field to amr_hdrPau Espin Pedrol1-0/+1
This allows easily accessing the AMR payload located after the TOC. Change-Id: I72c0a001bf7ce9a63ac03beef352af177084e644
2022-09-19stream: Provide caller with SCTP flags during osmo_stream_*_recv()Pau Espin Pedrol1-0/+4
The user may want to check the flags in order to know if the content pointed at by msgb is an sctp_notification structure, and not in-band data. This is useful for the user in order to gain connection state such as SCTP RESET notification, which means the client reconnected reusing the same socket, loosing all higher layers state. The MSG_NOTIFICATION from netinet/sctp.h is not reused, and instead an osmocom specific flag (and bitmask) is used. This is done in order to fit the flags in one byte, since for instance MSG_NOTIFICATION requires 2 bytes in my system (0x8000). Related: SYS#6113 Change-Id: I0ee94846a15a23950b9d70eaaef1251267296bdd
2022-09-12osmux: Allow the user to alloc msgbs used to provide generated RTP packetsPau Espin Pedrol1-0/+5
This is useful for users of the API which need to keep forwarding the msgb to lower layers which may need prepending a new header to the msgb, like osmo-bts with l1sap. Related: SYS#5987 Change-Id: I632654221826340423e1e97b0f8ed9a2baf6c6c3
2022-09-02osmux: Allocate struct osmux_out_handle through APIPau Espin Pedrol1-2/+5
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-09-02osmux: Drop long time deprecated APIsPau Espin Pedrol1-4/+0
Those APIs where deprecated 4 years ago (end of Aug 2018), and they have not been used since around that time. Hence it can be considered safe to drop them, since they only make the whole code more complex to understand. API osmux_xfrm_output_init() is left since openbsc.git is still using it. Related: OS#5987 Change-Id: Icbdd364a8161a8113dbf1406716946f684d0a853
2022-08-10osmux.h: Define default Osmux portPau Espin Pedrol1-0/+2
This has been the port being used historically in most osmux setups, and projects using osmux.h have it defined locally. Let's define it here so that there's no need to define it on each client. Change-Id: Ibfd058bceeeaa1384a00d8fcd6d6268b445e19bd
2022-08-10osmux.h: Add missing msgb.h headerPau Espin Pedrol1-0/+1
Change-Id: I2002ed2352ef4db2fe0717389f1f6e24a88a973f
2022-01-04amr: Introduce APIs to convert BE to IuUP/IuFP formatAlexander Couzens1-0/+4
These APIs allow for easy re-formatting of received AMR to forward between regular RTP and IuUP. Related: OS#1937 Change-Id: Id2bd32d5f2060abe581730996dc4251381bf7d4f
2022-01-02export osmo_amr_bitsAlexander Couzens1-0/+1
Change-Id: Ic03653b2a885c5d9419c6c75a718b550fc30b86e
2021-12-09prim: Add internal CTL SAPI to negotiate SAP versionsPau Espin Pedrol1-0/+10
This commits adds a generic mechanism for applications to validate support for SAPs and specific versions of them. A new special SAPI is introduced to manage inbound control messages for the protocol. In that SAPI a new primitive HELLO.req/.cnf is added to negotiate support for versions of any given SAP. The idea is that the client upon connecting submits a HELLO.req(SAP, VER) for each SAP it plans to use, including the version of the special CTL SAPI itself (preferrably to be checked first). Upon receiving such a message, osmo_prim_srv handles it using a special path, which ends up calling the user provided rx_sapi_version_cb(SAP, VER). In there, the user can either: * Accept the version (return same VER value) * Reject the requested version but propose another candidate version (return some positive VER value other than received VER). In this case, the client can decide whether to request another VER or close the connection. * Reject the proposed version and close the connection. Change-Id: I0c2d92cfdb5433e3caab51d712fd947d51eeef23
2021-12-09Introduce osmo_prim_srv APIsPau Espin Pedrol2-0/+55
This new module allows easy exchange of osmo_prim based data types over IPC communication (UD socket supported only so far), by replacing the osmo_prim_hdr struct with a serialized header when submitting/receiving it from the IPC socket. This patch introduces the server side of the UD socket, but the client side can easily be introduced in the same file whenever needed. Related: SYS#5516 Change-Id: I7cab15ac092e45a256c4f0bab11b3962df861044
2021-12-09stream: Add support for AF_UNIX socketsPau Espin Pedrol1-0/+4
Change-Id: I5237a8121be05a9a31a39ca38a6a139062f258c4
2021-11-23Introduce sctp.h to provide SCTP related functionalitiesPau Espin Pedrol2-0/+17
These value_strings are taken from existing private ones in libosmo-sccp.git osmo_ss7.c, and are moved here in order to be reused by other projects, such as osmo-hnodeb. Change-Id: Ica6f01851fb94e31f4ef097494bb1b8a95597ba6
2020-05-16amr: Fix OA<->BWE conversion.Alexander Chemeris1-12/+26
Size of a single AMR frame doesn't always shrink by a byte when converted from octet-aligned to bandwidth-efficient mode. It does shrink for AMR modes 2, 3, 4, 6, and 7 but doesn't shrink for AMR modes 0, 1, 5, and SID frames because we only remove 6 bits. So old code generated truncated AMR packets for those AMR modes. This patch fixes the length calculation by properly counting bits. Proper bit counting is also bringing us one small step closer to properly handlig multi-frame AMR packets. Change-Id: I0462e054a0adc9080456f3eeea9cab7c229cdb70
2020-05-14Revert "amr: Fix OA<->BWE conversion."neels1-26/+12
This reverts commit 002a51e2180cf19bf5e11e16d78271998d0b3f5c. Reason for revert: amr_test fails with sanitizer build: Sample No.: 6 bw-efficient: a7bfc03fc03fc03fc03fc03fc03fc03fc03fc03fc03fc03fc03fc03fc03fc03f 1010011110111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111 ../../../src/libosmo-netif/src/amr.c:63:24: runtime error: index 15 out of bounds for type 'size_t [9]' ../../../src/libosmo-netif/src/amr.c:63:24: runtime error: load of address 0x7f69498e56b8 with insufficient space for an object of type 'size_t' 0x7f69498e56b8: note: pointer points here 00 00 00 00 00 00 00 00 00 00 00 00 5f 00 00 00 00 00 00 00 67 00 00 00 00 00 00 00 76 00 00 00 ^ ================================================================= ==489935==ERROR: AddressSanitizer: global-buffer-overflow on address 0x7f69498e56b8 at pc 0x7f69498abec7 bp 0x7ffeafb35330 sp 0x7ffeafb35328 READ of size 8 at 0x7f69498e56b8 thread T0 #0 0x7f69498abec6 in osmo_amr_bytes ../../../src/libosmo-netif/src/amr.c:63 #1 0x7f69498ac661 in osmo_amr_bwe_to_oa ../../../src/libosmo-netif/src/amr.c:193 #2 0x5648b11afb96 in osmo_amr_bwe_to_oa_test ../../../src/libosmo-netif/tests/amr/amr_test.c:134 #3 0x5648b11af31d in main ../../../src/libosmo-netif/tests/amr/amr_test.c:235 #4 0x7f6948d5de0a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x26e0a) #5 0x5648b11af3d9 in _start (/n/s/dev/make/libosmo-netif/tests/amr/amr_test+0x43d9) 0x7f69498e56b8 is located 8 bytes to the left of global variable 'amr_ft_to_bits' defined in '../../../src/libosmo-netif/src/amr.c:32:15' (0x7f69498e56c0) of size 72 0x7f69498e56b8 is located 48 bytes to the right of global variable 'amr_ft_to_bytes' defined in '../../../src/libosmo-netif/src/amr.c:44:15' (0x7f69498e5640) of size 72 SUMMARY: AddressSanitizer: global-buffer-overflow ../../../src/libosmo-netif/src/amr.c:63 in osmo_amr_bytes Change-Id: I8232521c513722435e71dc90bdbfee10f8f83496
2020-05-14amr: Fix OA<->BWE conversion.Alexander Chemeris1-12/+26
Size of a single AMR frame doesn't always shrink by a byte when converted from octet-aligned to bandwidth-efficient mode. It does shrink for AMR modes 2, 3, 4, 6, and 7 but doesn't shrink for AMR modes 0, 1, 5, and SID frames because we only remove 6 bits. So old code generated truncated AMR packets for those AMR modes. This patch fixes the length calculation by properly counting bits. Proper bit counting is also bringing us one small step closer to properly handlig multi-frame AMR packets. Change-Id: I9fc5fb92e9bada22a47a82fcfb0925e892e50ced
2020-01-12add/clean big-endian packed structs (struct_endianess.py)Neels Hofmeyr3-27/+16
Change-Id: If408153af472a41dcea8d6f6aedd22adb16963d5
2020-01-07struct amr_header: copy comments to little endian partNeels Hofmeyr1-4/+4
I will soon apply struct_endianess.py to this code, and then the comments that are now only in the big endian part would be lost. Copy them to preserve them. Change-Id: Ie4279928bd77a5d425d0e7a3c4d58bac3cf0230a
2019-10-15stream: osmo_stream_cli: Support setting multiple addrPau Espin Pedrol1-0/+2
This API will be later used to set multiple addresses for SCTP sockets. Depends: libosmocore.git Ic8681d9e093216c99c6bca4be81c31ef83688ed1 Related: OS#3608 Change-Id: I09f0d989f2309abdeb304fe570355abed2cd107b
2019-10-15stream: osmo_stream_srv_link: Support setting multiple addrPau Espin Pedrol1-0/+1
This API will be later used to set multiple addresses for SCTP sockets. Depends: libosmocore.git Ic8681d9e093216c99c6bca4be81c31ef83688ed1 Related: OS#3608 Change-Id: I0fe62f518e195db4e34f3b0ad1762bb57ba9d92a