www.pudn.com > 8051_pppsrc.zip > PPP.H, change:2001-03-12,size:1964b


/*///////////////////////////////////////////////////////////////////////////// 
 
File Name : PPP.h 
 
Author : Rene Trenado 
 
Location : Motorola Applications Lab, Baja California 
 
Date Created : September 2000 
 
Current Revision : 0.0 
 
Notes : Definitions for the PPP implementation 
 
/////////////////////////////////////////////////////////////////////////////*/ 
#ifndef __PPP_H 
#define __PPP_H	1 
 
#include "Notation.h" 
 
#ifndef	NULL 
#define NULL	0 
#endif 
 
#define ESC	0x7D 
#define END	0x7E 
 
#define	REQ		1 
#define ACK		2 
#define NAK		3 
#define REJ		4 
#define TERMINATE	5 
#define TERMINATE_ACK	6 
 
typedef struct { 
	WORD Framing; 
	WORD Protocol; 
	BYTE Request; 
	BYTE Id; 
	BYTE LengthHigh; 
	BYTE Length; 
	BYTE FirstOption; 
	BYTE FirstOptionLength; 
	BYTE Param; 
	BYTE Data; 
} PPPFrame; 
 
 
#define PPPINITFCS16    0xffff  /* Initial FCS value */ 
#define PPPGOODFCS16    0xf0b8  /* Good final FCS value */ 
 
////////////// Functions to Export //////// 
void PPPInit (void); 
BYTE *PPPGetInputBuffer (void); 
BYTE *PPPGetOutputBuffer (void); 
void ProcPPPReceive (register BYTE c); 
void ProcPPPSend (BYTE *Buffer, BYTE len); 
WORD PPPGetChecksum (register unsigned char *cp, register int len); 
void SendPAPPacket (BYTE Action, BYTE ID, char* user, char* password); 
void Move (BYTE *src, BYTE *dest, register numBYTEs); 
void PPPEntry (void); 
void PPPTerminate (void); 
void PPPSendVoidLCP (void); 
 
extern volatile BYTE PPPStatus; 
 
#define 	IsESC  	0x01		// Previous character received was a ESC char 
#define 	ReSync 	0x04		// Re Synchronize to avoid inconplete IP frame reception 
#define 	IsFrame	0x08		// A full packet 
#define 	ByteRx 	0x10		// Receive a Byte 
#define		LinkOn	0x20		// PPP Link is On 
 
extern BYTE IPAddress[4]; 
 
#define PPP_BUFFER_SIZE	88 
 
#define LCP_PACKET	0xC021 
#define PAP_PACKET	0xC023 
#define CHAP_PACKET	0xC223 
#define IPCP_PACKET	0x8021 
#define IP_DATAGRAM	0x0021 
 
#endif