home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / hamradio / s920603.zip / SESSION.H < prev    next >
C/C++ Source or Header  |  1992-06-01  |  2KB  |  92 lines

  1. #ifndef    _SESSION_H
  2. #define    _SESSION_H
  3.  
  4. #include <stdio.h>
  5.  
  6. #ifndef    _GLOBAL_H
  7. #include "global.h"
  8. #endif
  9.  
  10. #ifndef    _PROC_H
  11. #include "proc.h"
  12. #endif
  13.  
  14. #ifndef _HARDWARE_H
  15. #include "hardware.h"
  16. #endif
  17.  
  18. #ifndef    _FTPCLI_H
  19. #include "ftpcli.h"
  20. #endif
  21.  
  22. #ifndef    _TELNET_H
  23. #include "telnet.h"
  24. #endif
  25.  
  26. struct ttystate {
  27.     char *line;        /* Line buffer */
  28.     char *lp;        /* Pointer into same */
  29.     int echo;        /* Keyboard local echoing? */
  30.     int edit;        /* Local editing? */
  31.     int crnl;        /* Translate cr to lf? */
  32. };
  33.  
  34. /* Session control structure; only one entry is used at a time */
  35. struct session {
  36.     unsigned index;
  37.     int type;
  38. #define    TELNET    1
  39. #define    FTP    2
  40. #define    AX25TNC    3
  41. #define    FINGER    4
  42. #define    PING    5
  43. #define NRSESSION 6
  44. #define    COMMAND    7
  45. #define    VIEW    8
  46. #define    HOP    9
  47. #define    TIP    10
  48. #define    PPPPASS    11
  49. #define DIAL    12
  50. #define DQUERY    13
  51. #define DCLIST    14
  52. #define    ITRACE    15
  53.  
  54.     char *name;    /* Name of remote host */
  55.     union {
  56.         struct ftpcli *ftp;
  57.         struct telnet *telnet;
  58.         void *p;
  59.     } cb;
  60.     struct proc *proc;    /* Primary session process (e.g., tn recv) */
  61.     struct proc *proc1;    /* Secondary session process (e.g., tn xmit) */
  62.     struct proc *proc2;    /* Tertiary session process (e.g., upload) */
  63.     FILE *network;        /* Primary network socket (control for FTP) */
  64.     FILE *record;        /* Receive record file */
  65.     FILE *upload;        /* Send file */
  66.     struct ttystate ttystate;
  67.     FILE *input;        /* Input stream */
  68.     FILE *output;        /* Output stream */
  69.     int (*ctlproc) __ARGS((int));    /* Function to hand keyboard ctls */
  70. };
  71. #define    NULLSESSION    (struct session *)0
  72.  
  73. extern char *Sestypes[];
  74. extern unsigned Nsessions;        /* Maximum number of sessions */
  75. extern struct session **Sessions;    /* Session descriptors themselves */
  76. extern struct session *Current;        /* Always points to current session */
  77. extern struct session *Lastcurr;    /* Last non-command session */
  78. extern struct session *Command;        /* Pointer to command session */
  79.  
  80. /* In session.c: */
  81. void freesession __ARGS((struct session *sp));
  82. int keywait __ARGS((char *prompt,int flush));
  83. struct session *sessptr __ARGS((char *cp));
  84. struct session *newsession __ARGS((char *name,int type,int makecur));
  85. void sesflush __ARGS((void));
  86. void upload __ARGS((int unused,void *sp1,void *p));
  87.  
  88. extern int16 Lport;
  89. #define    ALERT_EOF    1
  90.  
  91. #endif  /* _SESSION_H */
  92.