33#ifndef LWIP_HDR_PPP_IMPL_H
34#define LWIP_HDR_PPP_IMPL_H
40#ifdef PPP_INCLUDE_SETTINGS_HEADER
41#include "ppp_settings.h"
66#define PPP_CTRL_PBUF_UNKNOWN_SIZE 512
71#define PPP_ADDRESS(p) (((u_char *)(p))[0])
72#define PPP_CONTROL(p) (((u_char *)(p))[1])
73#define PPP_PROTOCOL(p) ((((u_char *)(p))[2] << 8) + ((u_char *)(p))[3])
78#define PPP_ALLSTATIONS 0xff
81#define PPP_ESCAPE 0x7d
88#define PPP_DEFMRU 1500
101#define PPP_VJC_COMP 0x2d
102#define PPP_VJC_UNCOMP 0x2f
110#define PPP_IPCP 0x8021
112#define PPP_ATCP 0x8029
113#define PPP_IPXCP 0x802b
116#define PPP_IPV6CP 0x8057
119#define PPP_CCP 0x80fd
122#define PPP_ECP 0x8053
124#define PPP_LCP 0xc021
126#define PPP_PAP 0xc023
129#define PPP_LQR 0xc025
132#define PPP_CHAP 0xc223
135#define PPP_CBCP 0xc029
138#define PPP_EAP 0xc227
145struct link_callbacks {
161 void (*send_config)(ppp_pcb *pcb,
void *
ctx,
u32_t accm,
int pcomp,
int accomp);
163 void (*recv_config)(ppp_pcb *pcb,
void *
ctx,
u32_t accm,
int pcomp,
int accomp);
181 unsigned int ppp_ibytes;
182 unsigned int ppp_ipackets;
183 unsigned int ppp_ierrors;
184 unsigned int ppp_obytes;
185 unsigned int ppp_opackets;
186 unsigned int ppp_oerrors;
191 unsigned int vjs_packets;
192 unsigned int vjs_compressed;
193 unsigned int vjs_searches;
194 unsigned int vjs_misses;
195 unsigned int vjs_uncompressedin;
196 unsigned int vjs_compressedin;
197 unsigned int vjs_errorin;
198 unsigned int vjs_tossed;
211 unsigned int unc_bytes;
212 unsigned int unc_packets;
213 unsigned int comp_bytes;
214 unsigned int comp_packets;
215 unsigned int inc_bytes;
216 unsigned int inc_packets;
220struct ppp_comp_stats {
245#define EPD_PHONENUM 5
251extern u8_t multilink;
252extern u8_t doing_multilink;
253extern u8_t multilink_master;
254extern u8_t bundle_eof;
255extern u8_t bundle_terminating;
259extern unsigned int maxoctets;
260extern int maxoctets_dir;
265extern int maxoctets_timeout;
266#define PPP_OCTETS_DIRECTION_SUM 0
267#define PPP_OCTETS_DIRECTION_IN 1
268#define PPP_OCTETS_DIRECTION_OUT 2
269#define PPP_OCTETS_DIRECTION_MAXOVERAL 3
271#define PPP_OCTETS_DIRECTION_MAXSESSION 4
277#define PPP_DATAINPUT 0
290 void (*protrej) (ppp_pcb *pcb);
292 void (*lowerup) (ppp_pcb *pcb);
294 void (*lowerdown) (ppp_pcb *pcb);
302 void (*printer) (
void *,
const char *, ...),
311 const char *data_name;
327extern const struct protent*
const protocols[];
332#define PAP_WITHPEER 0x1
336#define CHAP_WITHPEER 0x4
340#define EAP_WITHPEER 0x10
346#define CHAP_MD5_WITHPEER 0x40
347#define CHAP_MD5_PEER 0x80
349#define CHAP_MS_SHIFT 8
350#define CHAP_MS_WITHPEER 0x100
351#define CHAP_MS_PEER 0x200
352#define CHAP_MS2_WITHPEER 0x400
353#define CHAP_MS2_PEER 0x800
361#define CHAP_MDTYPE_SUPPORTED (MDTYPE_MICROSOFT_V2 | MDTYPE_MICROSOFT | MDTYPE_MD5)
363#define CHAP_MDTYPE_SUPPORTED (MDTYPE_MD5)
367#define CHAP_MDTYPE_SUPPORTED (MDTYPE_NONE)
375 unsigned int bytes_in;
376 unsigned int bytes_out;
377 unsigned int pkts_in;
378 unsigned int pkts_out;
400ppp_pcb *ppp_new(
struct netif *pppif,
const struct link_callbacks *
callbacks,
void *link_ctx_cb,
401 ppp_link_status_cb_fn link_status_cb,
void *ctx_cb);
404void ppp_start(ppp_pcb *pcb);
407void ppp_link_failed(ppp_pcb *pcb);
410void ppp_link_end(ppp_pcb *pcb);
413void ppp_input(ppp_pcb *pcb,
struct pbuf *pb);
424void ppp_link_terminated(ppp_pcb *pcb);
426void new_phase(ppp_pcb *pcb,
int p);
428int ppp_send_config(ppp_pcb *pcb,
int mtu,
u32_t accm,
int pcomp,
int accomp);
429int ppp_recv_config(ppp_pcb *pcb,
int mru,
u32_t accm,
int pcomp,
int accomp);
433int cifaddr(ppp_pcb *pcb,
u32_t our_adr,
u32_t his_adr);
435int sifproxyarp(ppp_pcb *pcb,
u32_t his_adr);
436int cifproxyarp(ppp_pcb *pcb,
u32_t his_adr);
443int sifvjcomp(ppp_pcb *pcb,
int vjcomp,
int cidcomp,
int maxcid);
445int sifup(ppp_pcb *pcb);
446int sifdown (ppp_pcb *pcb);
451int sif6addr(ppp_pcb *pcb, eui64_t our_eui64, eui64_t his_eui64);
452int cif6addr(ppp_pcb *pcb, eui64_t our_eui64, eui64_t his_eui64);
453int sif6up(ppp_pcb *pcb);
454int sif6down (ppp_pcb *pcb);
458int sifnpmode(ppp_pcb *pcb,
int proto,
enum NPmode
mode);
461void ppp_netif_set_mtu(ppp_pcb *pcb,
int mtu);
462int ppp_netif_get_mtu(ppp_pcb *pcb);
466int ccp_test(ppp_pcb *pcb,
u_char *opt_ptr,
int opt_len,
int for_transmit);
468void ccp_set(ppp_pcb *pcb,
u8_t isopen,
u8_t isup,
u8_t receive_method,
u8_t transmit_method);
469void ccp_reset_comp(ppp_pcb *pcb);
470void ccp_reset_decomp(ppp_pcb *pcb);
472int ccp_fatal_error(ppp_pcb *pcb);
477int get_idle_time(ppp_pcb *pcb,
struct ppp_idle *
ip);
481int get_loop_output(
void);
486const char * protocol_name(
int proto);
491void print_link_stats(
void);
492void reset_link_stats(
int u);
493void update_link_stats(
int u);
504#define GETCHAR(c, cp) { \
507#define PUTCHAR(c, cp) { \
508 *(cp)++ = (u_char) (c); \
510#define GETSHORT(s, cp) { \
511 (s) = *(cp)++ << 8; \
514#define PUTSHORT(s, cp) { \
515 *(cp)++ = (u_char) ((s) >> 8); \
516 *(cp)++ = (u_char) (s); \
518#define GETLONG(l, cp) { \
519 (l) = *(cp)++ << 8; \
520 (l) |= *(cp)++; (l) <<= 8; \
521 (l) |= *(cp)++; (l) <<= 8; \
524#define PUTLONG(l, cp) { \
525 *(cp)++ = (u_char) ((l) >> 24); \
526 *(cp)++ = (u_char) ((l) >> 16); \
527 *(cp)++ = (u_char) ((l) >> 8); \
528 *(cp)++ = (u_char) (l); \
531#define INCPTR(n, cp) ((cp) += (n))
532#define DECPTR(n, cp) ((cp) -= (n))
537#define TIMEOUT(f, a, t) do { sys_untimeout((f), (a)); sys_timeout((t)*1000, (f), (a)); } while(0)
538#define TIMEOUTMS(f, a, t) do { sys_untimeout((f), (a)); sys_timeout((t), (f), (a)); } while(0)
539#define UNTIMEOUT(f, a) sys_untimeout((f), (a))
541#define BZERO(s, n) memset(s, 0, n)
542#define BCMP(s1, s2, l) memcmp(s1, s2, l)
544#define PRINTMSG(m, l) { ppp_info(("Remote message: %0.*v", l, m)); }
549#define MAKEHEADER(p, t) { \
550 PUTCHAR(PPP_ALLSTATIONS, p); \
551 PUTCHAR(PPP_UI, p); \
555void link_required(ppp_pcb *pcb);
556void link_terminated(ppp_pcb *pcb);
557void link_down(ppp_pcb *pcb);
558void upper_layers_down(ppp_pcb *pcb);
559void link_established(ppp_pcb *pcb);
560void start_networks(ppp_pcb *pcb);
561void continue_networks(ppp_pcb *pcb);
564int auth_check_passwd(ppp_pcb *pcb,
char *auser,
unsigned int userlen,
char *apasswd,
unsigned int passwdlen,
const char **
msg,
int *msglen);
566void auth_peer_fail(ppp_pcb *pcb,
int protocol);
568void auth_peer_success(ppp_pcb *pcb,
int protocol,
int prot_flavor,
const char *
name,
int namelen);
571void auth_withpeer_fail(ppp_pcb *pcb,
int protocol);
573void auth_withpeer_success(ppp_pcb *pcb,
int protocol,
int prot_flavor);
576void np_up(ppp_pcb *pcb,
int proto);
577void np_down(ppp_pcb *pcb,
int proto);
578void np_finished(ppp_pcb *pcb,
int proto);
580int get_secret(ppp_pcb *pcb,
const char *
client,
const char *
server,
char *
secret,
int *secret_len,
int am_server);
589void demand_conf (
void);
590void demand_block (
void);
591void demand_unblock (
void);
592void demand_discard (
void);
593void demand_rexmit (
int,
u32_t);
594int loop_chars (
unsigned char *,
int);
595int loop_frame (
unsigned char *,
int);
600void mp_check_options (
void);
601int mp_join_bundle (
void);
602void mp_exit_bundle (
void);
603void mp_bundle_terminated (
void);
604char *epdisc_to_str (
struct epdisc *);
605int str_to_epdisc (
struct epdisc *,
char *);
607#define mp_bundle_terminated()
608#define mp_exit_bundle()
609#define doing_multilink 0
610#define multilink_master 0
614void ppp_print_string(
const u_char *
p,
int len,
void (*printer) (
void *,
const char *, ...),
void *
arg);
615int ppp_slprintf(
char *
buf,
int buflen,
const char *
fmt, ...);
617size_t ppp_strlcpy(
char *
dest,
const char *
src,
size_t len);
618size_t ppp_strlcat(
char *
dest,
const char *
src,
size_t len);
619void ppp_dbglog_impl(
const char *
fmt, ...);
620void ppp_info_impl(
const char *
fmt, ...);
621void ppp_notice_impl(
const char *
fmt, ...);
622void ppp_warn_impl(
const char *
fmt, ...);
623void ppp_error_impl(
const char *
fmt, ...);
624void ppp_fatal_impl(
const char *
fmt, ...);
626#define ppp_dbglog(x) do { if (LWIP_DEBUG_ENABLED(LOG_DEBUG)) { ppp_dbglog_impl x; }} while(0)
627#define ppp_info(x) do { if (LWIP_DEBUG_ENABLED(LOG_INFO)) { ppp_info_impl x; }} while(0)
628#define ppp_notice(x) do { if (LWIP_DEBUG_ENABLED(LOG_NOTICE)) { ppp_notice_impl x; }} while(0)
629#define ppp_warn(x) do { if (LWIP_DEBUG_ENABLED(LOG_WARNING)) { ppp_warn_impl x; }} while(0)
630#define ppp_error(x) do { if (LWIP_DEBUG_ENABLED(LOG_ERR)) { ppp_error_impl x; }} while(0)
631#define ppp_fatal(x) do { if (LWIP_DEBUG_ENABLED(LOG_CRITICAL)) { ppp_fatal_impl x; }} while(0)
633void ppp_dump_packet(ppp_pcb *pcb,
const char *
tag,
unsigned char *
p,
int len);
static err_t netif_output(struct netif *netif, struct pbuf *p)
void disconnect(int argc, const char *argv[])
struct protocol * protocols
static WCHAR reason[MAX_STRING_RESOURCE_LEN]
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
GLenum GLuint GLenum GLsizei const GLchar * buf
GLenum const GLvoid * addr
GLenum GLenum GLenum input
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
static DATA_BLOB CRYPTPROTECT_PROMPTSTRUCT DATA_BLOB *static LPWSTR DATA_BLOB CRYPTPROTECT_PROMPTSTRUCT DATA_BLOB *static char secret[]
png_const_structrp png_const_inforp int * unit
INT WSAAPI listen(IN SOCKET s, IN INT backlog)
static rfbScreenInfoPtr server