ppp.h

来自「阿根廷教授编写的嵌入式internet的实验教程的高质量代码」· C头文件 代码 · 共 48 行

H
48
字号
/******************************************************************************************
   ppp.h (v1.0)
-------------------------------------------------------------------------------------
This code is from the book:
"Embedded Internet: TCP/IP Basics, Implementation and Applications" by Sergio Scaglia
[Pearson Education, 2006 - ISBN: 0-32-130638-4]

This code is copyright (c) 2006 by Sergio Scaglia, and it may only be used for educational
purposes.  For commercial use, please contact me at sscaglia@intramarket.com.ar
For more information and updates, please visit www.embeddedinternet.org
******************************************************************************************/

#ifndef __ppp_H
#define __ppp_H

#define HTONS(n) ((((unsigned short)((n) & 0xff)) << 8) | (((n) & 0xff00) >> 8))
#define PPP   ((struct ppp_hdr *)&rx_buf[0])
#define CTRL  ((struct ppp_ctl_hdr *)&rx_buf[DATALINK_HDR_SIZE])

#define LCP_PROTOCOL  0xC021
#define PAP_PROTOCOL  0xC023
#define CHAP_PROTOCOL 0xC223
#define CCP_PROTOCOL  0x80FD
#define IPCP_PROTOCOL 0x8021
#define IP_PROTOCOL   0x0021

#define ICMP_PROTOCOL 1
#define UDP_PROTOCOL  17
#define TCP_PROTOCOL  6

#define REQ  	 1
#define ACKW  	 2
#define NAK  	 3
#define REJ  	 4
#define TERM_REQ 5
#define TERM_ACK 6

extern char rx_buf[];
extern char tx_buf[];
extern char MyIP[];
extern char server[];


void ppp_poll(void);
void ppp_send(unsigned short protocol, unsigned short);

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?