home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C / Snippets / PPP-Prefs / PPP-Prefs.h < prev    next >
Encoding:
Text File  |  1995-12-06  |  3.1 KB  |  103 lines  |  [TEXT/CWIE]

  1. void HandleError(int errNum, Str255 errStr);
  2. short OpenPPPPrefs(void);
  3. void GetPPPPref(struct ppp_pref *thePref);
  4. void GetPPPConfig(struct ppp_config *theConfig,short confignum);
  5. void PutPPPPref(struct ppp_pref thePref);
  6. void PutPPPConfig(struct ppp_config theConfig,short confignum);
  7. void DeletePPPConfig(short confignum);
  8. void AddPPPConfig(struct ppp_config theConfig);
  9.  
  10. typedef unsigned char b_8;                /* 8-bit quantity */
  11. typedef unsigned short b_16;            /* 16-bit quantity */
  12. typedef unsigned long b_32;                /* 32-bit quantity */
  13.  
  14. #define MAXSLEN 42        /* max string length */
  15. #define NUMCOMMANDS 8    /* number of strings */
  16. #define PREF_VERSION 3    /* version of prefs file */
  17. #define NUMCONFIGS 4    /* number of configurations */
  18.  
  19. struct lcp_value_s {
  20.     b_16    mru;            /* Maximum Receive Unit */
  21.     b_16    authentication;    /* Authentication protocol */
  22.     b_32    accm;            /* Async Control Char Map */
  23.     b_32    magic_number;    /* Magic number value */
  24. };
  25.  
  26. struct ipcp_value_s {
  27.     b_32    address;        /* address for this side */
  28.     b_32    other;            /* address for other side */
  29.     b_16    compression;    /* Compression protocol */
  30.     b_16    slots;            /* Slots (0-n)*/
  31.     b_8        slot_compress;    /* Slots may be compressed (flag)*/
  32. };
  33.  
  34. union value_s {
  35.     struct    lcp_value_s lcp_option;
  36.     struct    ipcp_value_s ipcp_option;
  37. };
  38.  
  39. struct lcp_will_want {
  40.     b_16    will_negotiate, want_negotiate;
  41.     struct    lcp_value_s want;
  42. };
  43.  
  44. struct lcpconfig {
  45.     struct lcp_will_want local, remote;
  46.     b_8        req_tries;
  47.     b_8        timeout;
  48. };
  49.  
  50. struct ppp_pref {
  51.     b_16    version;        /* version of Preferences file (should be 3) */
  52.     b_8        portname[32];    /* port name (from CommToolBox) */
  53.     Boolean    hangup;            /* send modem hangup command on close */
  54.     Boolean    use_pulse;        /* use pulse for dialing */
  55.     Boolean quiet;            /* Quiet mode flag */
  56.     Boolean use_term;        /* bring up a terminal window on connection establishment */
  57.     b_16    timeout;        /* idle timeout (minutes), 0 = none */
  58.     b_16    echo;            /* PPP LCP echo interval  0 = off */
  59.     b_16    active_config;    /* active config index */
  60.     b_16    max_config;        /* maximum conifg index */
  61.     b_16    echo_tries;        /* number of echos before down */
  62.     b_16    max_window;        /* maximum window size */
  63. };
  64.  
  65. /*    And this is the structure of ppp_config : */
  66.  
  67. struct ipcp_will_want {
  68.     b_16    will_negotiate, want_negotiate;
  69.     struct    ipcp_value_s want;
  70. };
  71.  
  72. struct ipcpconfig {
  73.     struct ipcp_will_want local, remote;
  74.     b_8        req_tries;
  75.     b_8        timeout;
  76. };
  77.  
  78. struct ppp_config {
  79.     struct    lcpconfig    lcpconf;
  80.     struct    ipcpconfig    ipcpconf;
  81.     b_8        pap_retries;                /* number of tries for PAP */
  82.     b_8        pap_timeout;            /* timeout for PAP */
  83.     b_16    connecttimeout;
  84.     b_16    waittimeout;
  85.     b_16    baudrate;        /* port speed */
  86.     b_8        flags;
  87. #define CTSBIT 0x1
  88. #define RTSBIT 0x2
  89. #define FLOWBITS CTSBIT+RTSBIT
  90. #define USE_PULSE 0x4
  91.     b_8        config_name[MAXSLEN + 1];        /* configuration name */
  92.     b_8        defaultid[MAXSLEN + 1];        /* add one for length byte */
  93.     b_8        defaultpw[MAXSLEN + 1];
  94.     b_8        modeminit[MAXSLEN + 1];
  95.     b_8        phonenum[MAXSLEN + 1];
  96.     struct {
  97.         Boolean    sendout;        /* should we send or wait for this string */
  98.         Boolean addreturn;        /* add a carriage return to end of string */
  99.         b_8        scriptstr[MAXSLEN + 1];    /* script string */
  100.     } commands[NUMCOMMANDS];
  101. };
  102.  
  103.