telnetLib.h
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:6k
源码类别:

VxWorks

开发平台:

C/C++

  1. /* telnetLib.h - telnet library header */
  2. /* Copyright 1984 - 2002 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. -------------------
  6. 02d,30apr02,elr  Changed session data structure to include all allocated  
  7.                  resources for reliable cleanup during logout
  8. 02c,14feb01,spm  merged from version 02c of tor2_0_x branch (base 02b):
  9.                  general overhaul of telnet server (SPR #28675)
  10. 02b,22sep92,rrr  added support for c++
  11. 02a,04jul92,jcf  cleaned up.
  12. 01e,26may92,rrr  the tree shuffle
  13. 01d,04oct91,rrr  passed through the ansification filter
  14.   -fixed #else and #endif
  15.   -changed VOID to void
  16.   -changed copyright notice
  17. 01c,05oct90,shl  added ANSI function prototypes.
  18.                  made #endif ANSI style.
  19.                  added copyright notice.
  20. 01b,08aug90,shl  added INCtelnetLibh to #endif.
  21. 01a,10oct86,dnw  written
  22. */
  23. #ifndef __INCtelnetLibh
  24. #define __INCtelnetLibh
  25. #include "lstLib.h"
  26. #include "semLib.h"
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. #if CPU_FAMILY==I960
  31. #pragma align 1                 /* tell gcc960 not to optimize alignments */
  32. #endif  /* CPU_FAMILY==I960 */
  33. #define PTY_DEVICE_NAME_MAX_LEN 128 /* The maximum string length of a pty device */
  34. typedef struct
  35.     {
  36.     NODE        node;                /* for link-listing */
  37.     char        ptyRemoteName[PTY_DEVICE_NAME_MAX_LEN];  /* name of the pty for this session */
  38.     int         socket;              /* socket connection */
  39.     int         inputFd;             /* input to command interpreter */
  40.     int         outputFd;            /* output to command interpreter */
  41.     int         slaveFd;             /* command interpreter side fd of pty */
  42.     int         outputTask;          /* Task ID to send data to socket */
  43.     int         inputTask;           /* Task ID to send data to socket */
  44.     FUNCPTR     parserControl;       /* source of input/output files */
  45.     SEM_ID      startInput;          /* begin reading from socket connection */
  46.     SEM_ID      startOutput;         /* begin writing to socket connection */
  47.     BOOL        busyFlag;            /* input/output tasks in use? */
  48.     BOOL        loggedIn;            /* Has a shell been started on this slot? */
  49.     UINT32      userData;            /* A storage for application developers */
  50.     int shellTaskId;         /* Task ID of the shell associated with this session */
  51.     } TELNETD_SESSION_DATA;
  52. typedef struct
  53.     {
  54.     TELNETD_SESSION_DATA *pSession;  /* link to session data for tasks */
  55.     } TELNETD_TASK_DATA;
  56.     
  57. #if CPU_FAMILY==I960
  58. #pragma align 0                 /* turn off alignment requirement */
  59. #endif  /* CPU_FAMILY==I960 */
  60. /* command interpreter control operations */
  61. #define REMOTE_START 0
  62. #define REMOTE_STOP 1
  63. #define REMOTE_INIT 2
  64. /* Definitions for the TELNET protocol. */
  65. #define IAC 255 /* interpret as command: */
  66. #define DONT 254 /* you are not to use option */
  67. #define DO 253 /* please, you use option */
  68. #define WONT 252 /* I won't use option */
  69. #define WILL 251 /* I will use option */
  70. #define SB 250 /* interpret as subnegotiation */
  71. #define GA 249 /* you may reverse the line */
  72. #define EL 248 /* erase the current line */
  73. #define EC 247 /* erase the current character */
  74. #define AYT 246 /* are you there */
  75. #define AO 245 /* abort output--but let prog finish */
  76. #define IP 244 /* interrupt process--permanently */
  77. #define BREAK 243 /* break */
  78. #define DM 242 /* data mark--for connect. cleaning */
  79. #define NOP 241 /* nop */
  80. #define SE 240 /* end sub negotiation */
  81. #define EOR     239             /* end of record (transparent mode) */
  82. #define SYNCH 242 /* for telfunc calls */
  83. /* telnet options */
  84. #define TELOPT_BINARY 0 /* 8-bit data path */
  85. #define TELOPT_ECHO 1 /* echo */
  86. #define TELOPT_RCP 2 /* prepare to reconnect */
  87. #define TELOPT_SGA 3 /* suppress go ahead */
  88. #define TELOPT_NAMS 4 /* approximate message size */
  89. #define TELOPT_STATUS 5 /* give status */
  90. #define TELOPT_TM 6 /* timing mark */
  91. #define TELOPT_RCTE 7 /* remote controlled transmission and echo */
  92. #define TELOPT_NAOL  8 /* negotiate about output line width */
  93. #define TELOPT_NAOP  9 /* negotiate about output page size */
  94. #define TELOPT_NAOCRD 10 /* negotiate about CR disposition */
  95. #define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */
  96. #define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */
  97. #define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */
  98. #define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */
  99. #define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */
  100. #define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */
  101. #define TELOPT_XASCII 17 /* extended ascic character set */
  102. #define TELOPT_LOGOUT 18 /* force logout */
  103. #define TELOPT_BM 19 /* byte macro */
  104. #define TELOPT_DET 20 /* data entry terminal */
  105. #define TELOPT_SUPDUP 21 /* supdup protocol */
  106. #define TELOPT_SUPDUPOUTPUT 22 /* supdup output */
  107. #define TELOPT_SNDLOC 23 /* send location */
  108. #define TELOPT_TTYPE 24 /* terminal type */
  109. #define TELOPT_EOR 25 /* end or record */
  110. #define TELOPT_EXOPL 255 /* extended-options-list */
  111. /* sub-option qualifiers */
  112. #define TELQUAL_IS 0 /* option is... */
  113. #define TELQUAL_SEND 1 /* send option */
  114. /* function declarations */
  115. #if defined(__STDC__) || defined(__cplusplus)
  116. extern void  telnetInTask (TELNETD_SESSION_DATA *pSlot);
  117. extern STATUS  telnetdInit (int numClients, BOOL staticFlag);
  118. extern STATUS  telnetdStart (int port);
  119. extern void  telnetOutTask (TELNETD_SESSION_DATA *pSlot);
  120. extern STATUS  telnetdParserSet (FUNCPTR pParserCtrlRtn);
  121. extern void  telnetd (void);
  122. extern void  telnetdExit (UINT32 sessionId);
  123. extern BOOL     telnetdStaticTaskInitializationGet();
  124. #else /* __STDC__ */
  125. extern void  telnetInTask ();
  126. extern STATUS  telnetInit ();
  127. extern void  telnetOutTask ();
  128. extern STATUS  telnetdParserSet ();
  129. extern void  telnetd ();
  130. extern void  telnetdExit ();
  131. extern BOOL     telnetdStaticTaskInitializationGet();
  132. #endif /* __STDC__ */
  133. #ifdef __cplusplus
  134. }
  135. #endif
  136. #endif /* __INCtelnetLibh */