summaryrefslogtreecommitdiff
path: root/src/lib/dev.c
Commit message (Collapse)AuthorAgeFilesLines
* build: Comply with -Wextra compiler flagdimitri staessens2016-10-211-2/+5
| | | | | This reduces the risk for some bugs, for instance due to signed/unsigned mismatches and unused variables.
* lib: Move rbuff creation/destruction to IRMddimitri staessens2016-10-211-32/+28
| | | | | This stabilises flow allocation now that the rbuffs are created upon flow allocation. Only the IRMd can sync this process sufficiently.
* lib: Demultiplex the fast pathdimitri staessens2016-10-211-171/+329
| | | | | | | | The fast path will now use an incoming ring buffer per flow per process. This necessitated the development of a new method for the asynchronous io call, which is now based on an event queue system for scalability (fqueue). The ipcpd's and tools have been updated to this API.
* lib, dev: Implement read/write options for flowsdimitri staessens2016-10-161-0/+17
| | | | | | | Added the missing implementation of setting read/write options for flows. This allows applications to block the fast path for remotes. IPCPs can use this to block the fast path for the N + 1 flow when receiving remote deallocation requests.
* lib: Stabilize fast flow deallocation over local IPCPdimitri staessens2016-10-151-12/+20
|
* lib: Fix initialisation of flow_setdimitri staessens2016-10-151-2/+3
| | | | The safe copy was not correctly initialised.
* lib: Fix flow deallocation logicdimitri staessens2016-10-131-18/+1
| | | | | Both the N and N-1 entity must now call flow_dealloc for the port_id to be released.
* lib: Track SDUs in the fast pathdimitri staessens2016-10-111-5/+24
| | | | | | This will allow to finalize deallocating flows until all SDUs have been processed. Read and write calls will now block when a flow was deallocated. Replaces NULL checks in the fast path with asserts.
* lib: Add non-copy reading from fd for IPCPsdimitri staessens2016-10-071-8/+43
|
* lib, dev: Add asynchronous deallocationdimitri staessens2016-10-071-24/+14
| | | | | Flow deallocation from the application will immediately return (void call). The IRMd will not send a reply message.
* lib: Fix shutdown with pending SDUsdimitri staessens2016-10-061-1/+1
| | | | | The SDU's were not correctly removed upon shutdown, peek should be pop.
* lib, ipcpd: Fix bad lockingSander Vrijders2016-10-051-2/+2
| | | | | | Some locks were taken at an inappropriate time, causing the shim-eth-llc to block indefinitely upon shutdown and causing flow allocation to halt since a response could never be given.
* lib, ipcp: Revise fast path and flow interfacesdimitri staessens2016-10-041-219/+626
| | | | | | | | | | | | IPCPs can now use ap_init() to initialize the memory. All flows are accessed using flow descriptors, this greatly simplifies IPCP development. Reverts the fast path to a single ap_rbuff per process. Splits lib/ipcp into irmd/ipcp and lib/ipcp-dev. Adds a lib/shim-dev holding tailored functions for shims. Moves the buffer_t to utils.h. Fixes the shim-eth-llc length field. Removes the flow from shared.h. Fixes #4 Fixes #5
* lib: Add lazy copy of flow_setdimitri staessens2016-09-071-8/+16
| | | | | | The flow_set now has a safe copy which is threadsafe for the select call without needing a lock. This greatly speeds up consecutive select calls.
* lib: dev: Provide a set of fds to flow_selectdimitri staessens2016-09-061-8/+83
| | | | | | | The flow_select call now takes as a parameter a flow_set_t, which specifies a set of flow descriptors that will unblock the select call when an SDU for one of them arrives. The select call has been moved to its own header.
* lib: dev: Add fd lookup tabledimitri staessens2016-09-031-23/+25
|
* lib: dev: Refactordimitri staessens2016-09-031-182/+188
| | | | | Renamed _ap_instance to ai, adds a char * daf_name (to be set by ipcps in ipcp-dev.h, later to be set when we generalise enrolment to DAFs).
* lib: Add northbound ringbuffersdimitri staessens2016-09-021-3/+3
| | | | Fast path is split in north and southbound paths.
* lib: Refactor shm_du_map to shm_rdrbuffdimitri staessens2016-08-291-15/+19
| | | | | | | | | | The shm_du_map is renamed to shm_rdrbuff to reflect the Random Deletion Ringbuffer used in the implementation. The close_on_exit call is removed and SDUs are cleaned up by the application in the ap_fini() call. This required a non-blocking peek() operation in the shm_ap_rbuff. Some initial implementation for future support of qos cubes has been added to the shm_rdrbuff.
* irmd, lib: Rebuild the IRMd data modeldimitri staessens2016-08-211-36/+36
| | | | | | | | | | | | | | | | | | | | | | The complete data model inside the IRMd has been restructured. The bind operation was revised to allow binding of AP and AP instances and register those names with different DIFs (see "irm bind" for details). Server applications require to call ap_init with a server name argument, client application that do not the be reachable over any DIF can call ap_init(NULL). Calling ap_init for a client with a specified name will not have adverse consequences for the application, but will consume unnecessary resources in the IRMd. Application servers can now be started at any point after the IRMd has been started. Starting servers, binding AP names and registering names in DIFs can be performed in any order that does not defy temporal logic. Supports naming instances by their pid. In case of IPCP Instances created with the IRM tool, the name assigned during "irm ipcp create" can be used. All the changes required updates in the tools.
* Merged in dstaesse/ouroboros/be-api-bind (pull request #203)Sander Vrijders2016-08-101-1/+36
|\ | | | | | | lib, irmd: Bind AP instances to AP_subsets
| * lib, irmd: Bind AP instances to AP_subsetsdimitri staessens2016-08-101-1/+36
| | | | | | | | | | | | | | This call will allow grouping AP instances of a certain AP together which are configured identically. Adds the bind operation to dev and updates the applications to make use of this call. Flow_alloc is now only called with the pid and doesn't send the apn anymore.
* | lib, irmd, ipcp: Add socket timeoutSander Vrijders2016-08-101-4/+3
|/ | | | | | This will add a timeout to the socket so that a process won't be blocked by the actions of the process with which it is communicating over the socket.
* lib: dev.c: Release locks before blocking callsdimitri staessens2016-08-091-8/+23
|
* lib: Various fixesdimitri staessens2016-08-091-2/+2
| | | | | Fix missing set of api upon flow_alloc. Various locking fixes.
* ipcpd: normal: Allow exchange of static DIF informationSander Vrijders2016-08-081-3/+0
| | | | | | This adds the functionality of exchanging the static DIF information between 2 DIF members. After exchange the enrollment is stopped, and the IPCP that initiated enrollment transitions to the enrolled state.
* lib: Revise blocking I/Odimitri staessens2016-08-031-27/+29
| | | | | | | | | Blocking I/O now uses condition variables in the shared memory instead of busy waiting. Timeouts can be specified. This requires the size of the rbuffs and du_map to be the same, to guarantee that when the shm_du_map is not full, the ap_rbuffs can't be full either. Added the timeout option to the flow for future use.
* lib: dev: Add select-like calldimitri staessens2016-08-031-4/+9
| | | | | | | This adds a flow_select() call that will sleep until an SDU can be read on a flow. It returns the file descriptor for which an SDU is ready. It takes as optional argument a timespec struct to specify a timeout.
* lib: shm_du_map: Clean sdus upon exitdimitri staessens2016-07-061-2/+2
| | | | | | | | When an application closes the shm_du_map, it will clean all remaining sdu's for that application. Adds a function to clean the shm_du_map on close. Fixes #20.
* lib: Change invalid pid to -1dimitri staessens2016-07-051-3/+3
| | | | | | | | The stack used pid 0 (the scheduler) to indicate an invalid process instance, probably as a leftover from the deprecated application process instance id. Using -1 is a better solution. Fixes #16.
* lib: robust locking in shared memory and crash recoverydimitri staessens2016-07-021-20/+22
| | | | | | | | | | | | | | This PR enhances the shared memory providing recovery if a process crashes. It adds a SHM_DU_TIMEOUT_MICROS variable, setting an expiration time for SDU's when shared memory is full. If an application doesn't read a blocking SDU within this time, the shared memory will be cleansed of all SDU's for this application and the application's rbuff will be cleared. Some refactoring of the API's. Fixed wrong pthread checks in IRMd. Fixes #13 Fixes #14
* lib, irmd, ipcpd: Change pid to apiSander Vrijders2016-06-281-10/+10
| | | | Changes the variable name as well to API instead of PID.
* lib, irmd, ipcpd: Change of IRM APISander Vrijders2016-06-281-24/+8
| | | | | | | | | | | | | | This changes the IRM API after discussions with Dimitri. The register operation is now split into a bind and register operation. The same for unregister; unbind and unregister. PIDs are now used as the application instance name. A name for a PID is only provided for scriptability in bash. It is therefore also no longer passed down to the IPCP. Every operation on an IPCP through the IRM API has to use the PID. Quering of the PIDs by name is possible. The IRM tool has been updated to use this new API as well. A subcommand 'ipcp' has been added for operations that take effect on IPCPs only. Fixes #12
* lib: Remove implementation specific errnosSander Vrijders2016-06-221-10/+10
| | | | | This removes any implementation specific error numbers. Only errors that are implementation independent should be returned.
* lib: Add errnos specific for OuroborosSander Vrijders2016-06-221-26/+58
| | | | | | | This adds error numbers specificly for Ouroboros. It also refactors some of the header files that are installed. Fixes #2
* lib, irmd, ipcp: robust mutexesdimitri staessens2016-06-211-71/+70
| | | | | | | | Update to POSIX 200112L to allow use of robust mutexes in the shm_du_map. Removed the implementation of the rw_lock in favor of pthread_rwlock_t. Placeholder for the shm_du_map_sanitize function.
* lib, irmd, tools, ipcpd: updates to dev API.dimitri staessens2016-06-131-118/+5
| | | | | | | | | | | | | | | The registration function has been moved to the irm tool, applications now need to be registered by an administrator. Currently only supports one instance per registered name, and an AP can be registered under only one name. The irmd can now start a registered server application on demand. For the full functionality of the tool, execute "irm register". AP name removed from flow allocation. Flow allocation does not send the source ap name as it is quite useless. The accept() call now only returns the AE name.
* lib: fixed blocking/non-blocking writedimitri staessens2016-05-261-16/+43
| | | | | non-blocking write would return when the buffer was full functions in dev now check validity of input file descripters
* lib: Fix memleaks in dev.cSander Vrijders2016-05-241-23/+30
| | | | Fixes some memleaks in dev.c in the case of error conditions.
* lib, ipcpd, irmd: fixes deallocation and fast pathdimitri staessens2016-05-221-13/+16
| | | | | | The fast path has been rewritten to have certainty to read the correct flow. Deallocation will not release port_id's or fd's until they are explicitly released locally.
* lib: removed fd cleaning functiondimitri staessens2016-05-221-27/+10
|
* lib, irmd, ipcpd: Flow deallocation over shim UDPdimitri staessens2016-05-211-0/+26
| | | | | | The shim UDP now supports deallocating a flow end-to-end. Contains some stability fixes for flow allocation and some missing close() calls in lib/sockets.
* lib, ipcpd: fixes segfaults in dev.c and shim-udpdimitri staessens2016-05-201-2/+1
|
* lib: allow parallel connectionsdimitri staessens2016-05-201-7/+10
| | | | | | dev.c: read now only reads an SDU if is is for the correct port_id shm_ap_rbuff: added a function peek() that returns the port_id of the tail.
* lib: Add missing modulo calculationSander Vrijders2016-05-161-1/+1
| | | | | | Adds a missing modulo calculation that would result in index -1 being returned instead of zero when the ringbuffer skipped back to the beginning.
* lib: dev: small locking improvementsdimitri staessens2016-05-161-28/+33
| | | | | | This avoids holding the long locks during accept() and alloc_res() calls. Small reduction of time of other locks held. No changes in locking logic.
* lib: dev.c: Revised lockingdimitri staessens2016-05-151-69/+65
| | | | | fd and flows are now all protected by the flows_lock while the overall state of the AP is protected by the data_lock.
* lib: allow accepting any flowsdimitri staessens2016-05-151-7/+7
| | | | The application can call accept(fd, NULL, NULL);
* lib: cleanup file descriptors for shared memorydimitri staessens2016-05-151-2/+9
| | | | | cleanup of file descriptors for the shared memory. also adds a missing NULL check and some invalidation in dev.c
* lib: irmd: fixed flow deallocationdimitri staessens2016-05-151-7/+10
| | | | | Port_id's weren't correctly released. Also removes remaining debug logs from the library.