home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1998 September / PCO_0998.ISO / filesbbs / dos / sbbs_src.exe / SBBS / SMB / SMBLIB.H < prev   
Encoding:
C/C++ Source or Header  |  1997-04-26  |  6.1 KB  |  182 lines

  1. /* SMBLIB.H */
  2.  
  3. /* Developed 1990-1997 by Rob Swindell; PO Box 501, Yorba Linda, CA 92885 */
  4.  
  5. #ifndef _SMBLIB_H
  6. #define _SMBLIB_H
  7.  
  8. #if defined(__WATCOMC__) || defined(__TURBOC__)
  9. #    include <io.h>
  10. #    include <mem.h>
  11. #    include <share.h>
  12. #else
  13. #    include <memory.h>
  14. #endif
  15.  
  16. #if defined(__WATCOMC__)
  17. #    include <dos.h>
  18. #elif defined(__TURBOC__)
  19. #    include <dir.h>
  20. #endif
  21.  
  22. #if defined(__NT__)
  23. #    define SMBCALL _pascal _export
  24. #elif defined(__FLAT__)
  25. #    define SMBCALL _export
  26. #else
  27. #    define SMBCALL
  28. #endif
  29.  
  30. #include <malloc.h>
  31. #include <time.h>
  32. #include <errno.h>
  33. #include <fcntl.h>
  34. #include <stdio.h>
  35. #include <stdlib.h>
  36. #include <string.h>
  37. #include <sys/stat.h>
  38. #include <sys/types.h>
  39.  
  40. #include "smbdefs.h"
  41.  
  42. #define SMB_STACK_LEN        4            /* Max msg bases in smb_stack()     */
  43. #define SMB_STACK_POP       0           /* Pop a msg base off of smb_stack() */
  44. #define SMB_STACK_PUSH      1           /* Push a msg base onto smb_stack() */
  45. #define SMB_STACK_XCHNG     2           /* Exchange msg base w/last pushed */
  46.  
  47. #define GETMSGTXT_TAILS     1            /* Get message tail(s) too */
  48.  
  49. int     SMBCALL smb_ver(void);
  50. char *    SMBCALL smb_lib_ver(void);
  51. int     SMBCALL smb_open(smb_t *smb);
  52. void    SMBCALL smb_close(smb_t *smb);
  53. int     SMBCALL smb_open_da(smb_t *smb);
  54. void    SMBCALL smb_close_da(smb_t *smb);
  55. int     SMBCALL smb_open_ha(smb_t *smb);
  56. void    SMBCALL smb_close_ha(smb_t *smb);
  57. int     SMBCALL smb_create(smb_t *smb);
  58. int     SMBCALL smb_stack(smb_t *smb, int op);
  59. int     SMBCALL smb_trunchdr(smb_t *smb);
  60. int     SMBCALL smb_locksmbhdr(smb_t *smb);
  61. int     SMBCALL smb_getstatus(smb_t *smb);
  62. int     SMBCALL smb_putstatus(smb_t *smb);
  63. int     SMBCALL smb_unlocksmbhdr(smb_t *smb);
  64. int     SMBCALL smb_getmsgidx(smb_t *smb, smbmsg_t *msg);
  65. int     SMBCALL smb_getlastidx(smb_t *smb, idxrec_t *idx);
  66. uint    SMBCALL smb_getmsghdrlen(smbmsg_t *msg);
  67. ulong    SMBCALL smb_getmsgdatlen(smbmsg_t *msg);
  68. int     SMBCALL smb_lockmsghdr(smb_t *smb, smbmsg_t *msg);
  69. int     SMBCALL smb_getmsghdr(smb_t *smb, smbmsg_t *msg);
  70. int     SMBCALL smb_unlockmsghdr(smb_t *smb, smbmsg_t *msg);
  71. int     SMBCALL smb_addcrc(smb_t *smb, ulong crc);
  72. int     SMBCALL smb_hfield(smbmsg_t *msg, ushort type, ushort length
  73.                 ,void *data);
  74. int     SMBCALL smb_dfield(smbmsg_t *msg, ushort type, ulong length);
  75. int     SMBCALL smb_addmsghdr(smb_t *smb, smbmsg_t *msg,int storage);
  76. int     SMBCALL smb_putmsg(smb_t *smb, smbmsg_t *msg);
  77. int     SMBCALL smb_putmsgidx(smb_t *smb, smbmsg_t *msg);
  78. int     SMBCALL smb_putmsghdr(smb_t *smb, smbmsg_t *msg);
  79. void    SMBCALL smb_freemsgmem(smbmsg_t *msg);
  80. ulong    SMBCALL smb_hdrblocks(ulong length);
  81. ulong    SMBCALL smb_datblocks(ulong length);
  82. long    SMBCALL smb_allochdr(smb_t *smb, ulong length);
  83. long    SMBCALL smb_fallochdr(smb_t *smb, ulong length);
  84. long    SMBCALL smb_hallochdr(smb_t *smb);
  85. long    SMBCALL smb_allocdat(smb_t *smb, ulong length, ushort headers);
  86. long    SMBCALL smb_fallocdat(smb_t *smb, ulong length, ushort headers);
  87. long    SMBCALL smb_hallocdat(smb_t *smb);
  88. int     SMBCALL smb_incdat(smb_t *smb, ulong offset, ulong length
  89.                 ,ushort headers);
  90. int     SMBCALL smb_freemsg(smb_t *smb, smbmsg_t *msg);
  91. int     SMBCALL smb_freemsgdat(smb_t *smb, ulong offset, ulong length
  92.                 ,ushort headers);
  93. int     SMBCALL smb_freemsghdr(smb_t *smb, ulong offset, ulong length);
  94. char HUGE16 * SMBCALL smb_getmsgtxt(smb_t *smb, smbmsg_t *msg, ulong mode);
  95. void    SMBCALL smb_freemsgtxt(char HUGE16 *buf);
  96.  
  97. /* FILE pointer I/O functions */
  98.  
  99. int     SMBCALL smb_feof(FILE *fp);
  100. int     SMBCALL smb_ferror(FILE *fp);
  101. int     SMBCALL smb_fflush(FILE *fp);
  102. int     SMBCALL smb_fgetc(FILE *fp);
  103. int     SMBCALL smb_fputc(int ch, FILE *fp);
  104. int     SMBCALL smb_fseek(FILE *fp, long offset, int whence);
  105. long    SMBCALL smb_ftell(FILE *fp);
  106. long    SMBCALL smb_fread(char HUGE16 *buf, long bytes, FILE *fp);
  107. long    SMBCALL smb_fwrite(char HUGE16 *buf, long bytes, FILE *fp);
  108. long    SMBCALL smb_fgetlength(FILE *fp);
  109. int     SMBCALL smb_fsetlength(FILE *fp, long length);
  110. void    SMBCALL smb_rewind(FILE *fp);
  111. void    SMBCALL smb_clearerr(FILE *fp);
  112.  
  113. /* LZH functions */
  114.  
  115. long    SMBCALL lzh_encode(uchar *inbuf, long inlen, uchar *outbuf);
  116. long    SMBCALL lzh_decode(uchar *inbuf, long inlen, uchar *outbuf);
  117.  
  118. #ifdef __WATCOMC__    /* Use MSC standard (prepended underscore) */
  119. #pragma aux smb_ver             "_*"
  120. #pragma aux smb_lib_ver         "_*"
  121. #pragma aux smb_open            "_*"
  122. #pragma aux smb_close            "_*"
  123. #pragma aux smb_open_da         "_*"
  124. #pragma aux smb_close_da        "_*"
  125. #pragma aux smb_open_ha         "_*"
  126. #pragma aux smb_close_ha        "_*"
  127. #pragma aux smb_create            "_*"
  128. #pragma aux smb_stack            "_*"
  129. #pragma aux smb_trunchdr        "_*"
  130. #pragma aux smb_locksmbhdr        "_*"
  131. #pragma aux smb_getstatus        "_*"
  132. #pragma aux smb_putstatus        "_*"
  133. #pragma aux smb_unlocksmbhdr    "_*"
  134. #pragma aux smb_getmsgidx        "_*"
  135. #pragma aux smb_getlastidx        "_*"
  136. #pragma aux smb_getmsghdrlen    "_*"
  137. #pragma aux smb_getmsgdatlen    "_*"
  138. #pragma aux smb_lockmsghdr        "_*"
  139. #pragma aux smb_getmsghdr        "_*"
  140. #pragma aux smb_unlockmsghdr    "_*"
  141. #pragma aux smb_addcrc            "_*"
  142. #pragma aux smb_hfield            "_*"
  143. #pragma aux smb_dfield            "_*"
  144. #pragma aux smb_addmsghdr        "_*"
  145. #pragma aux smb_putmsg            "_*"
  146. #pragma aux smb_putmsgidx        "_*"
  147. #pragma aux smb_putmsghdr        "_*"
  148. #pragma aux smb_freemsgmem        "_*"
  149. #pragma aux smb_hdrblocks        "_*"
  150. #pragma aux smb_datblocks        "_*"
  151. #pragma aux smb_allochdr        "_*"
  152. #pragma aux smb_fallochdr        "_*"
  153. #pragma aux smb_hallochdr        "_*"
  154. #pragma aux smb_allocdat        "_*"
  155. #pragma aux smb_fallocdat        "_*"
  156. #pragma aux smb_hallocdat        "_*"
  157. #pragma aux smb_incdat            "_*"
  158. #pragma aux smb_freemsg         "_*"
  159. #pragma aux smb_freemsgdat        "_*"
  160. #pragma aux smb_freemsghdr        "_*"
  161. #pragma aux smb_getmsgtxt        "_*"
  162. #pragma aux smb_freemsgtxt        "_*"
  163. #pragma aux smb_feof            "_*"
  164. #pragma aux smb_ferror            "_*"
  165. #pragma aux smb_fflush            "_*"
  166. #pragma aux smb_fgetc            "_*"
  167. #pragma aux smb_fputc            "_*"
  168. #pragma aux smb_fseek            "_*"
  169. #pragma aux smb_ftell            "_*"
  170. #pragma aux smb_fread            "_*"
  171. #pragma aux smb_fwrite            "_*"
  172. #pragma aux smb_fgetlength        "_*"
  173. #pragma aux smb_fsetlength        "_*"
  174. #pragma aux smb_rewind            "_*"
  175. #pragma aux smb_clearerr        "_*"
  176. #pragma aux lzh_encode            "_*"
  177. #pragma aux lzh_decode            "_*"
  178. #endif    /* Watcom */
  179.  
  180.  
  181. #endif /* Don't add anything after this #endif statement */
  182.