dhcpd.h File Reference

#include <minix/paths.h>

Include dependency graph for dhcpd.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  buf
struct  fd
struct  network

Defines

#define nil   ((void*)0)
#define PATH_DHCPCONF   _PATH_DHCPCONF
#define PATH_DHCPPID   _PATH_DHCPPID
#define PATH_DHCPCACHE   _PATH_DHCPCACHE
#define PATH_DHCPPOOL   _PATH_DHCPPOOL
#define CLID_MAX   32
#define EXTERN   extern
#define arraysize(a)   (sizeof(a) / sizeof((a)[0]))
#define arraylimit(a)   ((a) + arraysize(a))
#define between(a, c, z)
#define B(a)   ((u8_t *) (a))
#define NEVER   (sizeof(time_t) <= sizeof(int) ? INT_MAX : LONG_MAX)
#define DELTA_FIRST   4
#define DELTA_FAST   64
#define DELTA_SLOW   512
#define N_SOLICITS   3
#define DELTA_SOL   3
#define DELTA_ADV   2048
#define BUF_ETH_SIZE   (ETH_MAX_PACK_SIZE)
#define BUF_IP_SIZE   (BUF_ETH_SIZE - sizeof(eth_hdr_t))
#define BUF_UDP_SIZE
#define FT_ALL   FT_CLOSED
#define NF_NEGOTIATING   0x001
#define NF_BOUND   0x002
#define NF_SERVING   0x004
#define NF_RELAYING   0x008
#define NF_WAIT   0x010
#define NF_IRDP   0x020
#define NF_CONFLICT   0x040
#define NF_POSSESSIVE   0x080
#define NF_INFORM   0x100
#define gettag(dp, st, pd, pl)   dhcp_gettag((dp), (st), (pd), (pl))

Typedefs

typedef buf buf_t
typedef fd fd_t
typedef network network_t

Enumerations

enum  fdtype_t {
  FT_CLOSED, FT_ETHERNET, FT_ICMP, FT_BOOTPC,
  FT_BOOTPS
}
enum  nettype_t { NT_IP, NT_SINK, NT_ETHERNET }

Functions

void report (const char *label)
void fatal (const char *label)
void * allocate (size_t size)
int ifname2if (const char *name)
network_tif2net (int n)
void get_buf (buf_t **bp)
void put_buf (buf_t **bp)
void give_buf (buf_t **dbp, buf_t **sbp)
network_tnewnetwork (void)
void closefd (fd_t *fdp)
int opendev (network_t *np, fdtype_t fdtype, int compete)
void closedev (network_t *np, fdtype_t fdtype)
char * ipdev (int n)
void set_ipconf (char *device, ipaddr_t ip, ipaddr_t mask, unsigned mtu)
void udp2ether (buf_t *bp, network_t *np)
int ether2udp (buf_t *bp)
void make_arp (buf_t *bp, network_t *np)
int is_arp_me (buf_t *bp, network_t *np)
void icmp_solicit (buf_t *bp)
void icmp_advert (buf_t *bp, network_t *np)
ipaddr_t icmp_is_advert (buf_t *bp)
void settag (dhcp_t *dp, int tag, void *data, size_t len)
char * cidr_ntoa (ipaddr_t addr, ipaddr_t mask)
void ether2clid (u8_t *clid, ether_addr_t *eth)
void initdhcpconf (void)
int makedhcp (dhcp_t *dp, u8_t *class, size_t calen, u8_t *client, size_t cilen, ipaddr_t ip, ipaddr_t ifip, network_t *np)
char * dhcptypename (int type)
void printdhcp (dhcp_t *dp)

Variables

EXTERN char * program
char * configfile
char * poolfile
EXTERN int serving
EXTERN unsigned test
EXTERN unsigned debug
EXTERN asynchio_t asyn
EXTERN u16_t port_server
EXTERN u16_t port_client
EXTERN time_t start
EXTERN time_t now
EXTERN time_t event


Define Documentation

#define arraylimit a   )     ((a) + arraysize(a))
 

Definition at line 35 of file dhcpd.h.

#define arraysize a   )     (sizeof(a) / sizeof((a)[0]))
 

Definition at line 34 of file dhcpd.h.

#define B a   )     ((u8_t *) (a))
 

Definition at line 41 of file dhcpd.h.

Referenced by blockcpy(), defaultmask(), insert_id_rec(), printdhcp(), rijndael_cfb1_decrypt(), rijndael_cfb1_encrypt(), rijndael_cfb8_decrypt(), rijndael_cfb8_encrypt(), rijndael_makekey(), servdhcp(), and udp_cksum().

#define between a,
c,
z   ) 
 

Value:

