charrua-core

DHCP wire frame encoder and decoder
Library charrua-core.wire
Module Dhcp_wire

DHCP wire parsers

DHCP general data

val client_port : int

DHCP client port 68

val server_port : int

DHCP server port 67

DHCP header opcodes

type op =
| BOOTREQUEST
| BOOTREPLY

Conversions of ops.

val int_to_op : int -> op option
val int_to_op_exn : int -> op
  • raises Invalid_argument

    if v < 0 || v > 255

val op_to_int : op -> int
  • raises Invalid_argument

    if v < 0 || v > 255

val string_to_op : string -> op option
val op_to_string : op -> string
val sexp_of_op : op -> Sexplib.Sexp.t
val op_of_sexp : Sexplib.Sexp.t -> op

DHCP message type option values

type msgtype =
| DHCPDISCOVER
| DHCPOFFER
| DHCPREQUEST
| DHCPDECLINE
| DHCPACK
| DHCPNAK
| DHCPRELEASE
| DHCPINFORM
| DHCPFORCERENEW
| DHCPLEASEQUERY
| DHCPLEASEUNASSIGNED
| DHCPLEASEUNKNOWN
| DHCPLEASEACTIVE
| DHCPBULKLEASEQUERY
| DHCPLEASEQUERYDONE

Conversions of msgtypes.

val msgtype_to_int : msgtype -> int
val int_to_msgtype : int -> msgtype option
val int_to_msgtype_exn : int -> msgtype
  • raises Invalid_argument

    if not a valid msgtype value

val string_to_msgtype : string -> msgtype option
val msgtype_to_string : msgtype -> string
val sexp_of_msgtype : msgtype -> Sexplib.Sexp.t
val msgtype_of_sexp : Sexplib.Sexp.t -> msgtype

DHCP option codes (names only, for use in parameter requests)

