blob: c9991fec341b1931ea1aa1685d3c6776dafc58da [file] [log] [blame]
oliverschmidt3396e9a2004-08-20 12:29:54 +00001#ifndef __PPP_H__
2#define __PPP_H__
3/* www.mycal.net
4---------------------------------------------------------------------------
5 ppp.h - ppp header file
6---------------------------------------------------------------------------
7 Version
8 0.1 Original Version June 3, 2000
9 (c)2000 Mycal Labs, All Rights Reserved
10 --------------------------------------------------------------------------- */
11/*
12 * Copyright (c) 2003, Mike Johnson, Mycal Labs, www.mycal.net
13 * All rights reserved.
14 *
15 * Redistribution and use in source and binary forms, with or without
16 * modification, are permitted provided that the following conditions
17 * are met:
18 * 1. Redistributions of source code must retain the above copyright
19 * notice, this list of conditions and the following disclaimer.
20 * 2. Redistributions in binary form must reproduce the above copyright
21 * notice, this list of conditions and the following disclaimer in the
22 * documentation and/or other materials provided with the distribution.
23 * 3. All advertising materials mentioning features or use of this software
24 * must display the following acknowledgement:
25 * This product includes software developed by Mike Johnson/Mycal Labs
26 * www.mycal.net.
27 * 4. The name of the author may not be used to endorse or promote
28 * products derived from this software without specific prior
29 * written permission.
30 *
31 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
32 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
33 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
34 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
35 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
37 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
38 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
39 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
40 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
41 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42 *
43 * This file is part of the Mycal Modified uIP TCP/IP stack.
44 *
oliverschmidt85729cb2005-01-26 23:36:22 +000045 * $Id: ppp.h,v 1.4 2005/01/26 23:36:22 oliverschmidt Exp $
oliverschmidt3396e9a2004-08-20 12:29:54 +000046 *
47 */
48#include "uip.h"
49#include "ppp-conf.h"
50#include "ahdlc.h"
51#include "lcp.h"
52#include "ipcp.h"
53#include "pap.h"
54#include "ppp_arch.h"
55/*#include "mip.h"*/
56
57/* moved to pppconfig.h
58#define PPP_RX_BUFFER_SIZE 1024
59#define PPP_TX_BUFFER_SIZE 64*/
60
61#define CRC_GOOD_VALUE 0xf0b8
62
63/* ppp_rx_status values */
64#define PPP_RX_IDLE 0
65#define PPP_READY 1
66
67/* ppp flags */
68#define PPP_ESCAPED 0x1
69#define PPP_RX_READY 0x2
70#define PPP_RX_ASYNC_MAP 0x8
71#define PPP_TX_ASYNC_MAP 0x8
72#define PPP_PFC 0x10
73#define PPP_ACFC 0x20
74
75/* Supported PPP Protocols */
76#define LCP 0xc021
77#define PAP 0xc023
78#define IPCP 0x8021
79#define IPV4 0x0021
80
81/* LCP codes packet types */
82#define CONF_REQ 0x1
83#define CONF_ACK 0x2
84#define CONF_NAK 0x3
85#define CONF_REJ 0x4
86#define TERM_REQ 0x5
87#define TERM_ACK 0x6
88#define PROT_REJ 0x8
89
90/* Raise PPP config bits */
91#define USE_PAP 0x1
92#define USE_NOACCMBUG 0x2
93#define USE_GETDNS 0x4
94
oliverschmidt85729cb2005-01-26 23:36:22 +000095#define ppp_setusername(un) strncpy(pap_username, (un), PAP_USERNAME_SIZE)
96#define ppp_setpassword(pw) strncpy(pap_password, (pw), PAP_PASSWORD_SIZE)
oliverschmidta0f331a2004-08-22 21:10:02 +000097
oliverschmidt3396e9a2004-08-20 12:29:54 +000098/*
99 * Export Variables
100 */
101/*extern u8_t ppp_tx_buffer[PPP_TX_BUFFER_SIZE];*/
102extern u8_t ppp_rx_buffer[];
103extern u8_t ppp_rx_count;
104
105typedef union {
106 u8_t ip8[4];
107 u16_t ip16[2];
108} uip_ipaddr_t;
109
110extern uip_ipaddr_t our_ipaddr;
111
112/*extern u16_t ppp_crc_error;*/
113
114extern u8_t ppp_flags;
115extern u8_t ppp_status;
116/*extern u16_t ppp_rx_crc; */
117extern u16_t ppp_rx_tobig_error;
118extern u8_t ppp_lcp_state;
119
120extern u8_t ppp_id;
121extern u8_t ppp_retry;
122
123/*
124 * Function Prototypes
125 */
126void ppp_init(void);
oliverschmidta0f331a2004-08-22 21:10:02 +0000127void ppp_connect(void);
oliverschmidt3396e9a2004-08-20 12:29:54 +0000128
129void ppp_send(void);
130void ppp_poll(void);
131
132void ppp_upcall(u16_t, u8_t *, u16_t);
133u16_t scan_packet(u16_t, u8_t *list, u8_t *buffer, u8_t *options, u16_t len);
134
oliverschmidte9a32572004-08-22 12:35:12 +0000135#endif /* __PPP_H__ */