ipcp.h revision 44455
1118611Snjl/* 2118611Snjl * Written by Toshiharu OHNO (tony-o@iij.ad.jp) 3118611Snjl * 4118611Snjl * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd. 5118611Snjl * 6118611Snjl * Redistribution and use in source and binary forms are permitted 7118611Snjl * provided that the above copyright notice and this paragraph are 8217365Sjkim * duplicated in all such forms and that any documentation, 9229989Sjkim * advertising materials, and other materials related to such 10118611Snjl * distribution and use acknowledge that the software was developed 11118611Snjl * by the Internet Initiative Japan. The name of the 12217365Sjkim * IIJ may not be used to endorse or promote products derived 13217365Sjkim * from this software without specific prior written permission. 14217365Sjkim * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 15217365Sjkim * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 16217365Sjkim * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 17217365Sjkim * 18217365Sjkim * $Id: ipcp.h,v 1.24 1999/02/26 21:28:12 brian Exp $ 19217365Sjkim * 20217365Sjkim * TODO: 21217365Sjkim */ 22217365Sjkim 23217365Sjkim#define IPCP_MAXCODE CODE_CODEREJ 24217365Sjkim 25217365Sjkim#define TY_IPADDRS 1 26118611Snjl#define TY_COMPPROTO 2 27217365Sjkim#define TY_IPADDR 3 28217365Sjkim 29217365Sjkim/* Domain NameServer and NetBIOS NameServer options */ 30118611Snjl 31217365Sjkim#define TY_PRIMARY_DNS 129 32217365Sjkim#define TY_PRIMARY_NBNS 130 33217365Sjkim#define TY_SECONDARY_DNS 131 34217365Sjkim#define TY_SECONDARY_NBNS 132 35217365Sjkim#define TY_ADJUST_NS 119 /* subtract from NS val for REJECT bit */ 36217365Sjkim 37217365Sjkimstruct sticky_route; 38217365Sjkim 39217365Sjkimstruct in_range { 40217365Sjkim struct in_addr ipaddr; 41217365Sjkim struct in_addr mask; 42217365Sjkim int width; 43217365Sjkim}; 44118611Snjl 45118611Snjlstruct ipcp { 46151937Sjkim struct fsm fsm; /* The finite state machine */ 47118611Snjl 48118611Snjl struct { 49118611Snjl struct { 50118611Snjl int slots; /* Maximum VJ slots */ 51151937Sjkim unsigned slotcomp : 1; /* Slot compression */ 52118611Snjl unsigned neg : 2; /* VJ negotiation */ 53151937Sjkim } vj; 54151937Sjkim 55151937Sjkim struct in_range my_range; /* MYADDR spec */ 56151937Sjkim struct in_addr netmask; /* Iface netmask (unused by most OSs) */ 57151937Sjkim struct in_range peer_range; /* HISADDR spec */ 58233250Sjkim struct iplist peer_list; /* Ranges of HISADDR values */ 59233250Sjkim 60233250Sjkim u_long sendpipe; /* route sendpipe size */ 61233250Sjkim u_long recvpipe; /* route recvpipe size */ 62233250Sjkim 63233250Sjkim struct in_addr TriggerAddress; /* Address to suggest in REQ */ 64233250Sjkim unsigned HaveTriggerAddress : 1; /* Trigger address specified */ 65233250Sjkim 66233250Sjkim struct { 67233250Sjkim struct in_addr dns[2]; /* DNS addresses offered */ 68233250Sjkim unsigned dns_neg : 2; /* dns negotiation */ 69233250Sjkim struct in_addr nbns[2]; /* NetBIOS NS addresses offered */ 70193529Sjkim } ns; 71193529Sjkim 72193529Sjkim struct fsm_retry fsm; /* How often/frequently to resend requests */ 73193529Sjkim } cfg; 74193529Sjkim 75193529Sjkim struct { 76193529Sjkim struct slcompress cslc; /* VJ state */ 77193529Sjkim struct slstat slstat; /* VJ statistics */ 78193529Sjkim } vj; 79193529Sjkim 80193529Sjkim struct sticky_route *route; /* List of dynamic routes */ 81193529Sjkim 82193529Sjkim unsigned heis1172 : 1; /* True if he is speaking rfc1172 */ 83193529Sjkim 84193529Sjkim struct in_addr peer_ip; /* IP address he's willing to use */ 85193529Sjkim u_int32_t peer_compproto; /* VJ params he's willing to use */ 86193529Sjkim 87193529Sjkim struct in_addr ifmask; /* Interface netmask */ 88193529Sjkim 89193529Sjkim struct in_addr my_ip; /* IP address I'm willing to use */ 90118611Snjl u_int32_t my_compproto; /* VJ params I'm willing to use */ 91118611Snjl 92118611Snjl u_int32_t peer_reject; /* Request codes rejected by peer */ 93118611Snjl u_int32_t my_reject; /* Request codes I have rejected */ 94118611Snjl 95118611Snjl struct pppThroughput throughput; /* throughput statistics */ 96118611Snjl struct mqueue Queue[PRI_FAST + 1]; /* Output packet queues */ 97118611Snjl}; 98118611Snjl 99118611Snjl#define fsm2ipcp(fp) (fp->proto == PROTO_IPCP ? (struct ipcp *)fp : NULL) 100118611Snjl 101118611Snjlstruct bundle; 102118611Snjlstruct link; 103118611Snjlstruct cmdargs; 104151937Sjkim 105118611Snjlextern void ipcp_Init(struct ipcp *, struct bundle *, struct link *, 106118611Snjl const struct fsm_parent *); 107118611Snjlextern void ipcp_Setup(struct ipcp *, u_int32_t); 108118611Snjlextern void ipcp_SetLink(struct ipcp *, struct link *); 109118611Snjl 110118611Snjlextern int ipcp_Show(struct cmdargs const *); 111118611Snjlextern void ipcp_Input(struct ipcp *, struct bundle *, struct mbuf *); 112202771Sjkimextern void ipcp_AddInOctets(struct ipcp *, int); 113118611Snjlextern void ipcp_AddOutOctets(struct ipcp *, int); 114118611Snjlextern int ipcp_UseHisIPaddr(struct bundle *, struct in_addr); 115118611Snjlextern int ipcp_UseHisaddr(struct bundle *, const char *, int); 116118611Snjlextern int ipcp_vjset(struct cmdargs const *); 117118611Snjlextern void ipcp_CleanInterface(struct ipcp *); 118118611Snjlextern int ipcp_InterfaceUp(struct ipcp *); 119118611Snjlextern struct in_addr addr2mask(struct in_addr); 120202771Sjkim