type option_code =
| PAD
| SUBNET_MASK
| TIME_OFFSET
| ROUTERS
| TIME_SERVERS
| NAME_SERVERS
| DNS_SERVERS
| LOG_SERVERS
| COOKIE_SERVERS
| LPR_SERVERS
| IMPRESS_SERVERS
| RSCLOCATION_SERVERS
| HOSTNAME
| BOOTFILE_SIZE
| MERIT_DUMPFILE
| DOMAIN_NAME
| SWAP_SERVER
| ROOT_PATH
| EXTENSION_PATH
| IPFORWARDING
| NLSR
| POLICY_FILTERS
| MAX_DATAGRAM
| DEFAULT_IP_TTL
| PMTU_AGEING_TIMO
| PMTU_PLATEAU_TABLE
| INTERFACE_MTU
| ALL_SUBNETS_LOCAL
| BROADCAST_ADDR
| PERFORM_MASK_DISCOVERY
| MASK_SUPPLIER
| PERFORM_ROUTER_DISC
| ROUTER_SOL_ADDR
| STATIC_ROUTES
| TRAILER_ENCAPSULATION
| ARP_CACHE_TIMO
| ETHERNET_ENCAPSULATION
| TCP_DEFAULT_TTL
| TCP_KEEPALIVE_INTERVAL
| TCP_KEEPALIVE_GARBAGE
| NIS_DOMAIN
| NIS_SERVERS
| NTP_SERVERS
| VENDOR_SPECIFIC
| NETBIOS_NAME_SERVERS
| NETBIOS_DATAGRAM_DISTRIB_SERVERS
| NETBIOS_NODE
| NETBIOS_SCOPE
| XWINDOW_FONT_SERVERS
| XWINDOW_DISPLAY_MANAGERS
| REQUEST_IP
| IP_LEASE_TIME
| OPTION_OVERLOAD
| MESSAGE_TYPE
| SERVER_IDENTIFIER
| PARAMETER_REQUESTS
| MESSAGE
| MAX_MESSAGE
| RENEWAL_T1
| REBINDING_T2
| VENDOR_CLASS_ID
| CLIENT_ID
| NETWARE_IP_DOMAIN
| NETWARE_IP_OPTION
| NIS_PLUS_DOMAIN
| NIS_PLUS_SERVERS
| TFTP_SERVER_NAME
| BOOTFILE_NAME
| MOBILE_IP_HOME_AGENT
| SMTP_SERVERS
| POP3_SERVERS
| NNTP_SERVERS
| WWW_SERVERS
| FINGER_SERVERS
| IRC_SERVERS
| STREETTALK_SERVERS
| STREETTALK_DA
| USER_CLASS
| DIRECTORY_AGENT
| SERVICE_SCOPE
| RAPID_COMMIT
| CLIENT_FQDN
| RELAY_AGENT_INFORMATION
| ISNS
| UNASSIGNED_84
| NDS_SERVERS
| NDS_TREE_NAME
| NDS_CONTEXT
| BCMCS_CONTROLLER_DOMAIN_NAME_LIST
| BCMCS_CONTROLLER_IPV4_ADDR
| AUTHENTICATION
| CLIENT_LAST_TRANSACTION_TIME
| ASSOCIATED_IPS
| CLIENT_SYSTEM
| CLIENT_NDI
| LDAP
| UNASSIGNED_96
| UUID_GUID
| USER_AUTH
| GEOCONF_CIVIC
| PCODE
| TCODE
| UNASSIGNED_102
| UNASSIGNED_103
| UNASSIGNED_104
| UNASSIGNED_105
| UNASSIGNED_106
| UNASSIGNED_107
| UNASSIGNED_108
| UNASSIGNED_109
| UNASSIGNED_110
| UNASSIGNED_111
| NETINFO_ADDRESS
| NETINFO_TAG
| URL
| UNASSIGNED_115
| AUTO_CONFIG
| SUBNET_SELECTION
| SIP_SERVERS
| CLASSLESS_STATIC_ROUTE
| CCC
| GEOCONF
| VI_VENDOR_CLASS
| VI_VENDOR_INFO
| UNASSIGNED_126
| UNASSIGNED_127
| PXE_128
| PXE_129
| PXE_130
| PXE_131
| PXE_132
| PXE_133
| PXE_134
| PXE_135
| PANA_AGENT
| V4_LOST
| CAPWAP_AC_V4
| IPV4_ADDRESS_MOS
| IPV4_FQDN_MOS
| SIP_UA_DOMAINS
| IPV4_ADDRESS_ANDSF
| UNASSIGNED_143
| GEOLOCK
| FORCENEW_NONCE_CAPABLE
| RDNSS_SELECTION
| UNASSIGNED_147
| UNASSIGNED_148
| UNASSIGNED_149
| MISC_150
| STATUS_CODE
| ABSOLUTE_TIME
| START_TIME_OF_STATE
| QUERY_START_TIME
| QUERY_END_TIME
| DHCP_STATE
| DATA_SOURCE
| V4_PCP_SERVER
| V4_PORTPARAMS
| DHCP_CAPTIVE_PORTAL
| UNASSIGNED_161
| UNASSIGNED_162
| UNASSIGNED_163
| UNASSIGNED_164
| UNASSIGNED_165
| UNASSIGNED_166
| UNASSIGNED_167
| UNASSIGNED_168
| UNASSIGNED_169
| UNASSIGNED_170
| UNASSIGNED_171
| UNASSIGNED_172
| UNASSIGNED_173
| UNASSIGNED_174
| ETHERBOOT_175
| IP_TELEFONE
| ETHERBOOT_177
| UNASSIGNED_178
| UNASSIGNED_179
| UNASSIGNED_180
| UNASSIGNED_181
| UNASSIGNED_182
| UNASSIGNED_183
| UNASSIGNED_184
| UNASSIGNED_185
| UNASSIGNED_186
| UNASSIGNED_187
| UNASSIGNED_188
| UNASSIGNED_189
| UNASSIGNED_190
| UNASSIGNED_191
| UNASSIGNED_192
| UNASSIGNED_193
| UNASSIGNED_194
| UNASSIGNED_195
| UNASSIGNED_196
| UNASSIGNED_197
| UNASSIGNED_198
| UNASSIGNED_199
| UNASSIGNED_200
| UNASSIGNED_201
| UNASSIGNED_202
| UNASSIGNED_203
| UNASSIGNED_204
| UNASSIGNED_205
| UNASSIGNED_206
| UNASSIGNED_207
| PXE_LINUX
| CONFIGURATION_FILE
| PATH_PREFIX
| REBOOT_TIME
| OPTION_6RD
| V4_ACCESS_DOMAIN
| UNASSIGNED_214
| UNASSIGNED_215
| UNASSIGNED_216
| UNASSIGNED_217
| UNASSIGNED_218
| UNASSIGNED_219
| SUBNET_ALLOCATION
| VIRTUAL_SUBNET_SELECTION
| UNASSIGNED_222
| UNASSIGNED_223
| RESERVED_224
| RESERVED_225
| RESERVED_226
| RESERVED_227
| RESERVED_228
| RESERVED_229
| RESERVED_230
| RESERVED_231
| RESERVED_232
| RESERVED_233
| RESERVED_234
| RESERVED_235
| RESERVED_236
| RESERVED_237
| RESERVED_238
| RESERVED_239
| RESERVED_240
| RESERVED_241
| RESERVED_242
| RESERVED_243
| RESERVED_244
| RESERVED_245
| RESERVED_246
| RESERVED_247
| RESERVED_248
| PRIVATE_CLASSLESS_STATIC_ROUTE
| RESERVED_250
| RESERVED_251
| WEB_PROXY_AUTO_DISC
| RESERVED_253
| RESERVED_254
| END(*

The type of a dhcp parameter request, these are all the values according to iana

*)