(sizeof(c) <= sizeof(unsigned) ? \
        (unsigned) (c) - (a) <= (unsigned) (z) - (a) : \
        (unsigned long) (c) - (a) <= (unsigned long) (z) - (a))

Definition at line 36 of file dhcpd.h.

#define BUF_ETH_SIZE   (ETH_MAX_PACK_SIZE)
 

Definition at line 68 of file dhcpd.h.

#define BUF_IP_SIZE   (BUF_ETH_SIZE - sizeof(eth_hdr_t))
 

Definition at line 69 of file dhcpd.h.

#define BUF_UDP_SIZE
 

Value:

(BUF_IP_SIZE - sizeof(ip_hdr_t) - sizeof(udp_hdr_t) \
                                + sizeof(udp_io_hdr_t))

Definition at line 70 of file dhcpd.h.

#define CLID_MAX   32
 

Definition at line 16 of file dhcpd.h.

Referenced by ascii2clid(), and makedhcp().

#define DELTA_ADV   2048
 

Definition at line 54 of file dhcpd.h.

Referenced by icmp_advert().

#define DELTA_FAST   64
 

Definition at line 50 of file dhcpd.h.

Referenced by servdhcp().

#define DELTA_FIRST   4
 

Definition at line 49 of file dhcpd.h.

#define DELTA_SLOW   512
 

Definition at line 51 of file dhcpd.h.

#define DELTA_SOL   3
 

Definition at line 53 of file dhcpd.h.

#define EXTERN   extern
 

Definition at line 19 of file dhcpd.h.

#define FT_ALL   FT_CLOSED
 

Definition at line 76 of file dhcpd.h.

Referenced by closedev().

#define gettag dp,
st,
pd,
pl   )     dhcp_gettag((dp), (st), (pd), (pl))
 

Definition at line 151 of file dhcpd.h.

Referenced by findpool(), printdhcp(), and servdhcp().

#define N_SOLICITS   3
 

Definition at line 52 of file dhcpd.h.

#define NEVER   (sizeof(time_t) <= sizeof(int) ? INT_MAX : LONG_MAX)
 

Definition at line 48 of file dhcpd.h.

#define NF_BOUND   0x002
 

Definition at line 114 of file dhcpd.h.

Referenced by opendev().

#define NF_CONFLICT   0x040
 

Definition at line 119 of file dhcpd.h.

#define NF_INFORM   0x100
 

Definition at line 121 of file dhcpd.h.

Referenced by servdhcp().

#define NF_IRDP   0x020
 

Definition at line 118 of file dhcpd.h.

#define NF_NEGOTIATING   0x001
 

Definition at line 113 of file dhcpd.h.

#define NF_POSSESSIVE   0x080
 

Definition at line 120 of file dhcpd.h.

#define NF_RELAYING   0x008
 

Definition at line 116 of file dhcpd.h.

#define NF_SERVING   0x004
 

Definition at line 115 of file dhcpd.h.

Referenced by servdhcp().

#define NF_WAIT   0x010
 

Definition at line 117 of file dhcpd.h.

#define nil   ((void*)0)
 

Definition at line 6 of file dhcpd.h.

#define PATH_DHCPCACHE   _PATH_DHCPCACHE
 

Definition at line 13 of file dhcpd.h.

#define PATH_DHCPCONF   _PATH_DHCPCONF
 

Definition at line 11 of file dhcpd.h.

#define PATH_DHCPPID   _PATH_DHCPPID
 

Definition at line 12 of file dhcpd.h.

Referenced by cachedhcp().

#define PATH_DHCPPOOL   _PATH_DHCPPOOL
 

Definition at line 14 of file dhcpd.h.


Typedef Documentation

typedef struct buf buf_t
 

typedef struct fd fd_t
 

typedef struct network network_t
 


Enumeration Type Documentation

enum fdtype_t
 

Enumerator:
FT_CLOSED 
FT_ETHERNET 
FT_ICMP 
FT_BOOTPC 
FT_BOOTPS 

Definition at line 74 of file dhcpd.h.

enum nettype_t
 

Enumerator:
NT_IP 
NT_SINK 
NT_ETHERNET 

Definition at line 88 of file dhcpd.h.


Function Documentation

void* allocate size_t  size  ) 
 

Definition at line 18 of file misc.c.

References alloc_count, exit(), log(), LOG_ALERT, malloc(), mem, and nil.

char* cidr_ntoa ipaddr_t  addr,
ipaddr_t  mask
 

Definition at line 145 of file tags.c.

References htonl, n, and result.

void closedev network_t np,
fdtype_t  fdtype
 

Definition at line 239 of file devices.c.

References arraylimit, closefd(), network::fdp, fds, fd::fdtype, FT_ALL, network::n, and fd::n.

