ckupty.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. /* C K U P T Y . H -- Includes and definitions for ckupty.c */
  2. /*
  3. Copyright 1995 by the Massachusetts Institute of Technology.
  4. Modified for use in C-Kermit by:
  5. Jeffrey E Altman <jaltman@secure-endpoints.com>
  6. Secure Endpoints Inc., New York City
  7. November 1999
  8. */
  9. #ifndef __PTY_INT_H__
  10. #include <sys/types.h>
  11. /* #define WANT_UTMP */
  12. /* We don't want all the utmp/wtmp stuff */
  13. #ifdef WANT_UTMP
  14. #ifdef HAVE_UTMP_H
  15. #include <utmp.h>
  16. #endif /* HAVE_UTMP_H */
  17. #ifdef HAVE_UTMPX_H
  18. #include <utmpx.h>
  19. #endif /* HAVE_UTMPX_H */
  20. #endif /* WANT_UTMP */
  21. #ifdef HAVE_UNISTD_H
  22. #include <unistd.h>
  23. #endif /* HAVE_UNISTD_H */
  24. #ifdef __SCO__
  25. #include <sys/unistd.h>
  26. #endif /* __SCO__ */
  27. #ifdef HAVE_STDLIB_H
  28. #include <stdlib.h>
  29. #endif /* HAVE_STDLIB_H */
  30. #include <stdio.h>
  31. #include <sys/stat.h>
  32. #ifndef SUNOS41
  33. #include <sys/ioctl.h>
  34. #endif /* SUNOS41 */
  35. #include <sys/file.h>
  36. #include <sys/time.h>
  37. #include <ctype.h>
  38. #include <fcntl.h>
  39. #include <netinet/in.h>
  40. #include <errno.h>
  41. #include <pwd.h>
  42. #ifdef HAVE_SYS_LABEL_H
  43. /* only SunOS 4? */
  44. #include <sys/label.h>
  45. #include <sys/audit.h>
  46. #include <pwdadj.h>
  47. #endif /* HAVE_SYS_LABEL_H */
  48. #include <signal.h>
  49. #ifdef HPUX
  50. #include <sys/ptyio.h>
  51. #endif /* HPUX */
  52. #ifdef sysvimp
  53. #include <compat.h>
  54. #endif /* sysvimp */
  55. #ifdef COMMENT
  56. /* I don't think we actually use this for anything */
  57. /* and it kills Slackware builds, where there is no select.h. */
  58. #ifndef NO_SYS_SELECT_H
  59. #ifdef HAVE_SYS_SELECT_H
  60. #include <sys/select.h>
  61. #endif /* HAVE_SYS_SELECT_H */
  62. #endif /* NO_SYS_SELECT_H */
  63. #endif /* COMMENT */
  64. #ifdef HAVE_STREAMS
  65. #include <sys/stream.h>
  66. #include <sys/stropts.h>
  67. #endif /* HAVE_STREAMS */
  68. #ifdef POSIX_TERMIOS
  69. #ifndef ultrix
  70. #include <termios.h>
  71. #else
  72. #include <sgtty.h>
  73. #endif /* ultrix */
  74. #else /* POSIX_TERMIOS */
  75. #include <sgtty.h>
  76. #endif /* POSIX_TERMIOS */
  77. #include <netdb.h>
  78. /* #include <syslog.h> */
  79. #ifndef ultrix
  80. #include <string.h>
  81. #endif /* ultrix */
  82. /* #include <sys/param.h> */ /* (now done in ckcdeb.h) */
  83. #ifdef HAVE_STREAMS
  84. /* krlogin doesn't test sys/tty... */
  85. #ifdef HAVE_SYS_TTY_H
  86. #include <sys/tty.h>
  87. #endif /* HAVE_SYS_TTY_H */
  88. #ifdef HAVE_SYS_PTYVAR_H
  89. /* Solaris actually uses packet mode, so the real macros are needed too */
  90. #include <sys/ptyvar.h>
  91. #endif /* HAVE_SYS_PTYVAR_H */
  92. #endif /* HAVE_STREAMS */
  93. #ifdef COMMENT
  94. /* This block moved to ckcdeb.h */
  95. #ifndef NO_OPENPTY
  96. /* For NetBSD, see makefile */
  97. #ifndef HAVE_OPENPTY
  98. #ifdef __FreeBSD__
  99. #define HAVE_OPENPTY
  100. #else
  101. #ifdef MACOSX10
  102. #define HAVE_OPENPTY
  103. #endif /* MACOSX10 */
  104. #endif /* __FreeBSD__ */
  105. #endif /* HAVE_OPENPTY */
  106. #endif /* NO_OPENPTY */
  107. #endif /* COMMENT */
  108. #ifdef HAVE_VHANGUP
  109. #ifndef OPEN_CTTY_ONLY_ONCE
  110. /*
  111. Breaks under Ultrix and others where you cannot get controlling
  112. terminal twice.
  113. */
  114. #define VHANG_first
  115. #define VHANG_LAST
  116. #endif /* OPEN_CTTY_ONLY_ONCE */
  117. #endif /* HAVE_VHANGUP */
  118. /* Internal functions */
  119. _PROTOTYP(long ptyint_void_association,(void));
  120. _PROTOTYP(long ptyint_open_ctty ,(char *, int *));
  121. _PROTOTYP(VOID ptyint_vhangup, (void));
  122. #ifdef WANT_UTMP
  123. _PROTOTYP(long ptyint_update_wtmp, (struct utmp *, char *, char *));
  124. #endif /* WANT_UTMP */
  125. #define __PTY_INT_H__
  126. #endif /* __PTY_INT_H__ */
  127. #ifndef __LIBPTY_H__
  128. #ifdef WANT_UTMP
  129. /* Constants for pty_update_utmp */
  130. #define PTY_LOGIN_PROCESS 0
  131. #define PTY_USER_PROCESS 1
  132. #define PTY_DEAD_PROCESS 2
  133. #define PTY_TTYSLOT_USABLE (0x1) /* flags to update_utmp*/
  134. #define PTY_UTMP_USERNAME_VALID (0x2)
  135. #endif /* WANT_UTMP */
  136. _PROTOTYP(long pty_init,(void));
  137. _PROTOTYP(long pty_getpty, ( int *, char *, int));
  138. _PROTOTYP(long pty_open_slave, (char *, int *, int));
  139. _PROTOTYP(long pty_open_ctty, (char *, int *, int));
  140. _PROTOTYP(long pty_initialize_slave, (int));
  141. #ifdef WANT_UTMP
  142. _PROTOTYP(long pty_update_utmp, (int, int, char *, char *, char *, int));
  143. _PROTOTYP(long pty_logwtmp, (char *, char *, char *));
  144. #endif /* WANT_UTMP */
  145. _PROTOTYP(long pty_cleanup, (char *, int, int));
  146. #define PTY_GETPTY_STREAMS (44806912L)
  147. #define PTY_GETPTY_FSTAT (44806913L)
  148. #define PTY_GETPTY_NOPTY (44806914L)
  149. #define PTY_GETPTY_SLAVE_TOOLONG (44806915L)
  150. #define PTY_OPEN_SLAVE_OPENFAIL (44806916L)
  151. #define PTY_OPEN_SLAVE_CHMODFAIL (44806917L)
  152. #define PTY_OPEN_SLAVE_NOCTTY (44806918L)
  153. #define PTY_OPEN_SLAVE_CHOWNFAIL (44806919L)
  154. #define PTY_OPEN_SLAVE_LINE_PUSHFAIL (44806920L)
  155. #define PTY_OPEN_SLAVE_PUSH_FAIL (44806921L)
  156. #define PTY_OPEN_SLAVE_REVOKEFAIL (44806922L)
  157. #ifdef WANT_UTMP
  158. #define PTY_UPDATE_UTMP_PROCTYPE_INVALID (44806923L)
  159. #endif /* WANT_UTMP */
  160. #define PTY_OPEN_SLAVE_TOOSHORT (44806924L)
  161. #define ERROR_TABLE_BASE_pty (44806912L)
  162. extern struct error_table et_pty_error_table;
  163. #define __LIBPTY_H__
  164. #endif /* __LIBPTY_H__ */