Conversions of DHCP option_codes.

val int_to_option_code : int -> option_code option
val int_to_option_code_exn : int -> option_code
val option_code_to_int : option_code -> int
val sexp_of_option_code : option_code -> Sexplib.Sexp.t
val option_code_of_sexp : Sexplib.Sexp.t -> option_code
val string_to_option_code : string -> option_code option
val option_code_to_string : option_code -> string

DHCP hardware type

type htype =
| Ethernet_10mb
| Other

Conversions of htype.

val htype_of_sexp : Sexplib.Sexp.t -> htype
val sexp_of_htype : htype -> Sexplib.Sexp.t

DHCP header flags

.

type flags =
| Broadcast
| Unicast

Conversions of flags.

val flags_of_sexp : Sexplib.Sexp.t -> flags
val sexp_of_flags : flags -> Sexplib.Sexp.t

DHCP Client identifier

.

type client_id =
| Hwaddr of Macaddr.t
| Id of string(*

A client_id is usually a mac address from a dhcp_option, but it can also be an opaque string. See client_id_of_pkt.

*)

Conversions of client_id.

val client_id_of_sexp : Sexplib.Sexp.t -> client_id
val sexp_of_client_id : client_id -> Sexplib.Sexp.t
val client_id_to_string : client_id -> string

DHCP options

