|
Retro Rocket Kernel
BASIC-Powered Operating System
|
#include "kernel.h"Data Structures | |
| struct | ResourceRecord |
| struct | dns_header |
| struct | dns_request_t |
| struct | resource_record |
| struct | dns_result_t |
Macros | |
| #define | DN_COMP_BITMASK 0xC000 |
| #define | ERROR_MASK 0x10000 |
| #define | FLAGS_MASK_RD 0x01 /* Recursive */ |
| #define | FLAGS_MASK_TC 0x02 |
| #define | FLAGS_MASK_AA 0x04 /* Authoritative */ |
| #define | FLAGS_MASK_OPCODE 0x78 |
| #define | FLAGS_MASK_QR 0x80 |
| #define | FLAGS_MASK_RCODE 0x0F /* Request */ |
| #define | FLAGS_MASK_Z 0x70 |
| #define | FLAGS_MASK_RA 0x80 |
| #define | DNS_DST_PORT 53 |
Typedefs | |
| typedef void(* | dns_reply_callback_a) (uint32_t result, const char *hostname, uint16_t reply_id) |
| typedef void(* | dns_reply_callback_aaaa) (uint8_t *result, const char *hostname, uint16_t reply_id) |
| typedef void(* | dns_reply_callback_ptr) (const char *const result, const uint32_t ip, uint16_t reply_id) |
Enumerations | |
| enum | query_type_t { DNS_QUERY_NONE = 0 , DNS_QUERY_A = 1 , DNS_QUERY_CNAME = 5 , DNS_QUERY_PTR = 12 , DNS_QUERY_AAAA = 28 , DNS_QUERY_PTR4 = 0xFFFD , DNS_QUERY_PTR6 = 0xFFFE } |
Functions | |
| struct dns_header | __attribute__ ((packed)) dns_header_t |
| uint32_t | dns_lookup_host (uint32_t resolver_ip, const char *hostname, uint32_t timeout) |
| Look up an IPV4 hostname to IP address, with timeout. More... | |
| uint16_t | dns_lookup_host_async (uint32_t resolver_ip, const char *hostname, uint32_t timeout, dns_reply_callback_a callback) |
| Look up an IPV4 hostname to IP address, with timeout. More... | |
| void | init_dns () |
| Initialise DNS protocol. This binds a UDP port for use with replies. More... | |
Variables | |
| uint16_t | id |
| uint8_t | flags1 |
| uint8_t | flags2 |
| uint16_t | qdcount |
| uint16_t | ancount |
| uint16_t | nscount |
| uint16_t | arcount |
| uint8_t | payload [512] |
| uint16_t | type |
| uint16_t | rr_class |
| uint32_t | ttl |
| uint16_t | rdlength |
| struct dns_result_t | __attribute__ |
| #define DN_COMP_BITMASK 0xC000 |
| #define DNS_DST_PORT 53 |
| #define ERROR_MASK 0x10000 |
| #define FLAGS_MASK_AA 0x04 /* Authoritative */ |
| #define FLAGS_MASK_OPCODE 0x78 |
| #define FLAGS_MASK_QR 0x80 |
| #define FLAGS_MASK_RA 0x80 |
| #define FLAGS_MASK_RCODE 0x0F /* Request */ |
| #define FLAGS_MASK_RD 0x01 /* Recursive */ |
| #define FLAGS_MASK_TC 0x02 |
| #define FLAGS_MASK_Z 0x70 |
| typedef void(* dns_reply_callback_a) (uint32_t result, const char *hostname, uint16_t reply_id) |
| typedef void(* dns_reply_callback_aaaa) (uint8_t *result, const char *hostname, uint16_t reply_id) |
| typedef void(* dns_reply_callback_ptr) (const char *const result, const uint32_t ip, uint16_t reply_id) |
| enum query_type_t |
| struct dns_header __attribute__ | ( | (packed) | ) |
Represents a dns request/reply header, and its payload as opaque data.
| uint32_t dns_lookup_host | ( | uint32_t | resolver_ip, |
| const char * | hostname, | ||
| uint32_t | timeout | ||
| ) |
Look up an IPV4 hostname to IP address, with timeout.
| resolver_ip | The IP of the resolver to use, in network byte order |
| hostname | Host address to resolve |
| timeout | Timeout in seconds |
| uint16_t dns_lookup_host_async | ( | uint32_t | resolver_ip, |
| const char * | hostname, | ||
| uint32_t | timeout, | ||
| dns_reply_callback_a | callback | ||
| ) |
Look up an IPV4 hostname to IP address, with timeout.
| resolver_ip | The IP of the resolver to use, in network byte order |
| hostname | Host address to resolve |
| timeout | Timeout in seconds |
| dns_reply_callback_a | Callback to receive the resolved IP address. If an error occured during resolution, the received IP address will be 0, which is a representation of 0.0.0.0. |
| void init_dns | ( | ) |
Initialise DNS protocol. This binds a UDP port for use with replies.
| struct dns_result_t __attribute__ |
| uint16_t ancount |
| uint16_t arcount |
| uint8_t flags1 |
| uint8_t flags2 |
| uint16_t id |
| uint16_t nscount |
| uint8_t payload[512] |
| uint16_t qdcount |
| uint16_t rdlength |
| uint16_t rr_class |
| uint32_t ttl |
| uint8_t type |