home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1998 November / PCO_1198.ISO / filesbbs / os2 / os2www.arj / OS2WWW.ZIP / SYS406.R8 / INCLUDE / POWERAPI.HPP
Encoding:
C/C++ Source or Header  |  1997-09-03  |  5.7 KB  |  149 lines

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