home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / xcmc.h < prev    next >
C/C++ Source or Header  |  1998-04-25  |  14KB  |  382 lines

  1.   /*BEGIN CMC INTERFACE */
  2.  
  3. #ifndef _XCMC_H
  4. #define _XCMC_H
  5.  
  6. #ifdef __cplusplus
  7. extern "C" {
  8. #endif
  9.  
  10. /*BASIC DATA TYPES*/
  11. #ifndef DIFFERENT_PLATFORM
  12. typedef char                CMC_sint8;
  13. typedef short               CMC_sint16;
  14. typedef long int            CMC_sint32;
  15. typedef unsigned short int  CMC_uint16;
  16. typedef unsigned long int   CMC_uint32;
  17. typedef void far *          CMC_buffer;
  18. typedef char far *          CMC_string;
  19. #endif
  20.  
  21. typedef CMC_uint16          CMC_boolean;
  22. typedef CMC_sint32          CMC_enum;
  23. typedef CMC_uint32          CMC_return_code;
  24. typedef CMC_uint32          CMC_flags;
  25. typedef CMC_string          CMC_object_identifier;
  26.  
  27. #define CMC_FALSE   ((CMC_boolean)0)
  28. #define CMC_TRUE    ((CMC_boolean)1)
  29.  
  30. /*DATA STRUCTURES*/
  31.  
  32. /*COUNTED STRING*/
  33. typedef struct {
  34.     CMC_uint32          length;
  35.     char                string[1];
  36. } CMC_counted_string;
  37.  
  38. /*SESSION ID*/
  39. typedef CMC_uint32      CMC_session_id;
  40.  
  41. /*TIME*/
  42. /* unusedX fields needed to align struct on 4-byte boundary */
  43. typedef struct {
  44.     CMC_sint8           second;
  45.     CMC_sint8           minute;
  46.     CMC_sint8           hour;
  47.     CMC_sint8           day;
  48.     CMC_sint8           month;
  49.     CMC_sint8           year;
  50.     CMC_sint8           isdst;
  51.     CMC_sint8           unused1;
  52.     CMC_sint16          tmzone;
  53.     CMC_sint16          unused2;
  54. } CMC_time;
  55.  
  56. #define CMC_NO_TIMEZONE                     ((CMC_sint16) 0x8000)
  57.  
  58. typedef CMC_uint32          CMC_ui_id;
  59.  
  60. /*EXTENSION*/
  61. typedef struct {
  62.     CMC_uint32              item_code;
  63.     CMC_uint32              item_data;
  64.     CMC_buffer              item_reference;
  65.     CMC_flags               extension_flags;
  66. } CMC_extension;
  67.  
  68. /* EXTENSION FLAGS */
  69. #define CMC_EXT_REQUIRED                    ((CMC_flags) 0x00010000)
  70. #define CMC_EXT_OUTPUT                      ((CMC_flags) 0x00020000)
  71. #define CMC_EXT_LAST_ELEMENT                ((CMC_flags) 0x80000000)
  72. #define CMC_EXT_RSV_FLAG_MASK               ((CMC_flags) 0xFFFF0000)
  73. #define CMC_EXT_ITEM_FLAG_MASK              ((CMC_flags) 0x0000FFFF)
  74.  
  75. /*ATTACHMENT*/
  76. typedef struct {
  77.     CMC_string              attach_title;
  78.     CMC_object_identifier   attach_type;
  79.     CMC_string              attach_filename;
  80.     CMC_flags               attach_flags;
  81.     CMC_extension FAR       *attach_extensions;
  82. } CMC_attachment;
  83.  
  84. /* ATTACHMENT FLAGS */
  85. #define CMC_ATT_APP_OWNS_FILE               ((CMC_flags) 1)
  86. #define CMC_ATT_LAST_ELEMENT                ((CMC_flags) 0x80000000)
  87.  
  88. #define CMC_ATT_OID_BINARY                  "? ? ? ? ? ?"
  89. #define CMC_ATT_OID_TEXT                    "? ? ? ? ? ?"
  90.  
  91. /*MESSAGE REFERENCE*/
  92. typedef CMC_counted_string  CMC_message_reference;
  93.  
  94. /*RECIPIENT*/
  95. typedef struct {
  96.     CMC_string              name;
  97.     CMC_enum                name_type;
  98.     CMC_string              address;
  99.     CMC_enum                role;
  100.     CMC_flags               recip_flags;
  101.     CMC_extension FAR       *recip_extensions;
  102. } CMC_recipient;
  103.  
  104. /* NAME TYPES */
  105. #define CMC_TYPE_UNKNOWN                    ((CMC_enum) 0)
  106. #define CMC_TYPE_INDIVIDUAL                 ((CMC_enum) 1)
  107. #define CMC_TYPE_GROUP                      ((CMC_enum) 2)
  108.  
  109. /* ROLES */
  110. #define CMC_ROLE_TO                         ((CMC_enum) 0)
  111. #define CMC_ROLE_CC                         ((CMC_enum) 1)
  112. #define CMC_ROLE_BCC                        ((CMC_enum) 2)
  113. #define CMC_ROLE_ORIGINATOR                 ((CMC_enum) 3)
  114. #define CMC_ROLE_AUTHORIZING_USER           ((CMC_enum) 4)
  115.  
  116. /* RECIPIENT FLAGS */
  117. #define CMC_RECIP_IGNORE                    ((CMC_flags) 1)
  118. #define CMC_RECIP_LIST_TRUNCATED            ((CMC_flags) 2)
  119. #define CMC_RECIP_LAST_ELEMENT              ((CMC_flags) 0x80000000)
  120.  
  121. /*MESSAGE*/
  122. typedef struct {
  123.     CMC_message_reference FAR   *message_reference;
  124.     CMC_string              message_type;
  125.     CMC_string              subject;
  126.     CMC_time                time_sent;
  127.     CMC_string              text_note;
  128.     CMC_recipient FAR       *recipients;
  129.     CMC_attachment FAR      *attachments;
  130.     CMC_flags               message_flags;
  131.     CMC_extension FAR       *message_extensions;
  132. } CMC_message;
  133.  
  134. /* MESSAGE FLAGS */
  135. #define CMC_MSG_READ                        ((CMC_flags) 1)
  136. #define CMC_MSG_TEXT_NOTE_AS_FILE           ((CMC_flags) 2)
  137. #define CMC_MSG_UNSENT                      ((CMC_flags) 4)
  138. #define CMC_MSG_LAST_ELEMENT                ((CMC_flags) 0x80000000)
  139.  
  140. /*MESSAGE SUMMARY*/
  141. typedef struct {
  142.     CMC_message_reference FAR   *message_reference;
  143.     CMC_string              message_type;
  144.     CMC_string              subject;
  145.     CMC_time                time_sent;
  146.     CMC_uint32              byte_length;
  147.     CMC_recipient FAR       *originator;
  148.     CMC_flags               summary_flags;
  149.     CMC_extension FAR       *message_summary_extensions;
  150. } CMC_message_summary;
  151.  
  152. /* MESSAGE SUMMARY FLAGS */
  153. #define CMC_SUM_READ                        ((CMC_flags) 1)
  154. #define CMC_SUM_UNSENT                      ((CMC_flags) 2)
  155. #define CMC_SUM_LAST_ELEMENT                ((CMC_flags) 0x80000000)
  156.  
  157. /*CMC FUNCTIONS */
  158.  
  159. /*CROSS FUNCTION FLAGS */
  160. #define CMC_ERROR_UI_ALLOWED                ((CMC_flags) 0x01000000)
  161. #define CMC_LOGON_UI_ALLOWED                ((CMC_flags) 0x02000000)
  162. #define CMC_COUNTED_STRING_TYPE             ((CMC_flags) 0x04000000)
  163.  
  164. /*SEND*/
  165. CMC_return_code FAR PASCAL
  166. cmc_send(
  167.     CMC_session_id          session,
  168.     CMC_message FAR         *message,
  169.     CMC_flags               send_flags,
  170.     CMC_ui_id               ui_id,
  171.     CMC_extension FAR       *send_extensions
  172. );
  173.  
  174. #define CMC_SEND_UI_REQUESTED               ((CMC_flags) 1)
  175.  
  176. /*SEND DOCUMENT*/
  177. CMC_return_code FAR PASCAL
  178. cmc_send_documents(
  179.     CMC_string              recipient_addresses,
  180.     CMC_string              subject,
  181.     CMC_string              text_note,
  182.     CMC_flags               send_doc_flags,
  183.     CMC_string              file_paths,
  184.     CMC_string              file_names,
  185.     CMC_string              delimiter,
  186.     CMC_ui_id               ui_id
  187. );
  188.  
  189. #define CMC_FIRST_ATTACH_AS_TEXT_NOTE       ((CMC_flags) 2)
  190.  
  191. /*ACT ON*/
  192. CMC_return_code FAR PASCAL
  193. cmc_act_on(
  194.     CMC_session_id          session,
  195.     CMC_message_reference FAR   *message_reference,
  196.     CMC_enum                operation,
  197.     CMC_flags               act_on_flags,
  198.     CMC_ui_id               ui_id,
  199.     CMC_extension FAR       *act_on_extensions
  200. );
  201.  
  202. #define CMC_ACT_ON_EXTENDED                 ((CMC_enum) 0)
  203. #define CMC_ACT_ON_DELETE                   ((CMC_enum) 1)
  204.  
  205. /*LIST*/
  206. CMC_return_code FAR PASCAL
  207. cmc_list(
  208.     CMC_session_id          session,
  209.     CMC_string              message_type,
  210.     CMC_flags               list_flags,
  211.     CMC_message_reference FAR   *seed,
  212.     CMC_uint32 FAR          *count,
  213.     CMC_ui_id               ui_id,
  214.     CMC_message_summary FAR * FAR *result,
  215.     CMC_extension FAR       *list_extensions
  216. );
  217.  
  218. #define CMC_LIST_UNREAD_ONLY                ((CMC_flags) 1)
  219. #define CMC_LIST_MSG_REFS_ONLY              ((CMC_flags) 2)
  220. #define CMC_LIST_COUNT_ONLY                 ((CMC_flags) 4)
  221.  
  222. #define CMC_LENGTH_UNKNOWN          0xFFFFFFFF
  223.  
  224. /*READ*/
  225. CMC_return_code FAR PASCAL
  226. cmc_read(
  227.     CMC_session_id          session,
  228.     CMC_message_reference FAR   *message_reference,
  229.     CMC_flags               read_flags,
  230.     CMC_message FAR * FAR   *message,
  231.     CMC_ui_id               ui_id,
  232.     CMC_extension FAR       *read_extensions
  233. );
  234.  
  235. #define CMC_DO_NOT_MARK_AS_READ             ((CMC_flags) 1)
  236. #define CMC_MSG_AND_ATT_HDRS_ONLY           ((CMC_flags) 2)
  237. #define CMC_READ_FIRST_UNREAD_MESSAGE       ((CMC_flags) 4)
  238.  
  239. /*LOOK UP*/
  240. CMC_return_code FAR PASCAL
  241. cmc_look_up(
  242.     CMC_session_id          session,
  243.     CMC_recipient FAR       *recipient_in,
  244.     CMC_flags               look_up_flags,
  245.     CMC_ui_id               ui_id,
  246.     CMC_uint32 FAR          *count,
  247.     CMC_recipient FAR * FAR *recipient_out,
  248.     CMC_extension FAR       *look_up_extensions
  249. );
  250.  
  251. #define CMC_LOOKUP_RESOLVE_PREFIX_SEARCH    ((CMC_flags) 1)
  252. #define CMC_LOOKUP_RESOLVE_IDENTITY         ((CMC_flags) 2)
  253. #define CMC_LOOKUP_RESOLVE_UI               ((CMC_flags) 4)
  254. #define CMC_LOOKUP_DETAILS_UI               ((CMC_flags) 8)
  255. #define CMC_LOOKUP_ADDRESSING_UI            ((CMC_flags) 16)
  256.  
  257. /*FREE*/
  258. CMC_return_code FAR PASCAL
  259. cmc_free(
  260.     CMC_buffer              memory
  261. );
  262.  
  263. /* LOGOFF */
  264. CMC_return_code FAR PASCAL
  265. cmc_logoff(
  266.     CMC_session_id          session,
  267.     CMC_ui_id               ui_id,
  268.     CMC_flags               logoff_flags,
  269.     CMC_extension FAR       *logoff_extensions
  270. );
  271.  
  272. #define CMC_LOGOFF_UI_ALLOWED               ((CMC_flags) 1)
  273.  
  274. /* LOGON */
  275. CMC_return_code FAR PASCAL
  276. cmc_logon(
  277.     CMC_string              service,
  278.     CMC_string              user,
  279.     CMC_string              password,
  280.     CMC_object_identifier   character_set,
  281.     CMC_ui_id               ui_id,
  282.     CMC_uint16              caller_cmc_version,
  283.     CMC_flags               logon_flags,
  284.     CMC_session_id FAR      *session,
  285.     CMC_extension FAR       *logon_extensions
  286. );
  287.  
  288. #define CMC_VERSION         ((CMC_uint16) 100)
  289.  
  290. /* QUERY CONFIGURATION */
  291. CMC_return_code FAR PASCAL
  292. cmc_query_configuration(
  293.     CMC_session_id          session,
  294.     CMC_enum                item,
  295.     CMC_buffer              reference,
  296.     CMC_extension FAR       *config_extensions
  297. );
  298.  
  299. /*QUERY CONFIGURATION ENUMS */
  300. #define CMC_CONFIG_CHARACTER_SET            ((CMC_enum) 1)
  301. #define CMC_CONFIG_LINE_TERM                ((CMC_enum) 2)
  302. #define CMC_CONFIG_DEFAULT_SERVICE          ((CMC_enum) 3)
  303. #define CMC_CONFIG_DEFAULT_USER             ((CMC_enum) 4)
  304. #define CMC_CONFIG_REQ_PASSWORD             ((CMC_enum) 5)
  305. #define CMC_CONFIG_REQ_SERVICE              ((CMC_enum) 6)
  306. #define CMC_CONFIG_REQ_USER                 ((CMC_enum) 7)
  307. #define CMC_CONFIG_UI_AVAIL                 ((CMC_enum) 8)
  308. #define CMC_CONFIG_SUP_NOMKMSGREAD          ((CMC_enum) 9)
  309. #define CMC_CONFIG_SUP_COUNTED_STR          ((CMC_enum) 10)
  310. #define CMC_CONFIG_VER_IMPLEM               ((CMC_enum) 11)
  311. #define CMC_CONFIG_VER_SPEC                 ((CMC_enum) 12)
  312.  
  313. /* CONFIG LINE TERM ENUM */
  314. #define CMC_LINE_TERM_CRLF                  ((CMC_enum) 0)
  315. #define CMC_LINE_TERM_CR                    ((CMC_enum) 1)
  316. #define CMC_LINE_TERM_LF                    ((CMC_enum) 2)
  317.  
  318. /* CONFIG REQUIRED LOGON PARAMETER ENUM */
  319. #define CMC_REQUIRED_NO                     ((CMC_enum) 0)
  320. #define CMC_REQUIRED_YES                    ((CMC_enum) 1)
  321. #define CMC_REQUIRED_OPT                    ((CMC_enum) 2)
  322.  
  323. /* DEFINED OBJECT ID'S FOR CHARACTER SETS */
  324. #define CMC_CHAR_CP437                      "1 2 840 113556 3 2 437"
  325. #define CMC_CHAR_CP850                      "1 2 840 113556 3 2 850"
  326. #define CMC_CHAR_CP1252                     "1 2 840 113556 3 2 1252"
  327. #define CMC_CHAR_ISTRING                    "1 2 840 113556 3 2 0"
  328. #define CMC_CHAR_UNICODE                    "1 2 840 113556 3 2 1"
  329.  
  330. /* RETURN CODE FLAGS */
  331. #define CMC_ERROR_DISPLAYED                 ((CMC_return_code) 0x00008000)
  332. #define CMC_ERROR_RSV_MASK                  ((CMC_return_code) 0x0000FFFF)
  333. #define CMC_ERROR_IMPL_MASK                 ((CMC_return_code) 0xFFFF0000)
  334.  
  335. /* RETURN CODES */
  336. #define CMC_SUCCESS                         ((CMC_return_code) 0)
  337.  
  338. #define CMC_E_AMBIGUOUS_RECIPIENT           ((CMC_return_code) 1)
  339. #define CMC_E_ATTACHMENT_NOT_FOUND          ((CMC_return_code) 2)
  340. #define CMC_E_ATTACHMENT_OPEN_FAILURE       ((CMC_return_code) 3)
  341. #define CMC_E_ATTACHMENT_READ_FAILURE       ((CMC_return_code) 4)
  342. #define CMC_E_ATTACHMENT_WRITE_FAILURE      ((CMC_return_code) 5)
  343. #define CMC_E_COUNTED_STRING_UNSUPPORTED    ((CMC_return_code) 6)
  344. #define CMC_E_DISK_FULL                     ((CMC_return_code) 7)
  345. #define CMC_E_FAILURE                       ((CMC_return_code) 8)
  346. #define CMC_E_INSUFFICIENT_MEMORY           ((CMC_return_code) 9)
  347. #define CMC_E_INVALID_CONFIGURATION         ((CMC_return_code) 10)
  348. #define CMC_E_INVALID_ENUM                  ((CMC_return_code) 11)
  349. #define CMC_E_INVALID_FLAG                  ((CMC_return_code) 12)
  350. #define CMC_E_INVALID_MEMORY                ((CMC_return_code) 13)
  351. #define CMC_E_INVALID_MESSAGE_PARAMETER     ((CMC_return_code) 14)
  352. #define CMC_E_INVALID_MESSAGE_REFERENCE     ((CMC_return_code) 15)
  353. #define CMC_E_INVALID_PARAMETER             ((CMC_return_code) 16)
  354. #define CMC_E_INVALID_SESSION_ID            ((CMC_return_code) 17)
  355. #define CMC_E_INVALID_UI_ID                 ((CMC_return_code) 18)
  356. #define CMC_E_LOGON_FAILURE                 ((CMC_return_code) 19)
  357. #define CMC_E_MESSAGE_IN_USE                ((CMC_return_code) 20)
  358. #define CMC_E_NOT_SUPPORTED                 ((CMC_return_code) 21)
  359. #define CMC_E_PASSWORD_REQUIRED             ((CMC_return_code) 22)
  360. #define CMC_E_RECIPIENT_NOT_FOUND           ((CMC_return_code) 23)
  361. #define CMC_E_SERVICE_UNAVAILABLE           ((CMC_return_code) 24)
  362. #define CMC_E_TEXT_TOO_LARGE                ((CMC_return_code) 25)
  363. #define CMC_E_TOO_MANY_FILES                ((CMC_return_code) 26)
  364. #define CMC_E_TOO_MANY_RECIPIENTS           ((CMC_return_code) 27)
  365. #define CMC_E_UNABLE_TO_NOT_MARK_AS_READ    ((CMC_return_code) 28)
  366. #define CMC_E_UNRECOGNIZED_MESSAGE_TYPE     ((CMC_return_code) 29)
  367. #define CMC_E_UNSUPPORTED_ACTION            ((CMC_return_code) 30)
  368. #define CMC_E_UNSUPPORTED_CHARACTER_SET     ((CMC_return_code) 31)
  369. #define CMC_E_UNSUPPORTED_DATA_EXT          ((CMC_return_code) 32)
  370. #define CMC_E_UNSUPPORTED_FLAG              ((CMC_return_code) 33)
  371. #define CMC_E_UNSUPPORTED_FUNCTION_EXT      ((CMC_return_code) 34)
  372. #define CMC_E_UNSUPPORTED_VERSION           ((CMC_return_code) 35)
  373. #define CMC_E_USER_CANCEL                   ((CMC_return_code) 36)
  374. #define CMC_E_USER_NOT_LOGGED_ON            ((CMC_return_code) 37)
  375.  
  376. #ifdef __cplusplus
  377. }       /* extern "C" */
  378. #endif
  379.  
  380. #endif  /* _XCMC_H */
  381.  
  382.