home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1997 May / PCO_5_97.ISO / FilesBBS / OS2 / OS2WWW42.ARJ / OS2WWW42 / OS2WWW42.ZIP / SYS402.R4 / INCLUDE / POWERAPI.HPP
Encoding:
C/C++ Source or Header  |  1996-05-16  |  4.8 KB  |  135 lines

  1. #ifndef    _PowerAPI_
  2. #define    _PowerAPI_
  3.  
  4.    #ifdef __cplusplus
  5.       extern "C" {
  6.    #endif
  7.  
  8. // -------------------------------------------------------------------------
  9.  
  10. #if    defined(__IBMCPP__)
  11.     #ifndef    APIENTRY
  12.         #define    APIENTRY    _System
  13.     #endif
  14. #elif    defined(__WINDOWS__)
  15.     #define    APIENTRY    __stdcall
  16. #else
  17.     #define    APIENTRY
  18. #endif
  19.  
  20. // -------------------------------------------------------------------------
  21. //    Definition of a function contained in a dynamic link library that can
  22. //    be called via a PowerWeb Server hook.
  23. //    The return value must be a member of the rcAPI enum.
  24.  
  25. enum        rcAPI
  26. {
  27.     HOOK_OK                        =    0,
  28.     HOOK_NO_ACTION,
  29.     HOOK_CALL_AGAIN,
  30.     HOOK_ERROR,
  31.     HOOK_ABORT_CONNECTION,
  32.     HOOK_ABORT_SERVER,
  33.     HOOK_NOT_FOUND,
  34.     HOOK_EXCEPTION
  35. };
  36.  
  37. typedef        long        (APIENTRY *pfnAPI)(void* parcel);
  38.  
  39. // -------------------------------------------------------------------------
  40. //    Generic C interface to PowerWeb Server.
  41. //    If pszName is 0, the operation occurs on the current atom, indicated
  42. //    by handle, else a find() is performed first, unless an Append() operation
  43. //    is being used on a list, in which case pszName defines the new atom name.
  44. //    Note that the C interface does not depend on any structure definitions -
  45. //    it is totally generic on purpose to avoid version control problems
  46. //    and to allow cross-platform independence - both at run time and at
  47. //    compile time.
  48. //    All of these calls map on to the underlying C++ equivalents.
  49.  
  50. enum        rcServer
  51. {
  52.     ERR_INTERNAL        =    -3,
  53.     ERR_MEMORY            =    -2,
  54.     ERR_BAD_ARGUMENTS    =    -1,
  55.     ERR_NONE                =    0,
  56.     ERR_NOT_FOUND,
  57.     ERR_NO_LONGER_EXISTS,
  58.     ERR_ACCESS_DENIED,
  59.     ERR_BUSY,
  60.     ERR_INVALID_TYPE,
  61.     ERR_NOT_A_LIST,
  62.     ERR_VALUE_TRUNCATED,
  63.     ERR_INCOMPATIBLE_VERSION,
  64.     ERR_BAD_NAME,
  65.     ERR_MAX
  66. };
  67.  
  68. // -------------------------------------------------------------------------
  69.  
  70. long    APIENTRY    ServerGetConfig        (void* parcel, void**    handle);
  71. long    APIENTRY    ServerGetServer        (void* parcel, void**    handle);
  72. long    APIENTRY    ServerGetConnect        (void* parcel, void**    handle);
  73. long    APIENTRY    ServerGetRequest        (void* parcel, void**    handle);
  74. long    APIENTRY    ServerGetParameters    (void* parcel, void**    handle);
  75. long    APIENTRY    ServerGetArguments    (void* parcel, void**    handle);
  76.  
  77. long    APIENTRY    ServerFind                (void* parent, const char*    pszName,    void**            item);
  78. long    APIENTRY    ServerKind                (void* handle, unsigned long*    type);
  79. long    APIENTRY    ServerSize                (void* handle, unsigned long*    size);
  80. long    APIENTRY    ServerName                (void* handle, char*            value,    unsigned long    size);
  81. long    APIENTRY    ServerFlush                (void* handle);
  82. long    APIENTRY    ServerDelete            (void* handle);
  83.  
  84. long    APIENTRY    ServerReadInteger        (void* parent, const char* pszName, long*               value);
  85. long    APIENTRY    ServerReadFloat        (void* parent, const char* pszName, double*             value);
  86. long    APIENTRY    ServerReadText            (void* parent, const char* pszName, char*               value, unsigned long size);
  87. long    APIENTRY    ServerReadBinary        (void* parent, const char* pszName, unsigned char*    value, unsigned long size);
  88. long    APIENTRY    ServerReadRaw            (void* parent, const char* pszName, void**            value);
  89.  
  90. long    APIENTRY    ServerWriteInteger    (void* parent, const char* pszName, long                       value);
  91. long    APIENTRY    ServerWriteFloat        (void* parent, const char* pszName, double                     value);
  92. long    APIENTRY    ServerWriteText        (void* parent, const char* pszName, const char*                value);
  93. long    APIENTRY    ServerWriteBinary        (void* parent, const char* pszName, const unsigned char*    value, unsigned long size);
  94.  
  95. long    APIENTRY    ServerAppendText        (void* parent, const char* pszName, const char*                value);
  96. long    APIENTRY    ServerAppendBinary    (void* parent, const char* pszName, const unsigned char*    value, unsigned long size);
  97.  
  98. long    APIENTRY    ServerNewInteger        (void* parent, const char* pszName, long                       value);
  99. long    APIENTRY    ServerNewFloat            (void* parent, const char* pszName, double                     value);
  100. long    APIENTRY    ServerNewText            (void* parent, const char* pszName, const char*                value);
  101. long    APIENTRY    ServerNewBinary        (void* parent, const char* pszName, const unsigned char*    value, unsigned long size);
  102. long    APIENTRY    ServerNewList            (void* parent, const char* pszName);
  103. long    APIENTRY    ServerNewSemaphore    (void* parent, const char* pszName);
  104.  
  105. long    APIENTRY    ServerParent            (void* here,    void**    handle);
  106. long    APIENTRY    ServerChild                (void* here,    void**    handle);
  107. long    APIENTRY    ServerSibling            (void* here,    void**    handle);
  108.  
  109. long    APIENTRY    ServerInterpret        (void* parcel, const char* script);
  110.  
  111. // -------------------------------------------------------------------------
  112. //    Definition of base object type ids, as returned by ServerKind().
  113.  
  114. enum        idObject
  115. {
  116.     TYPE_UNKNOWN        =    0,
  117.     TYPE_INTEGER,
  118.     TYPE_FLOAT,
  119.     TYPE_TEXT,
  120.     TYPE_BINARY,
  121.     TYPE_LIST,
  122.     TYPE_POINTER,
  123.     TYPE_DATETIME,
  124.     TYPE_SEMAPHORE
  125. };
  126.  
  127. // -------------------------------------------------------------------------
  128.  
  129.    #ifdef __cplusplus
  130.       }
  131.    #endif
  132.  
  133. #endif
  134.  
  135.