123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- /*++
- Copyright (c) 2015 Minoca Corp.
- This file is licensed under the terms of the GNU General Public License
- version 3. Alternative licensing terms are available. Contact
- info@minocacorp.com for details. See the LICENSE file at the root of this
- project for complete licensing information.
- Module Name:
- net.h
- Abstract:
- This header contains internal definitions for networking support in the
- C library.
- Author:
- Evan Green 23-Jan-2015
- --*/
- //
- // ------------------------------------------------------------------- Includes
- //
- //
- // ---------------------------------------------------------------- Definitions
- //
- //
- // Define the standard reserved port number for DNS requests.
- //
- #define DNS_PORT_NUMBER 53
- //
- // Define DNS request/response flags. These flags code a 16-bit field assuming
- // a little endian machine.
- //
- #define DNS_HEADER_FLAG_RESPONSE 0x0080
- #define DNS_HEADER_OPCODE_SHIFT 3
- #define DNS_HEADER_OPCODE_QUERY 0x0
- #define DNS_HEADER_OPCODE_INVERSE_QUERY 0x1
- #define DNS_HEADER_OPCODE_STATUS 0x2
- #define DNS_HEADER_OPCODE_UPDATE 0x5
- #define DNS_HEADER_OPCODE_MASK 0xF
- #define DNS_HEADER_FLAG_AUTHORITATIVE_ANSWER 0x0004
- #define DNS_HEADER_FLAG_TRUNCATION 0x0002
- #define DNS_HEADER_FLAG_RECURSION_DESIRED 0x0001
- #define DNS_EHADER_FLAG_RECURSION_AVAILABLE 0x8000
- #define DNS_HEADER_RESPONSE_SHIFT 8
- #define DNS_HEADER_RESPONSE_SUCCESS 0x0
- #define DNS_HEADER_RESPONSE_FORMAT_ERROR 0x1
- #define DNS_HEADER_RESPONSE_SERVER_FAILURE 0x2
- #define DNS_HEADER_RESPONSE_NAME_ERROR 0x3
- #define DNS_HEADER_RESPONSE_NOT_IMPLEMENTED 0x4
- #define DNS_HEADER_RESPONSE_REFUSED 0x5
- #define DNS_HEADER_RESPONSE_MASK 0xF
- #define DNS_COMPRESSION_MASK 0xC0
- #define DNS_COMPRESSION_VALUE 0xC0
- #define DNS_MAX_NAME 255
- #define NETWORK_DEVICE_COUNT_ESTIMATE 5
- //
- // ------------------------------------------------------ Data Type Definitions
- //
- /*++
- Structure Description:
- This structure defines a DNS request and response header.
- Members:
- Identifier - Stores a 16-bit identifier used to uniquely identify the
- request.
- Flags - Stores a set of flags relating to the request or response.
- QuestionCount - Stores the number of questions in the remainder of the
- packet.
- AnswerCount - Stores the numer of answers in the remainder of the packet.
- NameServerCount - Stores the number of name server responses in the packet.
- AdditionalResourceCount - Stores the number of additional resources in the
- packet.
- --*/
- #pragma pack(push, 1)
- typedef struct _DNS_HEADER {
- USHORT Identifier;
- USHORT Flags;
- USHORT QuestionCount;
- USHORT AnswerCount;
- USHORT NameServerCount;
- USHORT AdditionalResourceCount;
- } PACKED DNS_HEADER, *PDNS_HEADER;
- #pragma pack(pop)
- //
- // -------------------------------------------------------------------- Globals
- //
- //
- // Define the network device information UUID.
- //
- extern UUID ClNetworkDeviceInformationUuid;
- //
- // -------------------------------------------------------- Function Prototypes
- //
|