/******************************************************************************* *sas.h definitions to be used in conjunction with the * spectrum access server c library */ #ifndef INCsash #define INCsash #include /* for definition of CLIENT */ #define SAS_VERS 2 #ifndef OK /* define possible function returns */ #define OK 0 #define ERROR (-1) #endif /* OK */ #ifndef TRUE #define FALSE 0 #define TRUE 1 #endif /* TRUE */ #define FLAG_UNSET 0 #define FLAG_SET 1 #define BUF_SIZE 0x2000 #define DATELENGTH 20 #define MAXDIM 8 #define UNUSED (~0) /* unused offset => NULL pointer */ #define SAS_RPC_ERROR (-1) /* errno value : may decide on something else */ #define END_OF_LIST UNUSED typedef struct capabilityBuffer /* buffer big enough to hold a capability */ { char theContentsOfThisBufferShouldNotBeReferenced [8]; } CAP; typedef char DATESTRING[DATELENGTH]; typedef u_int ARRAYLIMITS[MAXDIM]; typedef struct spectrum_defn { u_int dim; DATESTRING creation; DATESTRING modification; ARRAYLIMITS base; ARRAYLIMITS range; u_int information; u_int annotation; u_int calibration; u_int efficiency; struct attribute { u_int layout; u_int type; } attr_array[2]; u_int address; } SPECTRUM; typedef struct spectrum_list { char *name; u_int type; u_int cookie; struct spectrum_list *next; } SPECLIST; typedef struct spectrum_data { u_int status; u_int offset; char *data; } SPECDATA; typedef struct write_spectrum_results { u_int status; u_int flag; } WRITESP; extern int errno; #if defined (__STDC__) || defined (__cplusplus) || defined (c_plusplus) #if defined (__cplusplus) || defined (c_plusplus) extern "C" { #endif extern int sasDefaultPort (); extern CLIENT * sasOpenClient (char *host, int port); extern void sasCloseClient (CLIENT *client); extern char * sasErrMsg (int num); extern char * sasPerror (char *string); extern char * sasVersion (); extern int sasNullProc (CLIENT *client); extern int sasAuthorise (CLIENT *client, char *username, char *password, u_int mode, CAP *capability); extern int sasCreateSpectrum (CLIENT *client, CAP *capability, char *path, SPECTRUM *spectrum); extern int sasDeleteSpectrum (CLIENT *client, CAP *capability, char *path); extern int sasLookupSpectrum (CLIENT *client, CAP *capability, char *path, SPECTRUM *spectrum); extern int sasReadString (CLIENT *client, CAP *capability, char *path, u_int stype, u_int snumber, u_int *slen, char *req_string); extern int sasWriteString (CLIENT *client, CAP *capability, char *path, u_int stype, u_int snumber, u_int slen, char *data); extern int sasReadNames (CLIENT *client, CAP *capability, char *path, u_int cookie, u_int count, SPECLIST **spnames, u_int *list_end); extern int sasReadSpectrum (CLIENT *client, CAP *capability, char *path, u_int number, u_int offset, u_int count, u_int base[8], u_int range[8], u_int size[8], u_int type, char *spectrumData, int *flag); extern int sasWriteSpectrum (CLIENT *client, CAP *capability, char *path, u_int number, u_int offset, u_int count, u_int base[8], u_int range[8], u_int type, char *data, u_int *flag); extern int sasChangeArrayOptions (CLIENT *client, CAP *capability, char *path, u_int number, u_int layout, uint type); extern int sasGenerateErrorReport (CLIENT *client, CAP *capability, char *text); extern int sasUnauthorise (CLIENT *client, CAP *capability); /* etc */ #if defined (__cplusplus) || defined (c_plusplus) } #endif #else extern int sasDefaultPort (); extern CLIENT * sasOpenClient (); extern void sasCloseClient (); extern char * sasErrMsg (); extern char * sasPerror (); extern char * sasVersion (); extern int sasNullProc (); extern int sasAuthorise (); extern int sasCreateSpectrum (); extern int sasDeleteSpectrum (); extern int sasLookupSpectrum (); extern int sasReadString (); extern int sasWriteString (); extern int sasReadNames (); extern int sasReadSpectrum (); extern int sasWriteSpectrum (); extern int sasChangeArrayOptions (); extern int sasGenerateErrorReport (); extern int sasUnauthorise (); /* etc */ #endif /* __STDC__ etc*/ #endif /* INCsash */