summaryrefslogtreecommitdiff
path: root/src/lib/dev.c
Commit message (Collapse)AuthorAgeFilesLines
* lib: Fix reading tx queue length0.14.0Dimitri Staessens2018-12-071-1/+1
| | | | | | | The fccntl call was reading from the RX queue instead of the TX queue. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Revise du buff API towards a memory allocatorDimitri Staessens2018-10-261-25/+10
| | | | | | | | | This changes the API to the rdrbuff to treat it as a pool memory allocator. The head and tailspace to allocate in a buffer is now set system-wide instead of being passed as a parameter. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Check flow id instead of assertDimitri Staessens2018-10-191-1/+4
| | | | | | | | | This will check if the flow id is valid instead of asserting. It avoids assertion failures in the IPCP if an application crashes and the IRMd deallocates the flow while the IPCP still has pending writes. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* Merge branch 'testing' into beSander Vrijders2018-10-111-1/+4
|\
| * lib: Initialize libgcrypt before useDimitri Staessens2018-10-111-1/+4
| | | | | | | | | | | | | | | | This initializes libgcrypt before use in the library. This fixes the "called in non-operational state" error when CRC checking is enabled. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* | Merge branch 'testing' into beDimitri Staessens2018-10-061-117/+152
|\|
| * lib: Split error checking from FRCTDimitri Staessens2018-10-051-8/+55
| | | | | | | | | | | | | | | | This splits off the CRC from FRCT so it can be set independently. Ouroboros now allows raw flows with error checking. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
| * lib: Rename port_id to flow_idDimitri Staessens2018-10-051-51/+51
| | | | | | | | | | | | | | Renames port_id to flow_id according to updated nomenclature. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
| * ipcpd, lib, irmd, tools: Change SDU to packetSander Vrijders2018-10-051-7/+7
| | | | | | | | | | | | | | | | This will change SDU (Service Data Unit) to packet everywhere. SDU is OSI terminology, whereas packet is Ouroboros terminology. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
| * lib: Pass qosspec at flow allocationDimitri Staessens2018-10-051-49/+38
| | | | | | | | | | | | | | | | | | | | | | | | The flow allocator now passes the full qos specification to the endpoint, instead of just a cube. This is a more flexible architecture, as it makes QoS cubes internal to the layers. Adds endianness transforms for the flow allocator protocol in the normal IPCP. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
| * lib: Remove configuration from FRCTDimitri Staessens2018-09-271-6/+0
| | | | | | | | | | | | | | | | This removes configuration from the FRCT protocol to send it during flow allocation. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
| * include: Remove _DEFAULT_SOURCE in endian.hDimitri Staessens2018-09-271-1/+6
| | | | | | | | | | | | | | | | This removes the _DEFAULT_SOURCE definition in the endian header as it should not be there. This avoids double and conflicting definitions. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* | lib: Support for rudimentary retransmissionDimitri Staessens2018-07-271-8/+7
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | This adds rudimentary support for sending and processing acknowledgments and doing retransmission. It replaces the generic timerwheel with a specific one for retransmission. This is currently a fixed wheel allowing retransmissions to be scheduled up to about 32 seconds into the future. It currently has an 8ms resolution. This could be made configurable in the future. Failures of the flow (i.e. rtx not working) are indicated by the rxmwheel_move() function returning a fd. This is currently not yet handled (maybe just setting the state of the flow to FLOWDOWN is a better solution). The shm_rdrbuff tracks the number of users of a du_buff. One user is the full stack, each retransmission will increment the refs counter (which effectively acts as a semaphore). The refs counter is decremented when a packet is acked. The du_buff is only allowed to be removed if there is only one user left (the "stack"). When a packet is retransmitted, it is copied in the rdrbuff. This is to ensure integrity of the packet when multiple layers do retransmission and it is passed down the stack again. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: React to flow events activelySander Vrijders2018-07-041-3/+17
| | | | | | | | This adds the infrastructure to actively react to flow up, down and deallocated events. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
* Merge branch 'testing' into beSander Vrijders2018-06-151-2/+6
|\
| * lib: Mark flows down on finiDimitri Staessens2018-06-151-2/+6
| | | | | | | | | | | | | | This will mark flows down when they are finalized. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* | lib: Add a data qos cubeDimitri Staessens2018-06-081-2/+2
|/ | | | | | | | This adds a data qos cube that is reliable. Reliable qos can be selected by setting the loss parameter of the qosspec to 0. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Add a QOS_RAW QoS cubeDimitri Staessens2018-06-051-12/+18
| | | | | | | | | This adds a QoS cube that allows sending packets directly over a raw flow, without an FRCT state machine. Flow allocation with a NULL qosspec will now default to such raw flows. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Revise FRCT reorderingDimitri Staessens2018-06-041-3/+0
| | | | | | | | The reordering queue is replaced by a fixed ring buffer for speed and simplicity. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Mark flows as down on ipcp_flow_fini()Dimitri Staessens2018-05-301-34/+35
| | | | | | | | | | The flow_fini() function was marking flows as wronly (so rdonly for the application) when the flow was deallocated. With the recent addition of the flowdown state, we can now mark them as down. Also fixes some bounds checks and alignment. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Add event types to fqueueDimitri Staessens2018-05-141-21/+31
| | | | | | | | | | | The event type of the current event in the fqueue can now be requested using the fqueue_type() command. Currently events for packets (FLOW_PKT), flows (FLOW_UP, FLOW_DOWN) and allocation (FLOW_ALLOC, FLOW_DEALLOC) are specified. The implementation only tracks FLOW_PKT at this point. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Shut rx buffer down before cleanup and exitDimitri Staessens2018-04-261-0/+1
| | | | | | | | | | If a program exits, it cleans its read buffer. However, another process could still write a packet in that buffer, which would cause the IPCP or IRMd to run into an assertion failure on shutdown. Setting the rbuff to ACL_FLOWDOWN prevents this. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Simplify reg/unreg APIDimitri Staessens2018-03-221-5/+4
| | | | | | | | | | | | | | | | | | | | The reg/unreg API is simplified to registering and unregistering a single name with a single IPCP. The functionality associated with registering names was moved from the IRMd to the irm tool. The function to list IPCPs was simplified to return all IPCPs in the system with their basic properties needed for management. The above changes led to some needed changes in the irm tool and the management functions that were depending on the previous behaviour of list_ipcps. Command line functionality to list IPCPs in the system is also added to the irm tool. Some older code was refactored. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Allow disabling partial readDimitri Staessens2018-03-191-6/+14
| | | | | | | | | | | | | | This allows disabling partial reads. It adds a flag FLOWFRNOPART that disables partial reads. Partial read is different from partial delivery (FRCTFPARTIAL), which allows delivery of fragments of an incomplete packet and thus potentially corrupted data. FLOWFRNOPART will never deliver corrupted data (unless FRCTFPARTIAL is also set). If FLOWFRNOPART is set and the buffer provided to flow_read is too small for the SDU, that SDU will be discarded and -EMSGSIZE is returned; Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Allow partial readDimitri Staessens2018-03-121-20/+39
| | | | | | | | | | | | | This implements partial read of packets if the buffer supplied to flow_read() is smaller than the packet in the buffer. If the number of bytes returned by flow_read equals the size of the buffer, the next read() will deliver the next bytes of the packet (or 0 if the packet was exactly the size of the buffer on the previous read). Implements #7. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Implement timeout on blocking writeDimitri Staessens2018-03-121-9/+19
| | | | | | | | | | This completes the implementation of the SNDTIMEO for a blocking write. Fixes #6. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Use PTHREAD_COND_CLOCK for blocking reads0.10.6Dimitri Staessens2018-03-101-1/+1
| | | | | | | | | | | The rbuff uses the PTHREAD_COND_CLOCK for its condition variables, but the flow_read was passing a time it got from the CLOCK_REALTIME_COARSE clock. This causes the blocking reads not to timeout correctly. The oping was updated to detect server timeouts and finish gracefully. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Add fccntl operation to get queue lengthsDimitri Staessens2018-02-281-0/+9
| | | | | | | | | | This adds the FLOWGRXQLEN and FLOWGTXQLEN operations to fccntl to get the number of packets that are in the receive and transmit buffers respectively. The flow statistics are updated to show these queue lengths. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Fix bad lock in dev.c0.9.2Dimitri Staessens2018-01-221-1/+1
| | | | | | | | There was a rdlock() instead of an unlock(). This fixes #3. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* include, src: Update copyright to 2018Dimitri Staessens2018-01-091-1/+1
| | | | | | | Happy New Year, Ouroboros. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib, tools: Rename application process and instanceDimitri Staessens2017-12-021-59/+59
| | | | | | | | | | | This refactors ouroboros to use "program" instead of "application process" and "process" instead of "application process instance" to align with current naming in current Operating Systems courses instead of the ISO nomenclature adopted by RINA. This change permeates through the entire implementation. Also contains some minor other refactors. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd, irmd: Bugfix for failed accept() callsDimitri Staessens2017-11-291-1/+2
| | | | | | | | | The ipcp will not have the rx_rb set for a pending flow, so it should not call shm_rbuff_fini. The irmd should not call ipcp_flow_dealloc for flows that are still pending flow allocation. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Fix init and fini ELF sections for OS XDimitri Staessens2017-11-201-2/+10
| | | | | | | OS X uses a different syntax for specifying ELF sections. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Add library initializers to .init_arrayDimitri Staessens2017-11-201-4/+7
| | | | | | | | | | The library initializers with argc and argv arguments were specified using the __attribute__((constructor)). This is undefined behaviour as constructors should have no arguments. This is fixed by passing the functions to the .init_array. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Fix FRCT sequence number network endiannessDimitri Staessens2017-11-091-0/+2
| | | | | | | | Endianness conversion from/to the network for the sequence number was missing in 68694bc. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Use packed struct for FRCT header accessDimitri Staessens2017-11-081-1/+2
| | | | | | | | | | | | | | | This replaces the variable FRCT header with a packed struct, which significantly simplifies the implementation. The shm_du_buff calls to release the head/tail are updated to return a pointer to the original head or the new tail (in symmetry to the alloc calls, which return a pointer to the new head and old tail), so that it immediately points to the structure that is needed. The frct_pci sources are removed and frct is now fully in the frct.c source file. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Refactor FRCT implementationDimitri Staessens2017-11-071-501/+218
| | | | | | | | | | | | | | | | | | | | The frct_pci and rq headers are moved from include/ouroboros to src/lib since they are only needed in the library. FRCT is moved to its own source file. FRCT takes the application PDUs, encapsulates and processes them and hands them back. This makes it easier to disable FRCT should the application want to write to a "raw" flow. An FRCT instance is now allocated upon alloc and released upon dealloc. The FRCT data structure is split into a sender and receiver connection record. Setting a new configuration will now be done upon sending the next data PDU, which will flag the DRF for a new run and use that configuration. This avoids some issues should packets arrive out-of-order, and simplifies setting a configuration. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* dev: Split nonblocking read and writeDimitri Staessens2017-10-301-2/+2
| | | | | | | | | | The FLOWFNONBLOCK flag now has two subflags FLOWFRNOBLOCK and FLOWFWNOBLOCK which allows setting the behavior of read and write independently. The default behavior is unchanged (blocking read and write). Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* dev: Bind python scripts to script nameDimitri Staessens2017-10-251-0/+13
| | | | | | | | | | This revises the library init script so that it checks whether the program is run by a python executable (python, python2 or python3) and announces the script name instead of the python interpreter. This enables binding python scripts. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Fix exit bug in dev.cdimitri staessens2017-10-231-0/+4
| | | | | | | | | | If the library init() fails, the fini() call tries to access unreleased resources. The fix resets the ai struct to 0 if init() fails and checks a heap pointer for NULL before the fini() accesses internals. Signed-off-by: dimitri staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* Merged in dstaesse/ouroboros/be-deprecate-ouroboros-init-fini (pull request ↵dimitri staessens2017-10-141-13/+16
|\ | | | | | | | | | | #626) Be deprecate ouroboros init fini
| * lib: Deprecate ouroboros_init and ourboros_finidimitri staessens2017-10-141-13/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit deprecates ouroboros_init and ouroboros_fini and adds them as a constructor or destructor, causing these function to be run automatically when a program that links to the library calls and exits main(). For this to fully work, the library had to be split so that we can avoid the irmd calling these functions (the IRMd has to create the shm structures on which these calls depend). The library is split in 3 parts: libouroboros-dev, libouroboros-irm and libouroboros-common. The latter is linked to the other two so that including libouroboros-dev or libouroboros-irm will also link libouroboros-common.
* | lib: Re-enable multi-block supportdimitri staessens2017-10-131-0/+2
|/ | | | | | Multi-block support was forgotten during the update of the build system. This enables it again and fixes some bugs when it is disabled and larger SDUs are sent.
* irmd: Init libgcrypt before using itdimitri staessens2017-09-201-2/+1
|
* ipcpd, lib: Add flow down eventsSander Vrijders2017-09-191-27/+59
| | | | | | | | This adds the flow down event to Ouroboros. In the shim-eth-llc, a netlink socket is opened which listens to device up/down events. For each event the flow is then adjusted with fccntl to notify the user the flow is down or back up again. In the normal IPCP an event is thrown if a write reports that the flow is down.
* lib: Add reordering queue to FRCTSander Vrijders2017-09-151-13/+57
| | | | | This adds a reordering queue to FRCT so that SDUs can be delivered in-order when requested.
* lib: Add per instance FRCT lockSander Vrijders2017-09-011-21/+35
| | | | | This adds a per instance FRCT lock, since it was taking a write lock, thereby severely impacting parallelism in dev.c
* lib: Add fccntl configuration commanddimitri staessens2017-08-311-148/+132
| | | | | | | This replaces the flow_set_* commands with a single fccntl command that can configure flows and the FRCT instance. For more details, see "man 3 fccntl".
* dev: Revise fqueue API and add man pagesdimitri staessens2017-08-291-23/+23
|
* Merged in dstaesse/ouroboros/be-deprecate-gam (pull request #572)dimitri staessens2017-08-281-2/+1
|\ | | | | | | Be deprecate gam