/* * pppd.h - PPP daemon global declarations. * * Copyright © 1996 Digital Equipment Corporation. * All rights reserved. * * Copyright (c) 1989 Carnegie Mellon University. * All rights reserved. * * Redistribution and use in source and binary forms are permitted * provided that the above copyright notice and this paragraph are * duplicated in all such forms and that any documentation, * advertising materials, and other materials related to such * distribution and use acknowledge that the software was developed * by Carnegie Mellon University. The name of the * University may not be used to endorse or promote products derived * from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * * $Id: pppd.h,v 1.8 1995/04/26 06:46:31 paulus Exp $ */ #ifndef _PPPD_H_ #define _PPPD_H_ /* ** Define standard types */ typedef char * caddr_t; typedef unsigned char u_char; typedef unsigned short u_short; typedef unsigned int u_int; typedef unsigned long u_long; /* ** Define macro for prototyping */ #ifndef __P #ifdef __STDC__ #define __P(x) x #else #define __P(x) () #endif #endif /* * A 32-bit unsigned integral type. */ #if !defined(__BIT_TYPES_DEFINED__) && !defined(_BITYPES) #ifdef UINT32_T typedef UINT32_T u_int32_t; #else typedef unsigned int u_int32_t; #endif #endif /* ** Define a line identifier ** ** lineId = refCnt:bits 31-16 + index:bits 15-0 */ typedef int lineId; /* ** Memory allocation and deallocation routines */ #ifdef USER #include #define ALLOC_MEM( ptr, size, cast ) ptr = (cast)malloc((size)) #define DEALLOC_MEM( ptr ) free((void *)(ptr)) #else #include "ppp_mem_vms.h" #endif /* * Inline versions of get/put char/short/long. * Pointer is advanced; we assume that both arguments * are lvalues and will already be in registers. * cp MUST be u_char *. */ #define GETCHAR(c, cp) { \ (c) = *(cp)++; \ } #define PUTCHAR(c, cp) { \ *(cp)++ = (u_char) (c); \ } #define GETSHORT(s, cp) { \ (s) = *(cp)++ << 8; \ (s) |= *(cp)++; \ } #define PUTSHORT(s, cp) { \ *(cp)++ = (u_char) ((s) >> 8); \ *(cp)++ = (u_char) (s); \ } #define GETLONG(l, cp) { \ (l) = *(cp)++ << 8; \ (l) |= *(cp)++; (l) <<= 8; \ (l) |= *(cp)++; (l) <<= 8; \ (l) |= *(cp)++; \ } #define PUTLONG(l, cp) { \ *(cp)++ = (u_char) ((l) >> 24); \ *(cp)++ = (u_char) ((l) >> 16); \ *(cp)++ = (u_char) ((l) >> 8); \ *(cp)++ = (u_char) (l); \ } #define INCPTR(n, cp) ((cp) += (n)) #define DECPTR(n, cp) ((cp) -= (n)) #undef FALSE #define FALSE 0 #undef TRUE #define TRUE 1 #include "string.h" #define BCOPY(s, d, l) memcpy(d, s, l) #define BZERO(s, n) memset(s, 0, n) #ifndef MIN #define MIN(a, b) ((a) < (b)? (a): (b)) #endif #ifndef MAX #define MAX(a, b) ((a) > (b)? (a): (b)) #endif #define PPP_HDRLEN 4 /* octets for standard ppp header */ #define PPP_FCSLEN 2 /* octets for FCS */ #define PPP_MRU 1500 /* default MRU = max length of info field */ /* * Significant octet values. */ #define PPP_ALLSTATIONS 0xff /* All-Stations broadcast address */ #define PPP_UI 0x03 /* Unnumbered Information */ #define PPP_FLAG 0x7e /* Flag Sequence */ #define PPP_ESCAPE 0x7d /* Asynchronous Control Escape */ #define PPP_TRANS 0x20 /* Asynchronous transparency modifier */ /* * Protocol field values. */ #define PPP_IP 0x21 /* Internet Protocol */ #define PPP_VJC_COMP 0x2d /* VJ compressed TCP */ #define PPP_VJC_UNCOMP 0x2f /* VJ uncompressed TCP */ #define PPP_COMP 0xfd /* compressed packet */ #define PPP_IPCP 0x8021 /* IP Control Protocol */ #define PPP_CCP 0x80fd /* Compression Control Protocol */ #define PPP_LCP 0xc021 /* Link Control Protocol */ #define PPP_PAP 0xc023 /* Password Authentication Protocol */ #define PPP_LQR 0xc025 /* Link Quality Report protocol */ #define PPP_CHAP 0xc223 /* Cryptographic Handshake Auth. Protocol */ /* ** ** import definitions: ** LOG_xxx defines ** ppp_log() ** */ #ifndef _PPP_LOG_H_ #include "ppp_log.h" #endif #define FSMDEBUG(x) ppp_log x #define LCPDEBUG(x) ppp_log x #define PPPDEBUG(x) ppp_log x #define TRANSMITDEBUG(x) ppp_log_overload x #define RECEIVEDEBUG(x) ppp_log_overload x #ifndef MIN #define MIN(a,b) ((a) < (b)? (a): (b)) #endif #ifndef MAX #define MAX(a,b) ((a) > (b)? (a): (b)) #endif /* ** ** import definitions: ** timeout ** untimeout ** */ #ifndef _PPP_TIMER_H_ #include "ppp_timer.h" #endif #define TIMEOUT(r, f, t) timeout((r), (f), (t)) #define UNTIMEOUT(r, f) untimeout((r), (f)) #endif /* _PPP_H_ */