void closefd fd_t fdp  ) 
 

Definition at line 86 of file devices.c.

References asyn, asyn_close(), fd::bp, close, debug, fd::device, fd::fd, network::fdp, fd::fdtype, FT_CLOSED, printf, put_buf(), and fd::since.

Referenced by closedev().

char* dhcptypename int  type  ) 
 

Definition at line 841 of file tags.c.

References arraysize.

void ether2clid u8_t clid,
ether_addr_t eth
 

Definition at line 193 of file tags.c.

References DHCP_HLEN_ETH, DHCP_HTYPE_ETH, and memcpy().

Referenced by ascii2clid().

int ether2udp buf_t bp  ) 
 

Definition at line 87 of file ether.c.

References bp, ETH_IP_PROTO, HTONS, IPPROTO_UDP, ntohs, oneC_sum(), udp_cksum(), udp_io_hdr::uih_data_len, udp_io_hdr::uih_dst_addr, udp_io_hdr::uih_dst_port, udp_io_hdr::uih_ip_opt_len, udp_io_hdr::uih_src_addr, and udp_io_hdr::uih_src_port.

void fatal const char *  label  ) 
 

Definition at line 57 of file dhcpd.c.

References exit(), and report().

void get_buf buf_t **  bp  ) 
 

Definition at line 29 of file devices.c.

References allocate(), bp, and nil.

Referenced by servdhcp().

void give_buf buf_t **  dbp,
buf_t **  sbp
 

Definition at line 56 of file devices.c.

References nil, and put_buf().

void icmp_advert buf_t bp,
network_t np
 

Definition at line 167 of file ether.c.

References bp, DELTA_ADV, network::gateway, HTONL, htons, ICMP_TYPE_ROUTER_ADVER, icmp_hdr::ih_chksum, icmp_hdr::ih_code, icmp_hdr::ih_dun, icmp_hdr::ih_hun, icmp_hdr::ih_type, icmp_hdr::ihh_ram, icmp_ram::iram_aes, icmp_ram::iram_lt, icmp_ram::iram_na, LOCALHOST, oneC_sum(), and icmp_hdr::uhd_data.

ipaddr_t icmp_is_advert buf_t bp  ) 
 

Definition at line 186 of file ether.c.

References bp, i, ICMP_TYPE_ROUTER_ADVER, icmp_hdr::ih_dun, icmp_hdr::ih_hun, icmp_hdr::ih_type, icmp_hdr::ihh_ram, icmp_ram::iram_na, and icmp_hdr::uhd_data.

void icmp_solicit buf_t bp  ) 
 

Definition at line 152 of file ether.c.

References BCAST_IP, bp, ICMP_TYPE_ROUTE_SOL, icmp_hdr::ih_chksum, icmp_hdr::ih_code, icmp_hdr::ih_hun, icmp_hdr::ih_type, icmp_hdr::ihh_unused, and oneC_sum().

network_t* if2net int  n  ) 
 

Definition at line 91 of file dhcpd.c.

References i, n_nets, and network.

int ifname2if const char *  name  ) 
 

Definition at line 78 of file dhcpd.c.

References n, N_NETS, and strtoul().

Referenced by makedhcp().

void initdhcpconf void   ) 
 

Definition at line 361 of file tags.c.

References config_read(), config_renewed(), and inittagdef().

Referenced by makedhcp(), and printdata().

char* ipdev int  n  ) 
 

Definition at line 251 of file devices.c.

References sprintf().

Referenced by main().

int is_arp_me buf_t bp,
network_t np
 

Definition at line 132 of file ether.c.

References arp, ARP_ETHERNET, ARP_REPLY, bp, network::conflict, network::eth, ETH_ARP_PROTO, ETH_IP_PROTO, HTONS, if(), network::ip, and memcmp().

void make_arp buf_t bp,
network_t np
 

Definition at line 113 of file ether.c.

References arp, ARP_ETHERNET, ARP_REQUEST, BCAST_ETH, bp, network::eth, ETH_ARP_PROTO, ETH_IP_PROTO, HTONS, network::ip, memcpy(), and memset().

int makedhcp dhcp_t dp,
u8_t class,
size_t  calen,
u8_t client,
size_t  cilen,
ipaddr_t  ip,
ipaddr_t  ifip,
network_t np
 

Definition at line 518 of file tags.c.

References ascii2clid(), between, CLID_MAX, config_isatom, config_length(), d, DHCP_BOOTREPLY, dhcp_init(), exit(), follow(), fprintf(), hostname, ifname2if(), initdhcpconf(), memcmp(), network::n, name2ip(), config::next, nil, ntohl, dhcp::op, stderr, strcasecmp, strncmp(), config::word, and dhcp::yiaddr.

