et_private.h

Go to the documentation of this file.
00001 /*----------------------------------------------------------------------------*
00002  *  Copyright (c) 1998        Southeastern Universities Research Association, *
00003  *                            Thomas Jefferson National Accelerator Facility  *
00004  *                                                                            *
00005  *    This software was developed under a United States Government license    *
00006  *    described in the NOTICE file included as part of this distribution.     *
00007  *                                                                            *
00008  *    Author:  Carl Timmer                                                    *
00009  *             timmer@jlab.org                   Jefferson Lab, MS-12H        *
00010  *             Phone: (757) 269-5130             12000 Jefferson Ave.         *
00011  *             Fax:   (757) 269-5800             Newport News, VA 23606       *
00012  *                                                                            *
00013  *----------------------------------------------------------------------------*
00014  *
00015  * Description:
00016  *      Header file for ET system
00017  *
00018  *----------------------------------------------------------------------------*/
00019 
00020 #ifndef __et_private_h
00021 #define __et_private_h
00022 
00023 #if  !(defined VXWORKS || defined sun)
00024 #include <stdint.h>
00025 #endif
00026 
00027 #include <stdlib.h>
00028 #include <stdarg.h>
00029 #include <stddef.h>
00030 #include <limits.h>
00031 #include <pthread.h>
00032 
00033 #include "etCommonNetwork.h"
00034 
00035 #ifdef __cplusplus
00036 extern "C" {
00037 #endif
00038 
00039 /* The data-type model for this architecture is set
00040  * by solaris to _LP64 or _ILP32. Linux defines 
00041  * __WORDSIZE to be 64 or 32. vxworks seems to do
00042  * nothing so define that as ILP32.
00043  */
00044 #ifdef linux
00045   #if __WORDSIZE == 64
00046     #define _LP64 1
00047   #else
00048     #define _ILP32 1
00049   #endif
00050 #elif defined VXWORKS
00051   #define _ILP32 1
00052 #endif
00053 
00054 #define ET_VERSION 15           
00055 #define ET_VERSION_MINOR 1      
00057 #define ET_LANG_C     0         
00058 #define ET_LANG_CPP   1         
00059 #define ET_LANG_JAVA  2         
00061 #define ET_SYSTEM_TYPE_C     1  
00062 #define ET_SYSTEM_TYPE_JAVA  2  
00064 #define ET_IPADDRSTRLEN 16      
00067 #define ET_MAXHOSTNAMELEN 256
00068 
00070 #define ET_MAXADDRESSES 10
00071 
00072 /* ***************************************
00073  * times for heart beating & monitoring *
00074  * ***************************************/
00075 /* 1.6 sec */
00076 #define ET_MON_SEC    1             
00077 #define ET_MON_NSEC   600000000     
00078 /* 0.5 sec */
00079 #define ET_BEAT_SEC   0             
00080 #define ET_BEAT_NSEC  500000000     
00083 #define ET_HBMODULO UINT_MAX
00084 
00086 #define ET_EXTRA_THREADS 2
00087 
00088 /*
00089  * Maximum # of user attachments/processes on the system.
00090  * This is used only to allocate space in the system structure
00091  * for attachment/process housekeeping. The actual maximum #s of
00092  * attachments & processes are passed in a et_sys_config structure
00093  * to et_system_start.
00094  *
00095  * The number of attachments is the number of "et_station_attach"
00096  * calls successfully returned - each providing an access to events
00097  * from a certain station. A unix process may make several attachments
00098  * to one or more stations on one or more ET systems.
00099  *
00100  * The number of processes is just the number of "et_open" calls
00101  * successfully returned on the same host as the ET system. The
00102  * system must be one which can allow many processes to share the
00103  * ET mutexes, thus allowing full access to the shared memory. On
00104  * Linux this is not possible, meaning that the local user does NOT
00105  * have the proper access to the shared memory.
00106  * 
00107  * Since a unix process may only call et_open once, as things now stand,
00108  * the number of processes is a count of the number of unix processes
00109  * on Solaris opened locally.
00110  */
00111 #define ET_ATTACHMENTS_MAX 100                 
00112 #define ET_PROCESSES_MAX   ET_ATTACHMENTS_MAX  
00114 /* status of an attachment to an ET system */
00115 #define ET_ATT_UNUSED 0         
00116 #define ET_ATT_ACTIVE 1         
00118 /* values to tell attachment to return prematurely from ET routine */
00119 #define ET_ATT_CONTINUE 0       
00120 #define ET_ATT_QUIT     1       
00122 /* values telling whether an attachment is blocked in a read or not */
00123 #define ET_ATT_UNBLOCKED 0      
00124 #define ET_ATT_BLOCKED   1      
00126 /* values telling whether an attachment is in simulated sleep mode or not */
00127 #define ET_ATT_NOSLEEP 0        
00128 #define ET_ATT_SLEEP   1        
00130 /* status of a process in regards to an ET system */
00131 #define ET_PROC_CLOSED 0        
00132 #define ET_PROC_OPEN   1        
00134 /* what a process thinks of its ET system's status */
00135 #define ET_PROC_ETDEAD 0        
00136 #define ET_PROC_ETOK   1        
00138 /* certain structures need to be initialized before use */
00139 #define ET_STRUCT_NEW 0         
00140 #define ET_STRUCT_OK  1         
00142 /* values to tell thread to self-destruct or to stick around */
00143 #define ET_THREAD_KEEP 0        
00144 #define ET_THREAD_KILL 1        
00146 /* tells if operating sys can share pthread mutexes between processes */
00147 #define ET_MUTEX_SHARE   0      
00148 #define ET_MUTEX_NOSHARE 1      
00150 /* is pthread mutex locked or not */
00151 #define ET_MUTEX_UNLOCKED 0    
00152 #define ET_MUTEX_LOCKED   1    
00157 #define ET_INITIAL_SHARED_MEM_DATA_BYTES 64
00158 
00159 
00160 /*
00161  * STRUCTURES for the STATIONs:
00162  * --------------------------
00163  *  structures          purpose
00164  * ____________        ________________
00165  *  et_stat_config      station behavior parameters
00166  *  et_stat_data        station information
00167  *  et_event            single event
00168  *  et_list             list of events
00169  *  et_station          processes can "attach" to station
00170  *                      to get and put events
00171  */
00172 
00173 
00175 typedef int (*ET_SELECT_FUNCPTR) (void *, et_stat_id, et_event *);
00176 
00177 
00179 typedef struct et_stat_config_t {
00180   int  init;           
00182   int  flow_mode;      
00185   int  user_mode;      
00187   int  restore_mode;   
00193   int  block_mode;     
00196   int  prescale;       
00198   int  cue;            
00199   int  select_mode;    
00208   int  select[ET_STATION_SELECT_INTS]; 
00209   char fname[ET_FUNCNAME_LENGTH];      
00210   char lib[ET_FILENAME_LENGTH];        
00212   char classs[ET_FILENAME_LENGTH];     
00214 } et_stat_config;
00215 
00216 
00218 typedef struct et_stat_data_t {
00219   int   status;                    
00224   int   pid_create;                
00225   int   nattachments;              
00226   int   att[ET_ATTACHMENTS_MAX];   
00228   void *lib_handle;                
00229   ET_SELECT_FUNCPTR func;          
00230 } et_stat_data;
00231 
00232 
00234 typedef struct et_list_t {
00235   int              cnt;          
00236   int              lasthigh;     
00237   uint64_t         events_try;   
00238   uint64_t         events_in;    
00239   uint64_t         events_out;   
00240   et_event        *firstevent;   
00241   et_event        *lastevent;    
00242   pthread_mutex_t  mutex;        
00243   pthread_cond_t   cread;        
00244 } et_list;
00245 
00246 
00247 #define ET_FIX_READ 0  
00248 #define ET_FIX_DUMP 1  
00251 struct et_fixin {
00252   et_event   *first;       
00253   uint64_t    eventsin;    
00254   int         start;       
00255   int         cnt;         
00256   int         num;         
00257   int         call;        
00259 };
00260 
00261 
00263 struct et_fixout {
00264     int         start;       
00265     int         cnt;         
00266     int         num;         
00267 };
00268 
00269 
00271 struct et_fix {
00272   struct et_fixin  in;  
00273   struct et_fixout out; 
00274 };
00275 
00276 
00278 typedef struct et_station_t {
00279   et_stat_id            num;              
00281   int                   conductor;        
00283   et_stat_id            next;             
00287   et_stat_id            prev;             
00289   et_stat_id            nextparallel;     
00292   et_stat_id            prevparallel;     
00295   int                   waslast;          
00298   char                  name[ET_STATNAME_LENGTH];  
00299   pthread_mutex_t       mutex;            
00301   struct et_fix         fix;              
00302   et_stat_data          data;             
00303   et_stat_config        config;           
00304   et_list               list_in;          
00305   et_list               list_out;         
00306 } et_station;
00307 
00308 
00310 struct et_proc {
00311   et_proc_id    num;                      
00312   et_att_id     att[ET_ATTACHMENTS_MAX];  
00314   int           nattachments;             
00315   int           status;                   
00317   int           et_status;                
00319   unsigned int  heartbeat;                
00320   pid_t         pid;                      
00321   pthread_t     hbeat_thd_id;             
00322   pthread_t     hmon_thd_id;              
00323 };
00324 
00325 
00327 struct et_attach {
00328   et_att_id   num;          
00329   et_proc_id  proc;         
00330   et_stat_id  stat;         
00331   int         status;       
00332   int         blocked;      
00333   int         quit;         
00335   int         sleep;        
00339   uint64_t    events_put;   
00340   uint64_t    events_get;   
00341   uint64_t    events_dump;  
00342   uint64_t    events_make;  
00343   pid_t       pid;          
00344   char        host[ET_MAXHOSTNAMELEN];      
00345   char        interface[ET_IPADDRSTRLEN];   
00346 };
00347 
00348 
00350 typedef struct  et_sys_config_t {
00351   uint64_t          event_size;       
00352   int               init;             
00353   int               nevents;          
00354   int               ntemps;           
00355   int               nstations;        
00356   int               nprocesses;       
00357   int               nattachments;     
00358   int               groupCount;       
00359   int               groups[ET_EVENT_GROUPS_MAX];  
00362   char              filename[ET_FILENAME_LENGTH]; 
00364   /* for remote use */
00365   int               port;             
00366   int               serverport;       
00367   int               tcpSendBufSize;   
00368   int               tcpRecvBufSize;   
00369   int               tcpNoDelay;       
00370   codaNetInfo       netinfo;          
00371   codaDotDecIpAddrs bcastaddrs;       
00372   codaDotDecIpAddrs mcastaddrs;       
00373 } et_sys_config;
00374 
00375 
00376 /* Macros to handle the bitInfo word in et_system structure following. */
00377 #define ET_BIT64_MASK 0x1  
00379 #define ET_KILL_MASK  0x2  
00381 #define ET_GET_BIT64(x)  ((x) & ET_BIT64_MASK)  
00383 #define ET_GET_KILL(x)   ((x) & ET_KILL_MASK)   
00385 #define ET_SET_BIT64(x)  ((x) | ET_BIT64_MASK)  
00387 #define ET_SET_KILL(x)   ((x) | ET_KILL_MASK)   
00392 typedef struct et_system_t {
00393   int              version;        
00394   int              nselects;       
00395   int              bitInfo;        
00397   int              asthread;       
00398   unsigned int     heartbeat;      
00399   int              hz;             
00400   int              nstations;      
00401   int              ntemps;         
00402   int              nprocesses;     
00403   int              nattachments;   
00404   int              port;           
00405   et_stat_id       stat_head;      
00408   et_stat_id       stat_tail;      
00411   pid_t            mainpid;        
00412 #ifdef sun
00413   int              con_add;        
00414 #endif
00415   void            *pmap;           
00417   pthread_mutex_t  mutex;          
00418   pthread_mutex_t  stat_mutex;     
00419   pthread_mutex_t  statadd_mutex;  
00420   pthread_cond_t   statadd;        
00421   pthread_cond_t   statdone;       
00422   pthread_t        tid_hb;         
00423   pthread_t        tid_hm;         
00424   pthread_t        tid_as;         
00425   pthread_t        tid_srv;        
00426   pthread_t        tid_mul;        
00427   char             host[ET_MAXHOSTNAMELEN];     
00428   struct et_proc   proc[ET_PROCESSES_MAX];      
00429   struct et_attach attach[ET_ATTACHMENTS_MAX];  
00430   et_sys_config    config;        
00431 } et_system;
00432 
00433 
00435 typedef struct et_open_config_t {
00436     int             init;            
00437     int             wait;            
00439     int             cast;            
00446     int             ttl;             
00447     int             mode;            
00450     int             debug_default;   
00453     int             udpport;         
00454     int             multiport;       
00455     int             serverport;      
00456     int             policy;          
00461     int             tcpSendBufSize;  
00462     int             tcpRecvBufSize;  
00463     int             tcpNoDelay;      
00464     struct timespec timeout;         
00465     char            host[ET_MAXHOSTNAMELEN];    
00470     char            interface[ET_IPADDRSTRLEN]; 
00471     codaIpAddr       *netinfo;       
00472     codaIpList       *bcastaddrs;    
00473     codaDotDecIpAddrs mcastaddrs;    
00474 } et_open_config;
00475 
00476 
00481 typedef struct  et_id_t {
00482     int              init;          
00483     int              lang;          
00485     int              alive;         
00486     int              closed;        
00487     int              bit64;         
00488     et_proc_id       proc;          
00492     int              race;          
00493     int              cleanup;       
00499     int              debug;         
00502     int              nevents;       
00503     int              group;         
00504     int              version;       
00505     int              nselects;      
00506     int              share;         
00509     size_t           memsize;       
00511     uint64_t         esize;         
00512     ptrdiff_t        offset;        
00515     /* for REMOTE use */
00516     int              locality;      
00519     int              sockfd;        
00520     int              endian;        
00521     int              systemendian;  
00522     int              iov_max;       
00524     int              port;          
00525     char             ethost[ET_MAXHOSTNAMELEN];  
00526     /******************/
00527 
00528     void            *pmap;          
00529     et_system       *sys;           
00530     et_station      *stats;         
00531     int             *histogram;     
00532     et_event        *events;        
00533     char            *data;          
00534     et_station      *grandcentral;  
00535     pthread_mutex_t  mutex;         
00536 #ifndef NO_RW_LOCK
00537     pthread_rwlock_t sharedMemlock; 
00539 #endif
00540 } et_id;
00541 
00542 
00544 typedef struct  et_mem_t {
00545     uint32_t  byteOrder;       
00546     uint32_t  systemType;      
00549     uint32_t  majorVersion;    
00550     uint32_t  minorVersion;    
00551     uint32_t  numSelectInts;   
00552     uint32_t  headerByteSize;  
00554     uint64_t  eventByteSize;   
00555     uint64_t  headerPosition;  
00556     uint64_t  dataPosition;    
00557     uint64_t  totalSize;       
00558     uint64_t  usedSize;        
00559 } et_mem;
00560 
00561 
00563 typedef struct et_response_t {
00564     int   port;                     
00565     int   castType;                 
00566     int   addrCount;                
00567     char  uname[ET_MAXHOSTNAMELEN]; 
00568     char  canon[ET_MAXHOSTNAMELEN]; 
00569     char  castIP[ET_IPADDRSTRLEN];  
00570     uint32_t *addrs;                
00571     char  **ipaddrs;                
00572     char  **bcastaddrs;             
00573     struct et_response_t *next;     
00574 } et_response;
00575 
00576 
00577 /****************************
00578  *       REMOTE STUFF       *
00579  ****************************/
00580 
00581 /* "table" of values representing ET commands for tcp/ip */
00582 
00583 /* for operating systems that cannot share mutexes (Linux) */
00584 #define  ET_NET_EV_GET_L        0        
00585 #define  ET_NET_EVS_GET_L       1        
00586 #define  ET_NET_EV_PUT_L        2        
00587 #define  ET_NET_EVS_PUT_L       3        
00588 #define  ET_NET_EV_NEW_L        4        
00589 #define  ET_NET_EVS_NEW_L       5        
00590 #define  ET_NET_EV_DUMP_L       6        
00591 #define  ET_NET_EVS_DUMP_L      7        
00592 #define  ET_NET_EVS_NEW_GRP_L   8        
00594 /* for fully remote systems */
00595 #define  ET_NET_EV_GET         20        
00596 #define  ET_NET_EVS_GET        21        
00597 #define  ET_NET_EV_PUT         22        
00598 #define  ET_NET_EVS_PUT        23        
00599 #define  ET_NET_EV_NEW         24        
00600 #define  ET_NET_EVS_NEW        25        
00601 #define  ET_NET_EV_DUMP        26        
00602 #define  ET_NET_EVS_DUMP       27        
00603 #define  ET_NET_EVS_NEW_GRP    28        
00605 #define  ET_NET_EVS_NEW_GRP_JAVA 29
00606       
00607 #define  ET_NET_ALIVE          40        
00608 #define  ET_NET_WAIT           41        
00609 #define  ET_NET_CLOSE          42        
00610 #define  ET_NET_FCLOSE         43        
00611 #define  ET_NET_WAKE_ATT       44        
00612 #define  ET_NET_WAKE_ALL       45        
00613 #define  ET_NET_KILL           46        
00615 #define  ET_NET_STAT_ATT       60        
00616 #define  ET_NET_STAT_DET       61        
00617 #define  ET_NET_STAT_CRAT      62        
00618 #define  ET_NET_STAT_RM        63        
00619 #define  ET_NET_STAT_SPOS      64        
00620 #define  ET_NET_STAT_GPOS      65        
00622 #define  ET_NET_STAT_ISAT      80        
00623 #define  ET_NET_STAT_EX        81        
00624 #define  ET_NET_STAT_SSW       82        
00625 #define  ET_NET_STAT_GSW       83        
00626 #define  ET_NET_STAT_LIB       84        
00627 #define  ET_NET_STAT_FUNC      85        
00628 #define  ET_NET_STAT_CLASS     86        
00630 #define  ET_NET_STAT_GATTS    100        
00631 #define  ET_NET_STAT_STATUS   101        
00632 #define  ET_NET_STAT_INCNT    102        
00633 #define  ET_NET_STAT_OUTCNT   103        
00634 #define  ET_NET_STAT_GBLOCK   104        
00635 #define  ET_NET_STAT_GUSER    105        
00636 #define  ET_NET_STAT_GRESTORE 106        
00637 #define  ET_NET_STAT_GPRE     107        
00638 #define  ET_NET_STAT_GCUE     108        
00639 #define  ET_NET_STAT_GSELECT  109        
00641 #define  ET_NET_STAT_SBLOCK   115        
00642 #define  ET_NET_STAT_SUSER    116        
00643 #define  ET_NET_STAT_SRESTORE 117        
00644 #define  ET_NET_STAT_SPRE     118        
00645 #define  ET_NET_STAT_SCUE     119        
00647 #define  ET_NET_ATT_PUT       130        
00648 #define  ET_NET_ATT_GET       131        
00649 #define  ET_NET_ATT_DUMP      132        
00650 #define  ET_NET_ATT_MAKE      133        
00652 #define  ET_NET_SYS_TMP       150        
00653 #define  ET_NET_SYS_TMPMAX    151        
00654 #define  ET_NET_SYS_STAT      152        
00655 #define  ET_NET_SYS_STATMAX   153        
00656 #define  ET_NET_SYS_PROC      154        
00657 #define  ET_NET_SYS_PROCMAX   155        
00658 #define  ET_NET_SYS_ATT       156        
00659 #define  ET_NET_SYS_ATTMAX    157        
00660 #define  ET_NET_SYS_HBEAT     158        
00661 #define  ET_NET_SYS_PID       159        
00662 #define  ET_NET_SYS_GRP       160        
00664 #define  ET_NET_SYS_DATA      170        
00665 #define  ET_NET_SYS_HIST      171        
00666 #define  ET_NET_SYS_GRPS      172        
00670 typedef struct et_netthread_t {
00671     int   cast;                     
00672     et_id *id;                      
00673     et_sys_config *config;          
00674     char *listenaddr;               
00675     char uname[ET_MAXHOSTNAMELEN];  
00676 } et_netthread;
00677 
00678 
00679 /****************************
00680  *       BRIDGE STUFF       *
00681  ****************************/
00682  
00687 typedef struct et_bridge_config_t {
00688     int             init;          
00689     int             mode_from;     
00691     int             mode_to;       
00693     int             chunk_from;    
00694     int             chunk_to;      
00695     struct timespec timeout_from;  
00696     struct timespec timeout_to;    
00697     ET_SWAP_FUNCPTR func;          
00699 } et_bridge_config;
00700 
00701 
00702 /****************************
00703  *    END BRIDGE STUFF      *
00704  ****************************/
00705 
00707 #define ET_P2EVENT(etid, place) ((et_event *)((et_event *)(etid->events) + (place)))
00708 
00709 /* Macros to switch ptrs from ET space to user space & vice versa. */
00710 
00712 #define ET_PEVENT2USR(p, offset) ((et_event *)((char *)(p) + (offset)))
00713 
00714 #define ET_PEVENT2ET(p, offset)  ((et_event *)((char *)(p) - (offset)))
00715 
00717 #define ET_PSTAT2USR(p, offset)  ((et_station *)((char *)(p) + (offset)))
00718 
00719 #define ET_PSTAT2ET(p, offset)   ((et_station *)((char *)(p) - (offset)))
00720 
00722 #define ET_PDATA2USR(p, offset)  ((void *)((char *)(p) + (offset)))
00723 
00724 #define ET_PDATA2ET(p, offset)   ((void *)((char *)(p) - (offset)))
00725 
00726 /* Macros to break a 64 int into 2, 32 bit ints & the reverse. */
00727 
00730 #define ET_64BIT_UINT(hi,lo)       (((uint64_t)(hi) << 32) | ((uint64_t)(lo) & 0x00000000FFFFFFFF))
00731 
00734 #define ET_64BIT_INT(hi,lo)         (((int64_t)(hi) << 32) | ((int64_t)(lo)  & 0x00000000FFFFFFFF))
00735 
00738 #define ET_64BIT_P(hi,lo) ((void *)(((uint64_t)(hi) << 32) | ((uint64_t)(lo) & 0x00000000FFFFFFFF)))
00739 
00741 #define ET_HIGHINT(i)         ((uint32_t)(((uint64_t)(i) >> 32) & 0x00000000FFFFFFFF))
00742 
00744 #define ET_LOWINT(i)           ((uint32_t)((uint64_t)(i) & 0x00000000FFFFFFFF))
00745 
00746 /***********************/
00747 /* Extern declarations */
00748 /***********************/
00749 
00750 /* mutex related */
00751 extern void et_station_lock(et_system *sys);
00752 extern void et_station_unlock(et_system *sys);
00753 
00754 extern void et_llist_lock(et_list *pl);
00755 extern void et_llist_unlock(et_list *pl);
00756 
00757 extern void et_system_lock(et_system *sys);
00758 extern void et_system_unlock(et_system *sys);
00759 
00760 extern void et_transfer_lock(et_station *ps);
00761 extern void et_transfer_unlock(et_station *ps);
00762 extern void et_transfer_lock_all(et_id *id);
00763 extern void et_transfer_unlock_all(et_id *id);
00764 
00765 extern void et_tcp_lock(et_id *id);
00766 extern void et_tcp_unlock(et_id *id);
00767 
00768 extern void et_memRead_lock(et_id *id);
00769 extern void et_memWrite_lock(et_id *id);
00770 extern void et_mem_unlock(et_id *id);
00771 
00772 extern int  et_mutex_locked(pthread_mutex_t *pmutex);
00773 
00774 extern int  et_repair_station(et_id *id, et_stat_id stat_id);
00775 extern int  et_repair_gc(et_id *id);
00776 
00777 /* initialization */
00778 extern void et_init_station(et_station *ps);
00779 extern void et_init_llist(et_list *pl);
00780 
00781 extern void et_init_event(et_event *pe);
00782 extern void et_init_event_(et_event *pe);
00783 
00784 extern void et_init_process(et_system *sys, et_proc_id id);
00785 extern void et_init_attachment(et_system *sys, et_att_id id);
00786 
00787 extern void et_init_histogram(et_id *id);
00788 extern void et_init_stats_att(et_system *sys, et_att_id id);
00789 extern void et_init_stats_allatts(et_system *sys);
00790 extern void et_init_stats_station(et_station *ps);
00791 extern void et_init_stats_allstations(et_id *id);
00792 extern void et_init_stats_all(et_id *id);
00793 
00794 extern int  et_id_init(et_sys_id* id);
00795 extern void et_id_destroy(et_sys_id id);
00796 
00797 /* read and write */
00798 extern int  et_station_write(et_id *id,  et_stat_id stat_id, et_event  *pe);
00799 extern int  et_station_nwrite(et_id *id, et_stat_id stat_id, et_event *pe[], int num);
00800 
00801 extern int  et_station_read(et_id *id,  et_stat_id stat_id, et_event **pe, 
00802                             int _mode, et_att_id att, struct timespec *time);
00803 extern int  et_station_nread(et_id *id, et_stat_id stat_id, et_event *pe[], int mode,
00804                              et_att_id att, struct timespec *time, int num, int *nread);
00805 extern int  et_station_nread_group(et_id *id, et_stat_id stat_id, et_event *pe[], int mode,
00806                  et_att_id att, struct timespec *time, int num, int group, int *nread);
00807 extern int  et_station_dump(et_id *id, et_event *pe);
00808 extern int  et_station_ndump(et_id *id, et_event *pe[], int num);
00809 
00810 extern int  et_llist_read(et_list *pl, et_event **pe);
00811 extern int  et_llist_write(et_id *id, et_list *pl, et_event **pe, int num);
00812 extern int  et_llist_write_gc(et_id *id, et_event **pe, int num);
00813 
00814 extern int  et_restore_events(et_id *id, et_att_id att, et_stat_id stat_id);
00815 extern void et_flush_events(et_id *id, et_att_id att, et_stat_id stat_id);
00816 
00817 /* mmap/memory functions */
00818 extern int   et_mem_create(const char *name, size_t memsize, void **pmemory, size_t *totalSize);
00819 extern void *et_mem_write_first_block(char *ptr,
00820                                       uint32_t headerByteSize, uint64_t eventByteSize,
00821                                       uint64_t headerPosition, uint64_t dataPosition,
00822                                       uint64_t totalByteSize,  uint64_t usedByteSize);
00823 extern int   et_mem_attach(const char *name, void **pmemory, et_mem *pInfo);
00824 extern int   et_mem_unmap(const char *name, void *pmem);
00825 extern int   et_mem_remove(const char *name, void *pmem);
00826 extern int   et_mem_size(const char *name, size_t *totalsize, size_t *usedsize);
00827 
00828 extern void *et_temp_create(const char *name, size_t size);
00829 extern void *et_temp_attach(const char *name, size_t size);
00830 extern int   et_temp_remove(const char *name, void *pmem, size_t size);
00831 
00832 /* remote routines */
00833 extern int  etr_event_new(et_sys_id id, et_att_id att, et_event **ev,
00834                 int mode, struct timespec *deltatime, size_t size);
00835 extern int  etr_events_new(et_sys_id id, et_att_id att, et_event *evs[],
00836                 int mode, struct timespec *deltatime, size_t size, int num, int *nread);
00837 extern int  etr_events_new_group(et_sys_id id, et_att_id att, et_event *evs[],
00838                    int mode, struct timespec *deltatime,
00839                    size_t size, int num, int group, int *nread);
00840 extern int  etr_event_get(et_sys_id id, et_att_id att, et_event **ev,
00841                 int wait, struct timespec *deltatime);
00842 extern int  etr_events_get(et_sys_id id, et_att_id att, et_event *evs[],
00843                 int wait, struct timespec *deltatime, int num, int *nread);
00844 extern int  etr_event_put(et_sys_id id, et_att_id att, et_event *ev);
00845 extern int  etr_events_put(et_sys_id id, et_att_id att, et_event *evs[], int num);
00846 extern int  etr_event_dump(et_sys_id id, et_att_id att, et_event *ev);
00847 extern int  etr_events_dump(et_sys_id id, et_att_id att, et_event *evs[], int num);
00848 
00849 extern int  etr_open(et_sys_id *id, const char *et_filename, et_openconfig openconfig);
00850 extern int  etr_close(et_sys_id id);
00851 extern int  etr_forcedclose(et_sys_id id);
00852 extern int  etr_kill(et_sys_id id);
00853 extern int  etr_alive(et_sys_id id);
00854 extern int  etr_wait_for_alive(et_sys_id id);
00855 extern int  etr_wakeup_attachment(et_sys_id id, et_att_id att);
00856 extern int  etr_wakeup_all(et_sys_id id, et_stat_id stat_id);
00857 
00858 extern int  etr_station_create_at(et_sys_id id, et_stat_id *stat_id,
00859                  const char *stat_name, et_statconfig sconfig,
00860                  int position, int parallelposition);
00861 extern int  etr_station_create(et_sys_id id, et_stat_id *stat_id,
00862                  const char *stat_name, et_statconfig sconfig);
00863 extern int  etr_station_remove(et_sys_id id, et_stat_id stat_id);
00864 extern int  etr_station_attach(et_sys_id id, et_stat_id stat_id, et_att_id *att);
00865 extern int  etr_station_detach(et_sys_id id, et_att_id att);
00866 extern int  etr_station_setposition(et_sys_id id, et_stat_id stat_id, int position,
00867                                     int parallelposition);
00868 extern int  etr_station_getposition(et_sys_id id, et_stat_id stat_id, int *position,
00869                                     int *parallelposition);
00870 extern int  etr_station_isattached(et_sys_id id, et_stat_id stat_id, et_att_id att);
00871 extern int  etr_station_exists(et_sys_id id, et_stat_id *stat_id, const char *stat_name);
00872 
00873 extern int  etr_station_getattachments(et_sys_id id, et_stat_id stat_id, int *numatts);
00874 extern int  etr_station_getstatus(et_sys_id id, et_stat_id stat_id, int *status);
00875 extern int  etr_station_getstatus(et_sys_id id, et_stat_id stat_id, int *status);
00876 extern int  etr_station_getinputcount(et_sys_id id, et_stat_id stat_id, int *cnt);
00877 extern int  etr_station_getoutputcount(et_sys_id id, et_stat_id stat_id, int *cnt);
00878 extern int  etr_station_getselect(et_sys_id id, et_stat_id stat_id, int *select);
00879 extern int  etr_station_getlib(et_sys_id id, et_stat_id stat_id, char *lib);
00880 extern int  etr_station_getclass(et_sys_id id, et_stat_id stat_id, char *classs);
00881 extern int  etr_station_getfunction(et_sys_id id, et_stat_id stat_id, char *function);
00882 
00883 extern int  etr_station_getblock(et_sys_id id, et_stat_id stat_id, int *block);
00884 extern int  etr_station_setblock(et_sys_id id, et_stat_id stat_id, int  block);
00885 extern int  etr_station_getuser(et_sys_id id, et_stat_id stat_id, int *user);
00886 extern int  etr_station_setuser(et_sys_id id, et_stat_id stat_id, int  user);
00887 extern int  etr_station_getrestore(et_sys_id id, et_stat_id stat_id, int *restore);
00888 extern int  etr_station_setrestore(et_sys_id id, et_stat_id stat_id, int  restore);
00889 extern int  etr_station_getprescale(et_sys_id id, et_stat_id stat_id, int *prescale);
00890 extern int  etr_station_setprescale(et_sys_id id, et_stat_id stat_id, int  prescale);
00891 extern int  etr_station_getcue(et_sys_id id, et_stat_id stat_id, int *cue);
00892 extern int  etr_station_setcue(et_sys_id id, et_stat_id stat_id, int  cue);
00893 extern int  etr_station_getselectwords(et_sys_id id, et_stat_id stat_id, int select[]);
00894 extern int  etr_station_setselectwords(et_sys_id id, et_stat_id stat_id, int select[]);
00895 
00896 extern int  etr_system_gettemps (et_sys_id id, int *temps);
00897 extern int  etr_system_gettempsmax (et_sys_id id, int *tempsmax);
00898 extern int  etr_system_getstations (et_sys_id id, int *stations);
00899 extern int  etr_system_getstationsmax (et_sys_id id, int *stationsmax);
00900 extern int  etr_system_getprocs (et_sys_id id, int *procs);
00901 extern int  etr_system_getprocsmax (et_sys_id id, int *procsmax);
00902 extern int  etr_system_getattachments (et_sys_id id, int *atts);
00903 extern int  etr_system_getattsmax (et_sys_id id, int *attsmax);
00904 extern int  etr_system_getheartbeat (et_sys_id id, int *heartbeat);
00905 extern int  etr_system_getpid (et_sys_id id, int *pid);
00906 extern int  etr_system_getgroupcount (et_sys_id id, int *groupCnt);
00907 /* end remote routines */
00908 
00909 /* attachment rountines */
00910 extern int etr_attach_geteventsput(et_sys_id id, et_att_id att_id,
00911                                    uint64_t *events);
00912 extern int etr_attach_geteventsget(et_sys_id id, et_att_id att_id,
00913                                    uint64_t *events);
00914 extern int etr_attach_geteventsdump(et_sys_id id, et_att_id att_id,
00915                                     uint64_t *events);
00916 extern int etr_attach_geteventsmake(et_sys_id id, et_att_id att_id,
00917                                     uint64_t *events);
00918 /* end of attachment routines */
00919 
00920 /* local no-share (linux) routines */
00921 extern int  etn_open(et_sys_id *id, const char *filename, et_openconfig openconfig);
00922 extern int  etn_close(et_sys_id id);
00923 extern int  etn_forcedclose(et_sys_id id);
00924 extern int  etn_kill(et_sys_id id);
00925 extern int  etn_alive(et_sys_id id);
00926 extern int  etn_wait_for_alive(et_sys_id id);
00927 extern int  etn_event_new(et_sys_id id, et_att_id att, et_event **ev,
00928                  int mode, struct timespec *deltatime, size_t size);
00929 extern int  etn_events_new(et_sys_id id, et_att_id att, et_event *evs[],
00930                  int mode, struct timespec *deltatime, size_t size, int num, int *nread);
00931 extern int  etn_events_new_group(et_sys_id id, et_att_id att, et_event *evs[],
00932                  int mode, struct timespec *deltatime,
00933                  size_t size, int num, int group, int *nread);
00934 extern int  etn_event_get(et_sys_id id, et_att_id att, et_event **ev,
00935                  int mode, struct timespec *deltatime);
00936 extern int  etn_events_get(et_sys_id id, et_att_id att, et_event *evs[],
00937                  int mode, struct timespec *deltatime, int num, int *nread);
00938 extern int  etn_event_put(et_sys_id id, et_att_id att, et_event *ev);
00939 extern int  etn_events_put(et_sys_id id, et_att_id att, et_event *evs[], int num);
00940 extern int  etn_event_dump(et_sys_id id, et_att_id att, et_event *ev);
00941 extern int  etn_events_dump(et_sys_id id, et_att_id att, et_event *evs[], int num);
00942 /* end of local linux routines */
00943 
00944 /* local routines (Sun) */
00945 extern int  etl_open(et_sys_id *id, const char *filename, et_openconfig openconfig);
00946 extern int  etl_close(et_sys_id id);
00947 extern int  etl_forcedclose(et_sys_id id);
00948 extern int  etl_kill(et_sys_id id);
00949 extern int  etl_alive(et_sys_id id);
00950 extern int  etl_wait_for_alive(et_sys_id id);
00951 extern int  et_wait_for_system(et_sys_id id, struct timespec *timeout,
00952                                 const char *etname);
00953 extern int  et_look(et_sys_id *id, const char *filename);
00954 extern int  et_unlook(et_sys_id id);
00955 /* end local routines */
00956 
00957 /* server/network routines */
00958 extern void *et_cast_thread(void *arg);
00959 extern void *et_netserver(void *arg);
00960 extern int   et_findserver(const char *etname, char *ethost, int *port,
00961                            uint32_t *inetaddr, et_open_config *config, et_response **allETinfo);
00962 extern int   et_responds(const char *etname);
00963 extern int   et_sharedmutex(void);
00964 extern int   et_findlocality(const char *filename, et_openconfig openconfig);
00965 /* end server/network routines */
00966  
00967 /* station configuration checks */
00968 extern int  et_station_config_check(et_id *id, et_stat_config *sc);
00969 extern int  et_station_compare_parallel(et_id *id, et_stat_config *group,
00970             et_stat_config *config);
00971 /* end station configuration checks */
00972 
00973 /* error logging */
00974 extern void et_logmsg (char *sev, char *fmt, ...);
00975 
00976 #ifdef __cplusplus
00977 }
00978 #endif
00979 
00980 #endif

Generated on 30 Jul 2015 for ET System by  doxygen 1.6.1