home *** CD-ROM | disk | FTP | other *** search
/ Amiga Times / AmigaTimes.iso / programme / trionbbs110 / Trion / docs / DemoDoor / adoor.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-10-06  |  10.7 KB  |  324 lines

  1.  
  2. /*  Trion BBS 'Additional Clidoor Support' system header file           */
  3. /*                                                                      */
  4. /*  V 1.00   25 - 11 - 1995                                             */
  5. /*  V 1.10    7 -  6 - 1997                                             */
  6. /*                                                                      */
  7. /*  (c) Copyright 1995-97 by Paul Spijkerman                            */
  8.  
  9.  
  10.  
  11. #include <exec/types.h>
  12. #include <exec/ports.h>
  13. #include <exec/memory.h>
  14. #include <dos/dos.h>
  15. #include <clib/exec_protos.h>
  16. #include <clib/alib_protos.h>
  17. #include <clib/dos_protos.h>
  18. #include <stdio.h>
  19. #include <strings.h>
  20. #include <stdlib.h>
  21. #include <stdarg.h>
  22.  
  23.  
  24. #define CTRL(x)             (x - 'a' + 1)
  25.  
  26.  
  27.  
  28. struct ADoorMessage {
  29.    struct Message    ADS_Msg;
  30.    UBYTE             ADS_Command;
  31.    UBYTE             ADS_SubCommand;
  32.  
  33.    BYTE              ADS_Result;
  34.    UBYTE             ADS_Carrier;
  35.  
  36.    ULONG             ADS_Data_long;
  37.    UWORD             ADS_Data_word;   
  38.  
  39.    void             *ADS_P;
  40.    char              ADS_String[80];
  41. };
  42.  
  43.  
  44. /* In the new 'ADS' system there is a Result field for simplicity and  */
  45. /* to avoid the confusion when the Result was in the Command field     */
  46. /* If Result is smaller then zero the operation failed                 */
  47. /*    -2   ..  Can't find BBS node (not stored in the result field)    */
  48. /*    -1   ..  means the command doesn't exists                        */
  49. /*     0   ..  Command exited succesfully                              */
  50.  
  51.  
  52.  
  53.  
  54. struct ADS_Data  {                      /* ADS_DATA */
  55.    struct ADoorMessage    *BBSMsg;
  56.    struct MsgPort         *BBSreplyport;
  57.    struct SharedData      *SharedData;      /* <- Pointer to Paths */
  58.    int                    node;
  59.    int                    quiet;
  60.    int                    IDMode;
  61. };
  62.  
  63.  
  64.  
  65. struct DoorIO {             /*   'Pure' Door :))   */
  66.    BPTR              ConInput;
  67.    BPTR              ConOutput;
  68.    int               carrier;
  69.  
  70.    /* extra for color, position */
  71.  
  72.    int   mfc  , mbc;        /* Foreground, Background colour memory  */
  73.    int   mx   , my;         /* Cursor pos. memory                    */
  74.    int   xmax , ymax;       /* Screen size                           */
  75.    int   mhigh;             /* Bold attribute, high intensity colors */
  76.  
  77.    /* UnGetCharacter data */
  78.  
  79.    UBYTE                  kar;
  80.    UBYTE                  unused;   /* (padding or reserved for source) */
  81. };
  82.  
  83.  
  84.  
  85.  
  86.  
  87. #define     ADSC_DROP_CARRIER                   ( 16)
  88. #define     ADSC_STRING_TO_LOG                  ( 17)
  89. #define     ADSC_TYPE_FILE                      ( 18)
  90. #define     ADSC_GET_TIME_ONLINE                ( 19)
  91. #define     ADSC_CHANGE_TIME_ONLINE             ( 20)
  92.  
  93. #define     ADSC_MARK_DOS_FILE                  ( 32)
  94. #define     ADSC_UNMARK_ALL_DOSFILES            ( 33)
  95. #define     ADSC_DOWNLOAD_DOS_FILES             ( 34)
  96.  
  97. #define     ADSC_UPLOAD                         ( 40)
  98.  
  99. #define     ADSC_PAGE_SYSOP                     ( 48)
  100. #define     ADSC_PLAY_SAMPLE                    ( 49)
  101. #define     ADSC_CHECK_SYSOP_AVAILABLE          ( 50)
  102. #define     ADSC_SPLIT_CHAT_MODE                ( 51)
  103.  
  104. #define     ADSC_GET_USER_DATA                  ( 64)
  105. #define     ADSC_CHANGE_USER_DATA               ( 65)
  106. #define     ADSC_GET_SYSTEM_DATA                ( 66)
  107.  
  108.  
  109. #define     ADSC_GET_MESSAGE_SECTION            ( 80)
  110. /* ADS_Data_word = section  */
  111. #define     ADSC_SET_MESSAGE_SECTION            ( 81)
  112. /* ADS_Data_word = section,  ADS_SubCommand = 0-view, 2-read, 3-write */
  113. #define     ADSC_CHECK_MESSAGE_SECTION          ( 82)
  114. /* ? */
  115.  
  116.  
  117. #define     ADSC_GET_FILE_SECTION               (100)
  118. /* ADS_Data_word = section  */
  119. #define     ADSC_SET_FILE_SECTION               (101)
  120. /* ADS_Data_word = section,  ADS_SubCommand = 0-view, 1-list, 2-download, 3-upload */
  121. #define     ADSC_CHECK_FILE_SECTION             (102)
  122. /* ? */
  123.  
  124.  
  125. #define     ADSC_FLUSH_BUFFER                   (126)
  126. #define     ADSC_PUSHINTOBUFFER                 (127)
  127.  
  128. /* debug functions .. do not use !! */
  129.  
  130. #define     ADSC_PRINT                          (128)
  131. #define     ADSC_GETCHAR                        (129)
  132. #define     ADSC_MAYGETCHAR                     (130)
  133. #define     ADSC_NO_OPERATION                   (131)    /* check carrier */
  134.  
  135.  
  136.  
  137.  
  138. int   SetopPort      (struct ADS_Data *p, int node, int quiet);
  139. int   RemovePort     (struct ADS_Data *p);
  140.  
  141.  
  142. int   DropCarrier    (struct ADS_Data *p);
  143. int   PrintToLog     (struct ADS_Data *p, char *string);
  144. int   TypeFile       (struct ADS_Data *p, char *string);
  145. int   GetTimeOnline  (struct ADS_Data *p);
  146. int   IncreaseTimeOnline(struct ADS_Data *p, int time);
  147. int   DecreaseTimeOnline(struct ADS_Data *p, int time);
  148.  
  149. int   Download       (struct ADS_Data *p);
  150. int   MarkFile       (struct ADS_Data *p, char *str);
  151. int   UnmarkAllFiles (struct ADS_Data *p);
  152.  
  153. int   Upload         (struct ADS_Data *p, char *str);
  154.  
  155. int   PageSysop      (struct ADS_Data *p);
  156. int   PlaySample     (struct ADS_Data *p, char *sample);
  157. int   PlaySampleNum  (struct ADS_Data *p, char *sample, int num);
  158. int   CheckSysopAvailable(struct ADS_Data *p);
  159. int   SplitChatMode  (struct ADS_Data *p, int mode);
  160.  
  161. int   GetUserStringField(struct ADS_Data *p, int field, char *string);
  162. int   GetUserNumericalField(struct ADS_Data *p, int field, ULONG *var);
  163. int   ChangeUserStringField(struct ADS_Data *p, int field, char *string);
  164. int   ChangeUserNumericalField(struct ADS_Data *p, int field, ULONG var);
  165.  
  166. int   GetBaudRate    (struct ADS_Data *p, UWORD *local, ULONG *baudrate);
  167. int   GetSharedData  (struct ADS_Data *p);
  168.  
  169. int   FlushBuffer    (struct ADS_Data *p);
  170. /* int   PushIntoBuffer (struct ADS_Data *p, char *str); */
  171. int   PushIntoBuffer(struct ADS_Data *p, char *str, int source);
  172.  
  173.  
  174.  
  175. void  SetOpIO        (struct DoorIO *p);
  176. void  RemoveIO       (struct DoorIO *p);
  177. UBYTE GetCharacter   (struct DoorIO *p);
  178. UBYTE MayGetCharacter(struct DoorIO *p);
  179. int   GetString      (struct DoorIO *p, char *str, int strsize);
  180. int   Carrier        (struct DoorIO *p);
  181. int   nprintf        (struct DoorIO *p, char *fmt, ...);
  182. int   brk            (void);
  183.  
  184.  
  185.  
  186.  
  187. /* voor en achtergrond kleuren  */
  188. /* voor voorgrond kleuren wordt het BOLD atribute uitgezet ( esc[0m code ) */
  189.  
  190. #define BLACK     0x00     /* blue    in cli tot V1.3  */
  191. #define RED       0x01     /* white   */
  192. #define GREEN     0x02     /* black   */
  193. #define YELLOW    0x03     /* orange  */
  194. #define BLUE      0x04     /* blue    */
  195. #define MAGENTA   0x05     /* white   */
  196. #define CYAN      0x06     /* black   */
  197. #define WHITE     0x07     /* orange  */
  198.  
  199. /* high intensity voorgrond kleuren                         */
  200. /* hierbij wordt het BOLD atribute aangezet ( esc[1m code ) */
  201.  
  202. #define HBLACK    0x08     /* blue    in cli tot V1.3  */
  203. #define HRED      0x09     /* white   */
  204. #define HGREEN    0x0a     /* black   */
  205. #define HYELLOW   0x0b     /* orange  */
  206. #define HBLUE     0x0c     /* blue    */
  207. #define HMAGENTA  0x0d     /* white   */
  208. #define HCYAN     0x0e     /* black   */
  209. #define HWHITE    0x0f     /* orange  */
  210.  
  211. #define NONE        0x00    /* geen atrribute aan  */
  212. #define BOLD        0x01
  213. #define FAINT       0x02
  214. #define ITALIC      0x03
  215. #define UNDERSCORE  0x04
  216. #define BLINK       0x05
  217. #define INVERS      0x07
  218. #define SUBSCRIPT   0x30    /* decimaal 48 */
  219. #define SUPERSCRIPT 0x31    /* decimaal 49 */
  220. #define INVISIBLE   0x08
  221.  
  222.  
  223. void cursxy  (struct DoorIO *p, int x,int y);
  224. void col     (struct DoorIO *p, int fc,int bc);
  225. void fcol    (struct DoorIO *p, int fc);
  226. void bcol    (struct DoorIO *p, int bc);
  227. void atr     (struct DoorIO *p, int atr);
  228. void norm    (struct DoorIO *p);
  229. void cls     (struct DoorIO *p);
  230.  
  231.  
  232.  
  233. /* User Data String Fields  */
  234. /* size includes terminating '\0' character */
  235.  
  236. #define  UDSF_NAME             (64+ 0)      /* size=37  check for succes !! */
  237. #define  UDSF_ALIAS            (64+ 1)      /* size=37  check for succes !! */
  238. #define  UDSF_PASSWORD         (64+ 2)      /* size=17  */
  239. #define  UDSF_PLAATS           (64+ 3)      /* size=40  */
  240. #define  UDSF_VOICEPHONE       (64+ 4)      /* size=40  */
  241. #define  UDSF_DATAPHONE        (64+ 5)      /* size=40  */
  242.  
  243. /* User Data Numerical Fields  */
  244.  
  245. #define  UDNF_NUMMER           (128+ 0)      /* LONG   Do not change field !! */
  246. #define  UDNF_CALLS            (128+ 1)      /* ULONG  */
  247. #define  UDNF_LEVEL            (128+ 2)      /* UBYTE  */
  248. #define  UDNF_SCREENLENGTH     (128+ 3)      /* UBYTE  */
  249. #define  UDNF_CALLSTODAY       (128+ 4)      /* UBYTE  */
  250. #define  UDNF_CALLLIMITPERDAY  (128+ 5)      /* UBYTE  */
  251. #define  UDNF_TIMELIMIT        (128+ 6)      /* UWORD  */
  252. #define  UDNF_TIMEREMAINING    (128+ 7)      /* UWORD  Do not use !! */
  253. #define  UDNF_EDITOR           (128+ 8)      /* UBYTE  */
  254. #define  UDNF_PROTOCOL         (128+ 9)      /* UBYTE  */
  255. #define  UDNF_FILERATIO        (128+10)      /* UBYTE  */
  256. #define  UDNF_BYTERATIO        (128+11)      /* UBYTE  */
  257. #define  UDNF_FILESDOWNLOADEDTODAY  (128+12) /* UBYTE  */
  258. #define  UDNF_DOWNLOADS        (128+13)      /* UWORD  */
  259. #define  UDNF_UPLOADS          (128+14)      /* UWORD  */
  260. #define  UDNF_DOWNLOADBYTES    (128+15)      /* ULONG  */
  261. #define  UDNF_UPLOADBYTES      (128+16)      /* ULONG  */
  262. #define  UDNF_MAXBYTESPERDAY   (128+17)      /* ULONG  */
  263. #define  UDNF_BYTESDOWNLOADEDTODAY  (128+18) /* ULONG  */
  264. #define  UDNF_MAXMSGSPERDAY    (128+19)      /* UBYTE  */
  265. #define  UDNF_MSGSWRITTENTODAY (128+20)      /* UBYTE  */
  266. #define  UDNF_MESSAGES         (128+21)      /* ULONG  */
  267. #define  UDNF_MENUSET          (128+22)      /* UBYTE  */
  268.  
  269. #define  UDNF_TOTDOWNLOADS     (128+23)      /* UWORD  */
  270. #define  UDNF_TOTDOWNLOADBYTES (128+24)      /* ULONG  */
  271.  
  272.  
  273. /* Note that DOWNLOADS and DOWNLOADBYTES refer to Downloads on ratio */
  274. /* they do not include files marked FreeDownload                     */
  275. /* TOTDOWNLOADS and TOTDOWNLOADBYTES do include freedownloads        */
  276.  
  277.  
  278.  
  279.  
  280. /* When running a door you can get a pointer to 'SharedData' from  */
  281. /* the BBS nodes with the paths to all BBS directories             */
  282.  
  283.  
  284. #define  PATHLENGTH  60
  285.  
  286.  
  287. struct Paths {
  288.    UBYTE     Default   [ PATHLENGTH ];
  289.    UBYTE     Config    [ PATHLENGTH ];
  290.    UBYTE     Utils     [ PATHLENGTH ];
  291.    UBYTE     Scripts   [ PATHLENGTH ];
  292.    UBYTE     Users     [ PATHLENGTH ];
  293.    UBYTE     Logs      [ PATHLENGTH ];
  294.    UBYTE     Data      [ PATHLENGTH ];
  295.    UBYTE     Icons     [ PATHLENGTH ];
  296.    UBYTE     Samples   [ PATHLENGTH ];
  297.    UBYTE     Doors     [ PATHLENGTH ];
  298.  
  299.    UBYTE     Menus     [ PATHLENGTH ];
  300.    UBYTE     MenuText  [ PATHLENGTH ];
  301.    UBYTE     Text      [ PATHLENGTH ];
  302.  
  303.    UBYTE     FileCat   [ PATHLENGTH ];
  304.    UBYTE     Upload    [ PATHLENGTH ];
  305.    UBYTE     Killed    [ PATHLENGTH ];
  306.  
  307.    UBYTE     Mail      [ PATHLENGTH ];
  308.    UBYTE     Inbound   [ PATHLENGTH ];
  309.    UBYTE     Outbound  [ PATHLENGTH ];
  310.    UBYTE     NodeLists [ PATHLENGTH ];
  311.  
  312.    UBYTE     TempDir   [ PATHLENGTH ];
  313. };
  314.  
  315.  
  316.  
  317. struct SharedData {
  318.    struct Paths      Paths;
  319.  
  320.    /* rest of the structure is private */
  321. };
  322.  
  323.  
  324.