资源描述:
《ppp程序基本流程》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、PPPD主函数main.cPPP程序基本流程图PPPD程序用到的几个重要的结构体:typedefstructfsm{intunit;/*Interfaceunitnumber*/intprotocol;/*DataLinkLayerProtocolfieldvalue*/intstate;/*State*/intflags;/*Containsoptionbits*/u_charid;/*Currentid*/u_charreqid;/*Currentrequestid*/u_charseen_
2、ack;/*HavereceivedvalidAck/Nak/RejtoReq*/inttimeouttime;/*Timeouttimeinmilliseconds*/intmaxconfreqtransmits;/*MaximumConfigure-Requesttransmissions*/intretransmits;/*Numberofretransmissionsleft*/intmaxtermtransmits;/*MaximumTerminate-Requesttransmiss
3、ions*/intnakloops;/*Numberofnakloopssincelastack*/intrnakloops;/*Numberofnaksreceived*/intmaxnakloops;/*Maximumnumberofnakloopstolerated*/structfsm_callbacks*callbacks;/*Callbackroutines*/char*term_reason;/*Reasonforclosingprotocol*/intterm_reason_le
4、n;/*Lengthofterm_reason*/}fsm;typedefstructfsm_callbacks{void(*resetci)/*ResetourConfigurationInformation*/__P((fsm*));int(*cilen)/*LengthofourConfigurationInformation*/__P((fsm*));void(*addci)/*AddourConfigurationInformation*/__P((fsm*,u_char*,int*)
5、);int(*ackci)/*ACKourConfigurationInformation*/__P((fsm*,u_char*,int));int(*nakci)/*NAKourConfigurationInformation*/__P((fsm*,u_char*,int,int));int(*rejci)/*RejectourConfigurationInformation*/__P((fsm*,u_char*,int));int(*reqci)/*Requestpeer'sConfigur
6、ationInformation*/__P((fsm*,u_char*,int*,int));void(*up)/*CalledwhenfsmreachesOPENEDstate*/PPPD主函数main.c__P((fsm*));void(*down)/*CalledwhenfsmleavesOPENEDstate*/__P((fsm*));void(*starting)/*Calledwhenwewantthelowerlayer*/__P((fsm*));void(*finished)/*
7、Calledwhenwedon'twantthelowerlayer*/__P((fsm*));void(*protreject)/*CalledwhenProtocol-Rejectreceived*/__P((int));void(*retransmit)/*Retransmissionisnecessary*/__P((fsm*));int(*extcode)/*Calledwhenunknowncodereceived*/__P((fsm*,int,int,u_char*,int));c
8、har*proto_name;/*Stringnameforprotocol(formessages)*/}fsm_callbacks;typedefstruct{char*name;/*nameoftheoption*/enumopt_typetype;void*addr;char*description;unsignedintflags;void*addr2;intupper_limit;intlower_limit;constchar*source;shortintpriority;sho