1 |
786 |
skrzyp |
#ifndef CYGONCE_PPP_PPP_H
|
2 |
|
|
#define CYGONCE_PPP_PPP_H
|
3 |
|
|
|
4 |
|
|
//==========================================================================
|
5 |
|
|
//
|
6 |
|
|
// ppp.h
|
7 |
|
|
//
|
8 |
|
|
// PPP system interface
|
9 |
|
|
//
|
10 |
|
|
//==========================================================================
|
11 |
|
|
// ####ECOSGPLCOPYRIGHTBEGIN####
|
12 |
|
|
// -------------------------------------------
|
13 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
14 |
|
|
// Copyright (C) 2003, 2004 Free Software Foundation, Inc.
|
15 |
|
|
//
|
16 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
17 |
|
|
// the terms of the GNU General Public License as published by the Free
|
18 |
|
|
// Software Foundation; either version 2 or (at your option) any later
|
19 |
|
|
// version.
|
20 |
|
|
//
|
21 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT
|
22 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
23 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
24 |
|
|
// for more details.
|
25 |
|
|
//
|
26 |
|
|
// You should have received a copy of the GNU General Public License
|
27 |
|
|
// along with eCos; if not, write to the Free Software Foundation, Inc.,
|
28 |
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
29 |
|
|
//
|
30 |
|
|
// As a special exception, if other files instantiate templates or use
|
31 |
|
|
// macros or inline functions from this file, or you compile this file
|
32 |
|
|
// and link it with other works to produce a work based on this file,
|
33 |
|
|
// this file does not by itself cause the resulting work to be covered by
|
34 |
|
|
// the GNU General Public License. However the source code for this file
|
35 |
|
|
// must still be made available in accordance with section (3) of the GNU
|
36 |
|
|
// General Public License v2.
|
37 |
|
|
//
|
38 |
|
|
// This exception does not invalidate any other reasons why a work based
|
39 |
|
|
// on this file might be covered by the GNU General Public License.
|
40 |
|
|
// -------------------------------------------
|
41 |
|
|
// ####ECOSGPLCOPYRIGHTEND####
|
42 |
|
|
//==========================================================================
|
43 |
|
|
//#####DESCRIPTIONBEGIN####
|
44 |
|
|
//
|
45 |
|
|
// Author(s): nickg
|
46 |
|
|
// Contributors: nickg
|
47 |
|
|
// Date: 2002-05-22
|
48 |
|
|
// Purpose: PPP interface
|
49 |
|
|
// Description: PPP sybsystem interface definitions
|
50 |
|
|
// Usage: #include "cyg/ppp/ppp.h"
|
51 |
|
|
// ...
|
52 |
|
|
//
|
53 |
|
|
//####DESCRIPTIONEND####
|
54 |
|
|
//
|
55 |
|
|
//==========================================================================
|
56 |
|
|
|
57 |
|
|
#include <pkgconf/system.h>
|
58 |
|
|
#include <pkgconf/ppp.h>
|
59 |
|
|
|
60 |
|
|
#include <cyg/infra/cyg_type.h>
|
61 |
|
|
|
62 |
|
|
#include <cyg/io/serialio.h>
|
63 |
|
|
|
64 |
|
|
#define MAXNAMELEN 256
|
65 |
|
|
#define MAXSECRETLEN 256
|
66 |
|
|
|
67 |
|
|
// -------------------------------------------------------------------------
|
68 |
|
|
// PPP instance
|
69 |
|
|
|
70 |
|
|
typedef CYG_ADDRWORD cyg_ppp_handle_t;
|
71 |
|
|
|
72 |
|
|
// -------------------------------------------------------------------------
|
73 |
|
|
/* PPP failure statistics */
|
74 |
|
|
typedef struct {
|
75 |
|
|
int auth_failures; /* PAP or CHAP failures */
|
76 |
|
|
int no_proto; /* No network protocol running */
|
77 |
|
|
int idle_timeout; /* Idle timer expired */
|
78 |
|
|
int connect_time_expired; /* Max connect time expired */
|
79 |
|
|
int loopback; /* Loopback detected */
|
80 |
|
|
int no_response; /* Peer not responding */
|
81 |
|
|
} cyg_ppp_stats_t;
|
82 |
|
|
extern cyg_ppp_stats_t cyg_ppp_stats; /* PPP statistics */
|
83 |
|
|
// -------------------------------------------------------------------------
|
84 |
|
|
// PPP negotiated addresses
|
85 |
|
|
typedef struct {
|
86 |
|
|
u_int32_t local_ip; /* Local ip address */
|
87 |
|
|
u_int32_t peer_ip; /* Peer ip address */
|
88 |
|
|
u_int32_t pri_dns; /* Primary DNS address */
|
89 |
|
|
u_int32_t alt_dns; /* Alternate DNS address */
|
90 |
|
|
u_int32_t pri_wins; /* Primary WINS address */
|
91 |
|
|
u_int32_t alt_wins; /* Alternate WINS address */
|
92 |
|
|
} cyg_ppp_neg_addrs_t;
|
93 |
|
|
|
94 |
|
|
// -------------------------------------------------------------------------
|
95 |
|
|
typedef struct
|
96 |
|
|
{
|
97 |
|
|
unsigned int
|
98 |
|
|
debug : 1, /* Debug flag */
|
99 |
|
|
kdebugflag : 5, /* Tell kernel to print debug messages */
|
100 |
|
|
default_route : 1, /* Set up default route via PPP link */
|
101 |
|
|
modem : 1, /* Use modem control lines */
|
102 |
|
|
flowctl : 2, /* Flow control, see below */
|
103 |
|
|
refuse_pap : 1, /* Don't wanna auth. ourselves with PAP */
|
104 |
|
|
refuse_chap : 1, /* Don't wanna auth. ourselves with CHAP */
|
105 |
|
|
neg_accm : 1 /* Flag to enable ACCM negotiation */
|
106 |
|
|
;
|
107 |
|
|
cyg_serial_baud_rate_t baud; /* serial line baud rate */
|
108 |
|
|
|
109 |
|
|
int conf_accm; /* Configurable value of ACCM */
|
110 |
|
|
int idle_time_limit; /* Shut down link if idle for this long */
|
111 |
|
|
int maxconnect; /* Maximum connect time (seconds) */
|
112 |
|
|
|
113 |
|
|
cyg_uint32 our_address; /* Our IP address */
|
114 |
|
|
cyg_uint32 his_address; /* His IP address */
|
115 |
|
|
|
116 |
|
|
char **script; /* CHAT connection script */
|
117 |
|
|
|
118 |
|
|
char user[MAXNAMELEN]; /* Our name for authenticating ourselves */
|
119 |
|
|
char passwd[MAXSECRETLEN]; /* Password for PAP and secret for CHAP */
|
120 |
|
|
|
121 |
|
|
} cyg_ppp_options_t;
|
122 |
|
|
|
123 |
|
|
// -------------------------------------------------------------------------
|
124 |
|
|
/* Values for flowctl field */
|
125 |
|
|
|
126 |
|
|
#define CYG_PPP_FLOWCTL_DEFAULT 0 /* Default to current setting */
|
127 |
|
|
#define CYG_PPP_FLOWCTL_NONE 1 /* No flow control - not recommended */
|
128 |
|
|
#define CYG_PPP_FLOWCTL_HARDWARE 2 /* Hardware flow control - CTS/RTS */
|
129 |
|
|
#define CYG_PPP_FLOWCTL_SOFTWARE 3 /* Software flow control - XON/XOFF */
|
130 |
|
|
|
131 |
|
|
// -------------------------------------------------------------------------
|
132 |
|
|
|
133 |
|
|
externC cyg_int32 cyg_ppp_options_init( cyg_ppp_options_t *options );
|
134 |
|
|
|
135 |
|
|
// -------------------------------------------------------------------------
|
136 |
|
|
|
137 |
|
|
externC cyg_ppp_handle_t cyg_ppp_up( const char *devnam,
|
138 |
|
|
const cyg_ppp_options_t *options );
|
139 |
|
|
|
140 |
|
|
// -------------------------------------------------------------------------
|
141 |
|
|
|
142 |
|
|
externC cyg_int32 cyg_ppp_down( const cyg_ppp_handle_t handle );
|
143 |
|
|
|
144 |
|
|
|
145 |
|
|
// -------------------------------------------------------------------------
|
146 |
|
|
|
147 |
|
|
externC cyg_int32 cyg_ppp_wait_up( cyg_ppp_handle_t handle );
|
148 |
|
|
|
149 |
|
|
externC void cyg_ppp_wait_down( cyg_ppp_handle_t handle );
|
150 |
|
|
|
151 |
|
|
// -------------------------------------------------------------------------
|
152 |
|
|
|
153 |
|
|
externC cyg_int32 cyg_ppp_chat( const char *devname,
|
154 |
|
|
const char *script[] );
|
155 |
|
|
|
156 |
|
|
|
157 |
|
|
// -------------------------------------------------------------------------
|
158 |
|
|
#ifdef CYGOPT_PPP_NS_NEGOTIATE
|
159 |
|
|
externC u_int32_t cyg_ppp_get_neg_addrs(cyg_ppp_neg_addrs_t *addrs);
|
160 |
|
|
#endif
|
161 |
|
|
// -------------------------------------------------------------------------
|
162 |
|
|
#endif // CYGONCE_PPP_PPP_H multiple inclusion protection
|
163 |
|
|
// EOF ppp.h
|