Referenced by findpool(), and servdhcp().

network_t* newnetwork void   ) 
 

Definition at line 73 of file devices.c.

References allocate(), memset(), NEVER, and nil.

int opendev network_t np,
fdtype_t  fdtype,
int  compete
 

Definition at line 99 of file devices.c.

References arraylimit, EAGAIN, errno, network::fdp, fds, fd::fdtype, network::flags, FT_ETHERNET, network::n, fd::n, NEVER, NF_BOUND, nil, fd::since, and time_t.

void printdhcp dhcp_t dp  ) 
 

Definition at line 850 of file tags.c.

References alltagdef, arraylimit, B, data, DHCP_HLEN_ETH, DHCP_HTYPE_ETH, DHCP_TAG_OVERLOAD, doff, gettag, dhcp::hlen, dhcp::htype, i, nil, printf, tagdefined, TF_STATIC, TF_TYPE, tp, and TT_IP.

Referenced by printdata().

void put_buf buf_t **  bp  ) 
 

Definition at line 47 of file devices.c.

References bp, free, and nil.

Referenced by closefd(), give_buf(), and servdhcp().

void report const char *  label  ) 
 

Definition at line 48 of file dhcpd.c.

References errno, fopen(), fprintf(), and strerror().

void set_ipconf char *  device,
ipaddr_t  ip,
ipaddr_t  mask,
unsigned  mtu
 

Definition at line 260 of file devices.c.

References close, fatal(), ioctl, nwio_ipconf::nwic_flags, nwio_ipconf::nwic_ipaddr, NWIC_IPADDR_SET, nwio_ipconf::nwic_mtu, NWIC_MTU_SET, nwio_ipconf::nwic_netmask, NWIC_NETMASK_SET, NWIOSIPCONF, O_RDWR, open, and test.

void settag dhcp_t dp,
int  tag,
void *  data,
size_t  len
 

Definition at line 35 of file tags.c.

References dhcp_settag(), exit(), fprintf(), and stderr.

Referenced by servdhcp().

void udp2ether buf_t bp,
network_t np
 

Definition at line 54 of file ether.c.

References BCAST_ETH, BCAST_IP, bp, network::eth, ETH_IP_PROTO, HTONS, htons, IP_MAX_TTL, IPPROTO_UDP, NTOHS, oneC_sum(), udp_cksum(), udp_io_hdr::uih_data_len, udp_io_hdr::uih_dst_port, and udp_io_hdr::uih_src_port.


Variable Documentation

EXTERN asynchio_t asyn
 

Definition at line 28 of file dhcpd.h.

Referenced by asyn_close(), asyn_init(), asyn_ioctl(), asyn_read(), asyn_wait(), asyn_write(), close_relay(), closefd(), job_connect(), job_listen(), job_read_query(), job_read_reply(), job_read_udp(), job_write_query(), job_write_reply(), main(), and operation().

char* configfile
 

Definition at line 36 of file dhcpd.c.

EXTERN unsigned debug
 

Definition at line 27 of file dhcpd.h.

EXTERN time_t event
 

Definition at line 45 of file dhcpd.h.

EXTERN time_t now
 

Definition at line 44 of file dhcpd.h.

char* poolfile
 

Definition at line 37 of file dhcpd.c.

Referenced by commitpool(), main(), openpool(), readpool(), and writepool().

EXTERN u16_t port_client
 

Definition at line 32 of file dhcpd.h.

Referenced by main(), and servdhcp().

EXTERN u16_t port_server
 

Definition at line 31 of file dhcpd.h.

Referenced by main(), and servdhcp().

EXTERN char* program
 

Definition at line 22 of file dhcpd.h.

Referenced by change(), compile(), get_expression(), search(), and substitute().

EXTERN int serving
 

Definition at line 25 of file dhcpd.h.

Referenced by ip2name(), and name2ip().

EXTERN time_t start
 

Definition at line 44 of file dhcpd.h.

Referenced by _gettemp(), consistencyCheck(), do_fcntl(), do_modelines(), dodash(), dump_all_segs(), expmeta(), fat12_decode(), fat12_encode(), findmust(), findpath(), fix_path(), get_token(), getcomponent(), gnu_load(), gzcopy(), gzread(), ifsbreakup(), kmessages_dmp(), l_strncpy(), main(), matcher(), mbadblocks(), name_split(), p_b_term(), p_bre(), padvance(), recordregion(), regsub(), rotate(), tail(), and werase().

EXTERN unsigned test
 

Definition at line 26 of file dhcpd.h.

Referenced by cachedhcp(), fn_match(), inflate_fast(), main(), servdhcp(), and set_ipconf().


Generated on Fri Apr 14 23:02:16 2006 for minix by  doxygen 1.4.6