資源簡介
dhcpd為應用層協議,不在linux內核中,由linux的發行版本發布,資源是linux下dhcp客戶端的源代碼實現
代碼片段和文件信息
/*?clparse.c
???Parser?for?dhclient?config?and?lease?files...?*/
/*
?*?Copyright?(c)?2004-2012?by?Internet?Systems?Consortium?Inc.?(“ISC“)
?*?Copyright?(c)?1996-2003?by?Internet?Software?Consortium
?*
?*?Permission?to?use?copy?modify?and?distribute?this?software?for?any
?*?purpose?with?or?without?fee?is?hereby?granted?provided?that?the?above
?*?copyright?notice?and?this?permission?notice?appear?in?all?copies.
?*
?*?THE?SOFTWARE?IS?PROVIDED?“AS?IS“?AND?ISC?DISCLAIMS?ALL?WARRANTIES
?*?WITH?REGARD?TO?THIS?SOFTWARE?INCLUDING?ALL?IMPLIED?WARRANTIES?OF
?*?MERCHANTABILITY?AND?FITNESS.??IN?NO?EVENT?SHALL?ISC?BE?LIABLE?FOR
?*?ANY?SPECIAL?DIRECT?INDIRECT?OR?CONSEQUENTIAL?DAMAGES?OR?ANY?DAMAGES
?*?WHATSOEVER?RESULTING?FROM?LOSS?OF?USE?DATA?OR?PROFITS?WHETHER?IN?AN
?*?ACTION?OF?CONTRACT?NEGLIGENCE?OR?OTHER?TORTIOUS?ACTION?ARISING?OUT
?*?OF?OR?IN?CONNECTION?WITH?THE?USE?OR?PERFORMANCE?OF?THIS?SOFTWARE.
?*
?*???Internet?Systems?Consortium?Inc.
?*???950?Charter?Street
?*???Redwood?City?CA?94063
?*???
?*???https://www.isc.org/
?*
?*?This?software?has?been?written?for?Internet?Systems?Consortium
?*?by?Ted?Lemon?in?cooperation?with?Vixie?Enterprises?and?Nominum?Inc.
?*?To?learn?more?about?Internet?Systems?Consortium?see
?*?‘‘https://www.isc.org/‘‘.??To?learn?more?about?Vixie?Enterprises
?*?see?‘‘http://www.vix.com‘‘.???To?learn?more?about?Nominum?Inc.?see
?*?‘‘http://www.nominum.com‘‘.
?*/
#include?“dhcpd.h“
#include?
struct?client_config?top_level_config;
#define?NUM_DEFAULT_REQUESTED_OPTS 9
struct?option?*default_requested_options[NUM_DEFAULT_REQUESTED_OPTS?+?1];
static?void?parse_client_default_duid(struct?parse?*cfile);
static?void?parse_client6_lease_statement(struct?parse?*cfile);
#ifdef?DHCPv6
static?struct?dhc6_ia?*parse_client6_ia_na_statement(struct?parse?*cfile);
static?struct?dhc6_ia?*parse_client6_ia_ta_statement(struct?parse?*cfile);
static?struct?dhc6_ia?*parse_client6_ia_pd_statement(struct?parse?*cfile);
static?struct?dhc6_addr?*parse_client6_iaaddr_statement(struct?parse?*cfile);
static?struct?dhc6_addr?*parse_client6_iaprefix_statement(struct?parse?*cfile);
#endif?/*?DHCPv6?*/
/*?client-conf-file?:==?client-declarations?END_OF_FILE
???client-declarations?:==?
?|?client-declaration
?|?client-declarations?client-declaration?*/
isc_result_t?read_client_conf?()
{
struct?client_config?*config;
struct?interface_info?*ip;
isc_result_t?status;
unsigned?code;
????????/*?
?????????*?TODO:?LATER?constant?is?very?undescriptive.?We?should?review?it?and
?????????*?change?it?to?something?more?descriptive?or?even?better?remove?it
?????????*?completely?as?it?is?currently?not?used.
?????????*/
#ifdef?LATER
????????struct?parse?*parse?=?NULL;
#endif
/*?Initialize?the?default?request?list.?*/
memset(default_requested_options?0?sizeof(default_requested_options));
/*?1?*/
code?=?DHO_SUBNET_MASK;
option_code_hash_lookup(&default_requested_options[0]
dhcp_universe.code_hash?&code?0?MDL);
評論
共有 條評論