summaryrefslogtreecommitdiff
path: root/src/lib/dev.c
Commit message (Collapse)AuthorAgeFilesLines
...
* 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.
* lib: dev.c: added lockingdimitri staessens2016-05-141-36/+176
| | | | | Locking is required for multi-threaded applications. Flows are locked separately. Read/Write locks are used for concurrent reads.
* dev: fixed wrong bracket placementdimitri staessens2016-05-121-2/+1
|
* lib: dev: implementation of flow_cntldimitri staessens2016-05-121-9/+34
| | | | | allows setting the oflags to make flow_read and flow_write blocking or non-blocking (FLOW_O_NONBLOCK).
* ipcpd: Allow disabling of DNSSander Vrijders2016-05-101-12/+2
| | | | | | This allows someone to disable the use of DNS in the shim UDP. It also adds a config file specific for the shim UDP (which holds the nsupdate location). Certain defines were also moved to the global config file.
* irmd: introduced lockingdimitri staessens2016-05-101-0/+5
| | | | | This commit adds locking to the IRMd with a single global lock. It also fixes some issues in cleaning up the daemon.
* lib: changed port_id to intdimitri staessens2016-05-081-2/+2
| | | | | returning -1 as uint32_t leads to bugs. also changed types in GPB to sint to use zigzag encoding.
* lib/irmd/ipcpd/tools: fixes comments on eb9f443dimitri staessens2016-05-081-3/+17
|
* irmd: flow allocation and fast pathdimitri staessens2016-05-071-98/+232
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit has a first implementation of flow allocation (the "slow path") and read/write (the "fast path") for ouroboros. It provides basic but unstable communications over the shared memory. It required a lot of changes all over the stack, and fixes a number of previously undetected issues. This PR still need heavy revision regarding data model, locking and cleanup. lib/dev: modifications to the API. It now uses an ap_init() call to set the AP name and sets the Instance ID to the pid of the process. It also binds the AP to the shared memory and creates tables for mappings in the fast path. A call to ap_fini() releases the resources. lib/shm_ap_rbuff: added ring buffer for data exchange between processes in the fast path. It passes an index in the shm_du_map. lib/shm_du_map: rewrote API to work with calls from dev.c. Garbage collector added. Tests updated to new API. ipcpd/ipcp-data: removed everything related to flows, as these are universal for all ap's and kept in ap_data (dev.c), or similar structs for shim ipcps. shim-udp: added flow allocator and read/write functions and shm elements. irmd: revised data model and structures necessary for flow allocation. tools: echo updated to new dev.h API. messaging system was updated to comply with new flow allocation messages. All exchanges use pid and port_id to bootstrap the fast path.
* lib: client-side flow allocationdimitri staessens2016-04-271-2/+4
| | | | | flow allocation now propagates on the client side up to the IPCP. added UNKNOWN_AP and UNKNOWN_AE definitions to dev.h
* irmd: reg/unreg whatevercast namesdimitri staessens2016-04-221-32/+46
| | | | | | | | | | | | Unregistering ap's now works. An AP now registers/unregisters its AP-I by sending its AP name and its pid to the IRMd. The IPCPs register whatevercast names. An AP name is currently mapped on a whatevercast name represented by the same string literal. The IRMd allows registration of only one AP-I per AP. A Name Space Management system is needed in the processing system so we can resolve this completely. Changing the stack to register whatevercast names required some changes all over the ipcpd implemented and in the library.
* lib, irmd: Update communication with IRMdSander Vrijders2016-03-301-21/+57
| | | | | All messages sent to the IRMd now also get a reply back with the result of the operation.
* lib, irmd: Use GPB for dev.c and IRMdSander Vrijders2016-03-281-58/+67
| | | | | IRMd and dev.c now also use GPB instead of our own ser/des. irm_msg struct has been dropped as well as the methods associated with it.
* lib: Adds IRMd messages for the dev.h API callsSander Vrijders2016-03-241-29/+169
| | | | | | This adds several messages for the dev.h API calls to communicate with the IRM daemon. The deserializing of these messages is still missing and the irmd hasn't been updated with them either.
* tools: Simple echo applicationSander Vrijders2016-03-211-0/+104
This adds a simple echo application written to show application how to use the API. It also updates the dev.h header file with the insights gained from performing this excercise.