|
Retro Rocket Kernel
BASIC-Powered Operating System
|
#include "kernel.h"Data Structures | |
| struct | dhcp_packet_t |
| Definition of a DHCP packet. More... | |
Macros | |
| #define | DHCP_TRANSACTION_IDENTIFIER 0x55AA55AA |
| Hard coded transaction identifier. More... | |
Enumerations | |
| enum | dhcp_request_type_t { DHCP_REQUEST = 1 , DHCP_REPLY = 2 } |
| Direction of DHCP packet, outbound are REQUES and inbound (from the server to client) are REPLY. More... | |
| enum | dhcp_udp_ports_t { DHCP_DST_PORT = 68 , DHCP_SRC_PORT = 67 } |
| source and destination UDP port numbers More... | |
| enum | dhcp_packet_type_t { DHCPDISCOVER = 1 , DHCPOFFER = 2 , DHCPREQUEST = 3 , DHCPDECLINE = 4 , DHCPACK = 5 , DHCPNAK = 6 , DHCPRELEASE = 7 , DHCPINFORM = 8 } |
| Packet types inside the options, type 53. More... | |
| enum | dhcp_option_type_t { OPT_SUBNET = 1 , OPT_GATEWAY = 3 , OPT_DNS = 6 , OPT_HOSTNAME = 12 , OPT_DOMAIN = 15 , OPT_NBNS = 44 , OPT_NBDD = 45 , OPT_NETBIOS_NODE_TYPE = 46 , OPT_REQUESTED_IP = 50 , OPT_LEASE_TIME = 51 , OPT_TYPE = 53 , OPT_SERVER_IP = 54 , OPT_PARAMETER_REQUEST_LIST = 55 , OPT_MAX_DHCP_SIZE = 57 , OPT_CLIENT_MAC = 61 , OPT_END = 255 } |
| Types of options in the options fields. More... | |
Functions | |
| struct dhcp_packet_t | __attribute__ ((packed)) dhcp_packet_t |
| Definition of a DHCP packet. More... | |
| void | dhcp_discover () |
| Initiate DHCP discovery Non-blocking, establishes IP address in the background. Network and IP stack card must be initialised first. More... | |
| void | dhcp_request (uint8_t *request_ip, uint32_t xid, uint32_t server_ip) |
| send DHCPREQUEST packet. We send one on dhcp_discover() as DHCPDISCOVER then a second one as DHCPREQUEST once we are offered an IP address. More... | |
| void * | get_dhcp_options (dhcp_packet_t *packet, uint8_t type) |
| Get an option from a DHCP packet. More... | |
| uint16_t | make_dhcp_packet (dhcp_packet_t *packet, uint8_t msg_type, uint8_t *request_ip, uint32_t xid, uint32_t server_ip) |
| Build a DHCP packet. The contents of the options are built dynamically. More... | |
Variables | |
| uint8_t | op |
| uint8_t | hardware_type |
| uint8_t | hardware_addr_len |
| uint8_t | hops |
| uint32_t | xid |
| uint16_t | seconds |
| uint16_t | flags |
| uint32_t | client_ip |
| uint32_t | your_ip |
| uint32_t | server_ip |
| uint32_t | relay_agent_ip |
| uint8_t | client_hardware_addr [16] |
| uint8_t | server_name [64] |
| uint8_t | boot_file [128] |
| uint8_t | options [128] |
| #define DHCP_TRANSACTION_IDENTIFIER 0x55AA55AA |
Hard coded transaction identifier.
| enum dhcp_option_type_t |
| enum dhcp_packet_type_t |
| enum dhcp_request_type_t |
| enum dhcp_udp_ports_t |
| struct dhcp_packet_t __attribute__ | ( | (packed) | ) |
Definition of a DHCP packet.
| void dhcp_discover | ( | ) |
Initiate DHCP discovery Non-blocking, establishes IP address in the background. Network and IP stack card must be initialised first.
| void dhcp_request | ( | uint8_t * | request_ip, |
| uint32_t | xid, | ||
| uint32_t | server_ip | ||
| ) |
send DHCPREQUEST packet. We send one on dhcp_discover() as DHCPDISCOVER then a second one as DHCPREQUEST once we are offered an IP address.
| request_ip | IP address we have been offered, if we have been offered an IP yet. |
| xid | request ID as set by us when we did DHCPDISCOVER |
| server_ip | server IP that sent the offer to us |
| void* get_dhcp_options | ( | dhcp_packet_t * | packet, |
| uint8_t | type | ||
| ) |
Get an option from a DHCP packet.
| packet | raw packet |
| type | type to search for |
| uint16_t make_dhcp_packet | ( | dhcp_packet_t * | packet, |
| uint8_t | msg_type, | ||
| uint8_t * | request_ip, | ||
| uint32_t | xid, | ||
| uint32_t | server_ip | ||
| ) |
Build a DHCP packet. The contents of the options are built dynamically.
| packet | Packet structure to fill |
| msg_type | Message type to build |
| request_ip | IP address we were offered |
| xid | Our request identifier |
| server_ip | IP of server that offered the configuration |
| uint8_t boot_file[128] |
| uint8_t client_hardware_addr[16] |
| uint32_t client_ip |
| uint16_t flags |
| uint8_t hardware_addr_len |
| uint8_t hardware_type |
| uint8_t hops |
| uint8_t op |
| uint8_t options[128] |
| uint32_t relay_agent_ip |
| uint16_t seconds |
| uint32_t server_ip |
| uint8_t server_name[64] |
| uint32_t xid |
| uint32_t your_ip |