type dhcp_option =
| Pad
| Subnet_mask of Ipaddr.V4.t
| Time_offset of int32
| Routers of Ipaddr.V4.t list
| Time_servers of Ipaddr.V4.t list
| Name_servers of Ipaddr.V4.t list
| Dns_servers of Ipaddr.V4.t list
| Log_servers of Ipaddr.V4.t list
| Cookie_servers of Ipaddr.V4.t list
| Lpr_servers of Ipaddr.V4.t list
| Impress_servers of Ipaddr.V4.t list
| Rsclocation_servers of Ipaddr.V4.t list
| Hostname of string
| Bootfile_size of int
| Merit_dumpfile of string
| Domain_name of string
| Swap_server of Ipaddr.V4.t
| Root_path of string
| Extension_path of string
| Ipforwarding of bool
| Nlsr of bool
| Policy_filters of Ipaddr.V4.Prefix.t list
| Max_datagram of int
| Default_ip_ttl of int
| Pmtu_ageing_timo of int32
| Pmtu_plateau_table of int list
| Interface_mtu of int
| All_subnets_local of bool
| Broadcast_addr of Ipaddr.V4.t
| Perform_mask_discovery of bool
| Mask_supplier of bool
| Perform_router_disc of bool
| Router_sol_addr of Ipaddr.V4.t
| Static_routes of (Ipaddr.V4.t * Ipaddr.V4.t) list
| Trailer_encapsulation of bool
| Arp_cache_timo of int32
| Ethernet_encapsulation of bool
| Tcp_default_ttl of int
| Tcp_keepalive_interval of int32
| Tcp_keepalive_garbage of int
| Nis_domain of string
| Nis_servers of Ipaddr.V4.t list
| Ntp_servers of Ipaddr.V4.t list
| Vendor_specific of string
| Netbios_name_servers of Ipaddr.V4.t list
| Netbios_datagram_distrib_servers of Ipaddr.V4.t list
| Netbios_node of int
| Netbios_scope of string
| Xwindow_font_servers of Ipaddr.V4.t list
| Xwindow_display_managers of Ipaddr.V4.t list
| Request_ip of Ipaddr.V4.t
| Ip_lease_time of int32
| Option_overload of int
| Message_type of msgtype
| Server_identifier of Ipaddr.V4.t
| Parameter_requests of option_code list
| Message of string
| Max_message of int
| Renewal_t1 of int32
| Rebinding_t2 of int32
| Vendor_class_id of string
| Client_id of client_id
| Netware_ip_domain of string
| Netware_ip_option of string
| Nis_plus_domain of string
| Nis_plus_servers of Ipaddr.V4.t list
| Tftp_server_name of string
| Bootfile_name of string
| Mobile_ip_home_agent of Ipaddr.V4.t list
| Smtp_servers of Ipaddr.V4.t list
| Pop3_servers of Ipaddr.V4.t list
| Nntp_servers of Ipaddr.V4.t list
| Www_servers of Ipaddr.V4.t list
| Finger_servers of Ipaddr.V4.t list
| Irc_servers of Ipaddr.V4.t list
| Streettalk_servers of Ipaddr.V4.t list
| Streettalk_da of Ipaddr.V4.t list
| User_class of string
| Directory_agent of string
| Service_scope of string
| Rapid_commit
| Client_fqdn of string
| Relay_agent_information of string
| Isns of string
| Nds_servers of string
| Nds_tree_name of string
| Nds_context of string
| Bcmcs_controller_domain_name_list of string
| Bcmcs_controller_ipv4_addrs of Ipaddr.V4.t list
| Authentication of string
| Client_last_transaction_time of int32
| Associated_ips of Ipaddr.V4.t list
| Client_system of string
| Client_ndi of string
| Ldap of string
| Uuid_guid of string
| User_auth of string
| Geoconf_civic of string
| Pcode of string
| Tcode of string
| Netinfo_address of string
| Netinfo_tag of string
| Url of string
| Auto_config of int
| Subnet_selection of Ipaddr.V4.t
| Sip_servers of string
| Classless_static_route of string
| Ccc of string
| Geoconf of string
| Vi_vendor_class of string
| Vi_vendor_info of string
| Pxe_128 of string
| Pxe_129 of string
| Pxe_130 of string
| Pxe_131 of string
| Pxe_132 of string
| Pxe_133 of string
| Pxe_134 of string
| Pxe_135 of string
| Pana_agent of string
| V4_lost of string
| Capwap_ac_v4 of string
| Ipv4_address_mos of string
| Ipv4_fqdn_mos of string
| Sip_ua_domains of string
| Ipv4_address_andsf of string
| Geolock of string
| Forcenew_nonce_capable of string
| Rdnss_selection of string
| Misc_150 of string
| Status_code of string
| Absolute_time of int32
| Start_time_of_state of int32
| Query_start_time of int32
| Query_end_time of int32
| Dhcp_state of int
| Data_source of int
| V4_pcp_server of string
| V4_portparams of string
| Dhcp_captive_portal of string
| Etherboot_175 of string
| Ip_telefone of string
| Etherboot_177 of string
| Pxe_linux of int32
| Configuration_file of string
| Path_prefix of string
| Reboot_time of int32
| Option_6rd of string
| V4_access_domain of string
| Subnet_allocation of int
| Virtual_subnet_selection of string
| Private_classless_static_route of string
| Web_proxy_auto_disc of string
| End
| Unassigned of option_code * string

