home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / N / TCPIP / NETKIT-A.06 / NETKIT-A / NetKit-A-0.06 / dip337d-uri / dip.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-05  |  4.4 KB  |  161 lines

  1. /*
  2.  * dip        A program for handling dialup IP connecions.
  3.  *
  4.  * Version:    @(#)dip.h    3.3.7-uri    05/24/94
  5.  * Version:    @(#)dip.h    3.3.7        12/13/93
  6.  *
  7.  * Author:      Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
  8.  *        Copyright 1988-1993 MicroWalt Corporation
  9.  *
  10.  *              Uri Blumenthal <uri@watson.ibm.com>
  11.  *              (C) 1994
  12.  *
  13.  *        This program is free software; you can redistribute it
  14.  *        and/or  modify it under  the terms of  the GNU General
  15.  *        Public  License as  published  by  the  Free  Software
  16.  *        Foundation;  either  version 2 of the License, or  (at
  17.  *        your option) any later version.
  18.  */
  19. #include <sys/types.h>
  20. #include <sys/socket.h>
  21. #include <sys/ioctl.h>
  22. #include <sys/time.h>
  23. #include <arpa/inet.h>
  24. #include <arpa/nameser.h>
  25. #include <netinet/in.h>
  26. #include <ctype.h>
  27. #include <errno.h>
  28. #include <fcntl.h>
  29. #include <limits.h>
  30. #include <netdb.h>
  31. #include <pwd.h>
  32. #include <resolv.h>
  33. #include <signal.h>
  34. #include <stdlib.h>
  35. #include <string.h>
  36. #include <syslog.h>
  37. #include <termios.h>
  38. #include <unistd.h>
  39. #include <stdio.h>
  40. #include "pathnames.h"
  41.  
  42.  
  43. /* DIP definitions. */
  44. #define DIP_SFX        ".dip"
  45. #define DIP_SLIP    1        /* we support the SLIP protocol    */
  46. #define DIP_PPP        0        /* we support the PPP protocol    */
  47.  
  48. /* SLIP/PPP/ASK initial protocol configuration. */
  49. #define DEF_MTU        296
  50. #define DEF_PROT    "SLIP"
  51. #define DEF_MODEM    "HAYES"
  52. #define DEF_SPEED    "38400"
  53.  
  54.  
  55. struct dip {
  56.   /* Login info. */
  57.   char            name[16];        /* login name of host    */
  58.   char            passwd[10];        /* any external passwd    */
  59.   char            home[1024];        /* user home directory    */
  60.  
  61.   /* Misc protocol info. */
  62.   char            comment[128];        /* any comments        */
  63.   char            protocol[16];        /* protocol to use    */
  64.   int            protonr;        /* decoded protocol #    */
  65.   int            mtu;            /* MTU to use for conn.    */
  66.  
  67.   /* Connection info. */
  68.   char            local[128];        /* local host name    */
  69.   struct in_addr    loc_ip;            /* mapped IP address    */
  70.   char            remote[128];        /* remote host name    */
  71.   struct in_addr    rmt_ip;            /* mapped IP address    */
  72.   char            gateway[128];        /* remote gateway name    */
  73.   struct in_addr    rmt_gw;            /* mapped IP address    */
  74.   char            netmask[32];        /* netmask of route    */
  75.   char            route[128];        /* name of rmt network    */
  76.   struct in_addr    rmt_rt;            /* mapped IP address    */
  77.   int            rtdefault;        /* are we the dflt gw?    */
  78. };
  79.  
  80.  
  81. /* DIP protocol switcher definitions. */
  82. struct protosw {
  83.   char    *name;
  84.   int    type;
  85.   void    (*func)(struct dip *);
  86. };
  87.  
  88.  
  89. /* DIP global variables. */
  90. extern int        opt_v;        /* flag: be verbose!        */
  91. extern struct dip    mydip;        /* global DIP entry        */
  92. extern struct protosw    protosw[];    /* table with protocol info    */
  93.  
  94.  
  95. /* Global functions. */
  96. extern void    do_command(FILE *file);
  97. extern void    do_login(char *user, char **argp);
  98. extern void    do_terminal(void);
  99. extern int    get_prot(char *name);
  100. extern void    ip_dump(char *ptr, int len);
  101. extern int    dip_daemon(struct dip *dip);
  102. extern int    dip_setup(struct dip *dip);
  103. extern int    dip_login_setup(struct dip *dip);
  104.  
  105. extern int    mdm_init(char *text);
  106. extern int    mdm_modem(char *modem);
  107. extern int    mdm_dial(char *number);
  108. extern int    mdm_reset(void);
  109. extern int    mdm_hangup(void);
  110.  
  111. extern int    attach(char *name, struct dip *dip);
  112. extern void    detach(char *name);
  113.  
  114. extern int    tty_getc(void);
  115. extern int    tty_putc(int c);
  116. extern void    tty_puts(char *s);
  117. extern int    tty_askfd(void);
  118. extern int    tty_get_disc(int *disc);
  119. extern int    tty_set_disc(int disc);
  120. extern int    tty_get_encap(int *encap);
  121. extern int    tty_set_encap(int encap);
  122. extern int    tty_get_name(char *name);
  123. extern int    tty_databits(char *bits);
  124. extern int    tty_stopbits(char *bits);
  125. extern int    tty_parity(char *type);
  126. extern int    tty_speed(char *speed);
  127. extern int    hanguptty(void);
  128. extern int    tty_notlocal(void);
  129. extern int    tty_login(void);
  130. extern int    tty_flush(void);
  131. extern int    tty_close(void);
  132. extern int    tty_login_close(void);
  133. extern int    tty_open(char *name);
  134. extern int    tty_nomesg(void);
  135.  
  136. #ifdef SKEY
  137. /* S/Key authentication routines in libskey.a */
  138.  
  139. #define    SKEY_FAILURE    -1
  140. #define    SKEY_SUCCESS    0
  141. #define SKEY_NOT_FOUND    1
  142.  
  143. extern int    skey_haskey(char *name);
  144. extern int    skey_authenticate(char *name);
  145. extern int    keycrunch(char *result, char *seed, char *passwd);
  146. extern char     *btoe(char *engout, char *c);
  147. extern char     *readpass(char *buf, int n);
  148. extern void    f(char *x);
  149.  
  150. /* token used in the passwd entry of diphosts to indicate
  151.    that this user has S/Key authentication */
  152.  
  153. #define    SKEY_TOKEN    "s/key"
  154.  
  155. /* challenge string to look for */
  156.  
  157. #define SKEY_CHALLENGE    "[s/key"
  158.  
  159. #endif    /* SKEY */
  160. /* End of DIP.H */
  161.