seismix/developers/api/shm

dae shm api

/ A dae client makes a request to dae-core to export or import a particular shm seg by name and dae-core takes care of the rest. This enables multiples shm segs per client app and per dae-core on a session/setup basis. /

struct _dae_shm { int (shm_notify_callback)(short int _notify_level,int _seg_id,char _name,int _pages,int _rw,int _status); };

// client app calls: // -----------------

/ Initialise dae-shm in client app. / void dae_init_shm();

/ Request shm export of a named segment. Actual memory size is in page multiples of os system (4096 generally). _rw is either "DAE_SHM_R" or "DAE_SHM_RW", the first being read only and the 2nd allowing writing by importing apps. / int dae_shm_connect_export(char *,int,int);

/ Request shm import of a named segment. Actual memory size is defined by app exporting the shm seg. A shm seg has to be exported first before being imported (this will change soon to allow early requests!) _rw is either "DAE_SHM_R" or "DAE_SHM_RW", but if the exporting app has defined DAE_SHM_R, then a DAE_SHM_RW request will only return DAE_SHM_R. / int dae_shm_connect_import(char *,int);

/ Request a disconnect of name shm seg. _inout is one of "DAE_SHM_IMPORT" or "DAE_SHM_EXPORT". This allows a client to import a shm seg it is exporting, and so must be mentioned in the disconnect request. / int dae_shm_disconnect(char *,int);

/ Request a named shm seg be resized to the new size. Can also redefine RW status. This only works if the client app is exporting the named shm seg. Importing clients automatically drop the shm (so it can be destroyed properly) and reimport them with the new size. / int dae_shm_resize_ex(char *,int,int);

/ Request dae-core return the current status of named shm seg. (this need testing properly!!) / int dae_shm_get_core_status(int,char *,int);

/* msg'ing callback function that passes notification messages back to the client app after an API call has been made.

All dae-shm client apps must have a callback function. All shm seg notification
msgs arrive here. The _notify_level is one of the entries below. The
_seg_id, _name,_pages, _rw and _status are all passed back to this function. _rw
is either "DAE_SHM_R" or "DAE_SHM_RW". A _status of 0 indicates OK otherwise an
error occurred. dae_shm_perror(char *) can be called to print out the last
dae-shm error status string. Pass a string to dae_shm_perror() and it will be
printed along with the error msg.

DAE_SHM_NOTIFY_REQ_CREATE  <seg_id> <name> <pages> <rw> <status>
DAE_SHM_NOTIFY_REQ_IMPORT  <seg_id> <name> <pages> <rw> <status>
DAE_SHM_NOTIFY_REQ_RESIZE  <seg_id> <name> <pages> <rw> <status>
DAE_SHM_NOTIFY_REQ_DROP    <seg_id> <name> 0       0    <status>
DAE_SHM_NOTIFY_REQ_DESTROY <seg_id> <name> 0       0    <status>
DAE_SHM_NOTIFY_REQ_STATUS  <seg_id> <name> <pages> <rw> <status>

/ /extern/ int app_recv_shm_notify(short int _notify_level,int _seg_id,char _name,int _pages,int _rw,int _status);