Not all options are currently implemented.

val sexp_of_dhcp_option : dhcp_option -> Ppx_sexp_conv_lib.Sexp.t
val dhcp_option_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> dhcp_option

Conversions of dhcp_option.

val buf_of_options : Cstruct.t -> dhcp_option list -> Cstruct.t
val options_of_buf : Cstruct.t -> int -> dhcp_option list
val find_option : ( dhcp_option -> 'b option ) -> dhcp_option list -> 'b option

find_option f l finds the first option where f evaluates to Some value on list l

val collect_options : ( 'a -> 'b list option ) -> 'a list -> 'b list

collect_options f l collects all options where f evaluates to Some value on list l, this is useful for list options like Routers, if multiple list options are found, the resulting list is flattened.

val dhcp_option_of_sexp : Sexplib.Sexp.t -> dhcp_option
val sexp_of_dhcp_option : dhcp_option -> Sexplib.Sexp.t
val dhcp_option_to_string : dhcp_option -> string
val collect_associated_ips : dhcp_option list -> Ipaddr.V4.t list
val collect_bcmcs_controller_ipv4_addrs : dhcp_option list -> Ipaddr.V4.t list
val collect_dns_servers : dhcp_option list -> Ipaddr.V4.t list
val collect_finger_servers : dhcp_option list -> Ipaddr.V4.t list
val collect_impress_servers : dhcp_option list -> Ipaddr.V4.t list
val collect_irc_servers : dhcp_option list -> Ipaddr.V4.t list
val collect_log_servers : dhcp_option list -> Ipaddr.V4.t list
val collect_lpr_servers : dhcp_option list -> Ipaddr.V4.t list
val collect_name_servers : dhcp_option list -> Ipaddr.V4.t list
val collect_netbios_datagram_distrib_servers : dhcp_option list -> Ipaddr.V4.t list
val collect_netbios_name_servers : dhcp_option list -> Ipaddr.V4.t list
val collect_nis_plus_servers : dhcp_option list -> Ipaddr.V4.t list
val collect_nis_servers : dhcp_option list -> Ipaddr.V4.t list
val collect_ntp_servers : dhcp_option list -> Ipaddr.V4.t list
val find_parameter_requests : dhcp_option list -> option_code list option
val collect_policy_filters : dhcp_option list -> Ipaddr.V4.Prefix.t list
val collect_routers : dhcp_option list -> Ipaddr.V4.t list
val collect_rsc_location_servers : dhcp_option list -> Ipaddr.V4.t list
val collect_static_routes : dhcp_option list -> (Ipaddr.V4.t * Ipaddr.V4.t) list
val collect_streettalk_da : dhcp_option list -> Ipaddr.V4.t list
val collect_streettalk_servers : dhcp_option list -> Ipaddr.V4.t list
val collect_time_servers : dhcp_option list -> Ipaddr.V4.t list
val collect_www_servers : dhcp_option list -> Ipaddr.V4.t list
val collect_xwindow_display_managers : dhcp_option list -> Ipaddr.V4.t list
val collect_xwindow_font_servers : dhcp_option list -> Ipaddr.V4.t list
val find_absolute_time : dhcp_option list -> int32 option
val find_all_subnets_local : dhcp_option list -> bool option
val find_arp_cache_timo : dhcp_option list -> int32 option
val find_authentication : dhcp_option list -> string option
val find_auto_config : dhcp_option list -> int option
val find_bcmcs_controller_domain_name : dhcp_option list -> string option
val find_bootfile_name : dhcp_option list -> string option
val find_bootfile_size : dhcp_option list -> int option
val find_broadcast_addr : dhcp_option list -> Ipaddr.V4.t option
val find_capwap_ac_v4 : dhcp_option list -> string option
val find_ccc : dhcp_option list -> string option
val find_classless_static_route : dhcp_option list -> string option
val find_client_fqdn : dhcp_option list -> string option
val find_client_id : dhcp_option list -> client_id option
val find_client_last_transaction_time : dhcp_option list -> int32 option
val find_client_ndi : dhcp_option list -> string option
val find_client_system : dhcp_option list -> string option
val find_configuration_file : dhcp_option list -> string option
val find_data_source : dhcp_option list -> int option
val find_default_ip_ttl : dhcp_option list -> int option
val find_dhcp_captive_portal : dhcp_option list -> string option
val find_dhcp_state : dhcp_option list -> int option
val find_directory_agent : dhcp_option list -> string option
val find_domain_name : dhcp_option list -> string option
val find_etherboot_175 : dhcp_option list -> string option
val find_etherboot_177 : dhcp_option list -> string option
val find_ethernet_encapsulation : dhcp_option list -> bool option
val find_extension_path : dhcp_option list -> string option
val find_forcenew_nonce_capable : dhcp_option list -> string option
val find_geoconf : dhcp_option list -> string option
val find_geoconf_civic : dhcp_option list -> string option
val find_geolock : dhcp_option list -> string option
val find_hostname : dhcp_option list -> string option
val find_interface_mtu : dhcp_option list -> int option
val find_ip_lease_time : dhcp_option list -> int32 option
val find_ip_telefone : dhcp_option list -> string option
val find_ipforwarding : dhcp_option list -> bool option
val find_ipv4_address_andsf : dhcp_option list -> string option
val find_ipv4_address_mos : dhcp_option list -> string option
val find_ipv4_fqdn_mos : dhcp_option list -> string option
val find_isns : dhcp_option list -> string option
val find_ldap : dhcp_option list -> string option
val find_mask_supplier : dhcp_option list -> bool option
val find_max_datagram : dhcp_option list -> int option
val find_max_message : dhcp_option list -> int option
val find_merit_dumpfile : dhcp_option list -> string option
val find_message : dhcp_option list -> string option
val find_message_type : dhcp_option list -> msgtype option
val find_misc_150 : dhcp_option list -> string option
val collect_mobile_ip_home_agent : dhcp_option list -> Ipaddr.V4.t list
val find_nds_context : dhcp_option list -> string option
val find_nds_servers : dhcp_option list -> string option
val find_nds_tree_name : dhcp_option list -> string option
val find_netbios_node : dhcp_option list -> int option
val find_netbios_scope : dhcp_option list -> string option
val find_netinfo_address : dhcp_option list -> string option
val find_netinfo_tag : dhcp_option list -> string option
val find_netware_ip_domain : dhcp_option list -> string option
val find_netware_ip_option : dhcp_option list -> string option
val find_nis_domain : dhcp_option list -> string option
val find_nis_plus_domain : dhcp_option list -> string option
val find_nlsr : dhcp_option list -> bool option
val collect_nntp_servers : dhcp_option list -> Ipaddr.V4.t list
val find_option_6rd : dhcp_option list -> string option
val find_option_overload : dhcp_option list -> int option
val find_pana_agent : dhcp_option list -> string option
val find_path_prefix : dhcp_option list -> string option
val find_pcode : dhcp_option list -> string option
val find_perform_mask_discovery : dhcp_option list -> bool option
val find_perform_router_disc : dhcp_option list -> bool option
val find_pmtu_ageing_timo : dhcp_option list -> int32 option
val find_pmtu_plateau_table : dhcp_option list -> int list option
val collect_pop3_servers : dhcp_option list -> Ipaddr.V4.t list
val find_private_classless_static_route : dhcp_option list -> string option
val find_pxe_128 : dhcp_option list -> string option
val find_pxe_129 : dhcp_option list -> string option
val find_pxe_130 : dhcp_option list -> string option
val find_pxe_131 : dhcp_option list -> string option
val find_pxe_132 : dhcp_option list -> string option
val find_pxe_133 : dhcp_option list -> string option
val find_pxe_134 : dhcp_option list -> string option
val find_pxe_135 : dhcp_option list -> string option
val find_pxe_linux : dhcp_option list -> int32 option
val find_query_end_time : dhcp_option list -> int32 option
val find_query_start_time : dhcp_option list -> int32 option
val find_rapid_commit : dhcp_option list -> dhcp_option option
val find_rdnss_selection : dhcp_option list -> string option
val find_rebinding_t2 : dhcp_option list -> int32 option
val find_reboot_time : dhcp_option list -> int32 option
val find_relay_agent_information : dhcp_option list -> string option
val find_renewal_t1 : dhcp_option list -> int32 option
val find_request_ip : dhcp_option list -> Ipaddr.V4.t option
val find_root_path : dhcp_option list -> string option
val find_router_sol_addr : dhcp_option list -> Ipaddr.V4.t option
val find_server_identifier : dhcp_option list -> Ipaddr.V4.t option
val find_service_scope : dhcp_option list -> string option
val find_sip_servers : dhcp_option list -> string option
val find_sip_ua_domains : dhcp_option list -> string option
val collect_smtp_servers : dhcp_option list -> Ipaddr.V4.t list
val find_start_time_of_state : dhcp_option list -> int32 option
val find_status_code : dhcp_option list -> string option
val find_subnet_allocation : dhcp_option list -> int option
val find_subnet_mask : dhcp_option list -> Ipaddr.V4.t option
val find_subnet_selection : dhcp_option list -> Ipaddr.V4.t option
val find_swap_server : dhcp_option list -> Ipaddr.V4.t option
val find_tcode : dhcp_option list -> string option
val find_tcp_default_ttl : dhcp_option list -> int option
val find_tcp_keepalive_garbage : dhcp_option list -> int option
val find_tcp_keepalive_interval : dhcp_option list -> int32 option
val find_tftp_server_name : dhcp_option list -> string option
val find_time_offset : dhcp_option list -> int32 option
val find_trailer_encapsulation : dhcp_option list -> bool option
val find_url : dhcp_option list -> string option
val find_user_auth : dhcp_option list -> string option
val find_user_class : dhcp_option list -> string option
val find_uuid_guid : dhcp_option list -> string option
val find_v4_access_domain : dhcp_option list -> string option
val find_v4_lost : dhcp_option list -> string option
val find_v4_pcp_server : dhcp_option list -> string option
val find_v4_portparams : dhcp_option list -> string option
val find_vendor_class_id : dhcp_option list -> string option
val find_vendor_specific : dhcp_option list -> string option
val find_vi_vendor_class : dhcp_option list -> string option
val find_vi_vendor_info : dhcp_option list -> string option
val find_virtual_subnet_selection : dhcp_option list -> string option
val find_web_proxy_auto_disc : dhcp_option list -> string option
val find_unassigned : option_code -> dhcp_option list -> (option_code * string) option
val collect_unassigned : option_code -> dhcp_option list -> (option_code * string) list

DHCP Packet - fixed-length fields, plus a variable-length list of options

type pkt = {
srcmac : Macaddr.t;
dstmac : Macaddr.t;
srcip : Ipaddr.V4.t;
dstip : Ipaddr.V4.t;
srcport : int;
dstport : int;
op : op;
htype : htype;
hlen : int;
hops : int;
xid : int32;
secs : int;
flags : flags;
ciaddr : Ipaddr.V4.t;
yiaddr : Ipaddr.V4.t;
siaddr : Ipaddr.V4.t;
giaddr : Ipaddr.V4.t;
chaddr : Macaddr.t;
sname : string;
file : string;
options : dhcp_option list;
}

Conversions for pkt.

val pkt_of_buf : Cstruct.t -> int -> ( pkt, string ) result
val buf_of_pkt : pkt -> Cstruct.t
val pkt_of_sexp : Sexplib.Sexp.t -> pkt
val sexp_of_pkt : pkt -> Sexplib.Sexp.t
val client_id_of_pkt : pkt -> client_id
val pkt_to_string : pkt -> string

Helpers.

val is_dhcp : Cstruct.t -> int -> bool

is_dhcp buf len is true if buf is an Ethernet frame containing an IPv4 header, UDP header, and DHCP packet.