Refining types style
This commit is contained in:
parent
1b9e229823
commit
1ec4166854
82
src/types.ts
82
src/types.ts
@ -1,17 +1,16 @@
|
|||||||
interface MessageHeader {
|
interface MessageHeader {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A 16 bit identifier assigned by the program that
|
* A 16 bit identifier assigned by the program that
|
||||||
* generates any kind of query. This identifier is copied
|
* generates any kind of query. This identifier is copied
|
||||||
* the corresponding reply and can be used by the requester
|
* the corresponding reply and can be used by the requester
|
||||||
* to match up replies to outstanding queries.
|
* to match up replies to outstanding queries.
|
||||||
*/
|
*/
|
||||||
ID: number
|
ID: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines if query or response
|
* Defines if query or response
|
||||||
*/
|
*/
|
||||||
QR: 0 | 1
|
QR: 0 | 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 4 Bit code, that defines type of query.
|
* 4 Bit code, that defines type of query.
|
||||||
@ -21,49 +20,47 @@ interface MessageHeader {
|
|||||||
* 3-15 reserved for future use
|
* 3-15 reserved for future use
|
||||||
*/
|
*/
|
||||||
OPCODE: number
|
OPCODE: number
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Authorative Answer - only valid in responses and
|
* Authorative Answer - only valid in responses and
|
||||||
* specifies that the responding name server is an
|
* specifies that the responding name server is an
|
||||||
* authority for the domain name in question section
|
* authority for the domain name in question section
|
||||||
*/
|
*/
|
||||||
AA: 0 | 1
|
AA: 0 | 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Truncation - specifies that his message was truncated doe to
|
* Truncation - specifies that his message was truncated doe to
|
||||||
* length grater than permitted on the transaction channel
|
* length grater than permitted on the transaction channel
|
||||||
*
|
*
|
||||||
* WARNING: NOT IMPLEMENTED IN THIS APPLICATION
|
* WARNING: NOT IMPLEMENTED IN THIS APPLICATION
|
||||||
*/
|
*/
|
||||||
TC: 0 | 1
|
TC: 0 | 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recursion Desired - set in query and copied to response
|
* Recursion Desired - set in query and copied to response
|
||||||
* if is set, directs name server to pursue the query recursively
|
* if is set, directs name server to pursue the query recursively
|
||||||
*
|
*
|
||||||
* WARNING: NOT IMPLEMENTED IN THIS APPLICATION
|
* WARNING: NOT IMPLEMENTED IN THIS APPLICATION
|
||||||
*/
|
*/
|
||||||
RD: 0 | 1
|
RD: 0 | 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recursion Available - will be cleared in response to
|
* Recursion Available - will be cleared in response to
|
||||||
* show the client that recursion is not available
|
* show the client that recursion is not available
|
||||||
*/
|
*/
|
||||||
RA: 0 | 1
|
RA: 0 | 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reserved for future usage, must be 0 in all queries
|
* Reserved for future usage, must be 0 in all queries
|
||||||
*/
|
*/
|
||||||
Z: 0
|
Z: 0;
|
||||||
|
|
||||||
AD: 0 | 1
|
AD: 0 | 1;
|
||||||
|
|
||||||
CD: 0 | 1
|
|
||||||
|
|
||||||
|
CD: 0 | 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Response Code - 4 bit field is part of response
|
* Response Code - 4 bit field is part of response
|
||||||
*
|
*
|
||||||
* 0 No error condition
|
* 0 No error condition
|
||||||
* 1 Format error - unable to interpret query
|
* 1 Format error - unable to interpret query
|
||||||
* 2 Server failure - internal problem
|
* 2 Server failure - internal problem
|
||||||
@ -72,106 +69,103 @@ interface MessageHeader {
|
|||||||
* 5 Refused - Nameserver refuses request
|
* 5 Refused - Nameserver refuses request
|
||||||
* 6-15 Reserved for future usage
|
* 6-15 Reserved for future usage
|
||||||
*/
|
*/
|
||||||
RCODE: 0 | 1 | 2 | 3 | 4 | 5
|
RCODE: 0 | 1 | 2 | 3 | 4 | 5;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number of entries in question section
|
* Number of entries in question section
|
||||||
* uint16
|
* uint16
|
||||||
*/
|
*/
|
||||||
QDCOUNT: number
|
QDCOUNT: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number of entries in answer section
|
* Number of entries in answer section
|
||||||
* uint16
|
* uint16
|
||||||
*/
|
*/
|
||||||
ANCOUNT: number
|
ANCOUNT: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number of resource records in authority records section
|
* Number of resource records in authority records section
|
||||||
* uint16
|
* uint16
|
||||||
*/
|
*/
|
||||||
NSCOUNT: number
|
NSCOUNT: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number of resource records in additional records section
|
* Number of resource records in additional records section
|
||||||
* uint16
|
* uint16
|
||||||
*/
|
*/
|
||||||
ARCOUNT: number
|
ARCOUNT: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface MessageQuestion {
|
interface MessageQuestion {
|
||||||
/**
|
/**
|
||||||
* Domain name represented as sequence of labels
|
* Domain name represented as sequence of labels
|
||||||
* Each label consists of a length octed followed
|
* Each label consists of a length octed followed
|
||||||
* by that number of octeds
|
* by that number of octeds
|
||||||
*/
|
*/
|
||||||
QNAME: string
|
QNAME: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Two octed code wich specifies the type of the query.
|
* Two octed code wich specifies the type of the query.
|
||||||
*/
|
*/
|
||||||
QTYPE: number
|
QTYPE: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Two octed code that specifies the class of the Query
|
* Two octed code that specifies the class of the Query
|
||||||
* IS for internet
|
* IS for internet
|
||||||
* WARNING: ONLY IN IS SUPPORTED BY THIS APPLICATION
|
* WARNING: ONLY IN IS SUPPORTED BY THIS APPLICATION
|
||||||
*/
|
*/
|
||||||
QCLASS: number
|
QCLASS: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface MessageRecourceRecord {
|
interface MessageRecourceRecord {
|
||||||
/**
|
/**
|
||||||
* Domain name to wich resource record pertains
|
* Domain name to wich resource record pertains
|
||||||
*/
|
*/
|
||||||
NAME: string
|
NAME: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Two octets containing TT type code.
|
* Two octets containing TT type code.
|
||||||
* Specifies meaning of data in RDATA field
|
* Specifies meaning of data in RDATA field
|
||||||
*
|
*
|
||||||
* uint16
|
* uint16
|
||||||
*/
|
*/
|
||||||
TYPE: number
|
TYPE: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Two octets specifying class of RDATA field
|
* Two octets specifying class of RDATA field
|
||||||
*
|
*
|
||||||
* uint16
|
* uint16
|
||||||
*/
|
*/
|
||||||
CLASS: number
|
CLASS: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specifies Time Interval (in seconds) that the record
|
* Specifies Time Interval (in seconds) that the record
|
||||||
* may be cached before discarded.
|
* may be cached before discarded.
|
||||||
* Zero values are not cached
|
* Zero values are not cached
|
||||||
*
|
*
|
||||||
* uint32
|
* uint32
|
||||||
*/
|
*/
|
||||||
TTL: number
|
TTL: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Length of RDATA field
|
* Length of RDATA field
|
||||||
*
|
*
|
||||||
* uint16
|
* uint16
|
||||||
*/
|
*/
|
||||||
RDLENGTH: number
|
RDLENGTH: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* a variable length string of ectets taht describes
|
* a variable length string of ectets taht describes
|
||||||
* the resource. The format is defined by TYPE and CLASS
|
* the resource. The format is defined by TYPE and CLASS
|
||||||
* field.
|
* field.
|
||||||
*
|
*
|
||||||
* If TYPE is A and CLASS is IN, RDATA is a 4 octet
|
* If TYPE is A and CLASS is IN, RDATA is a 4 octet
|
||||||
* ARPA internet address.
|
* ARPA internet address.
|
||||||
*/
|
*/
|
||||||
RDATA: Buffer
|
RDATA: Buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Message {
|
interface Message {
|
||||||
header: MessageHeader
|
header: MessageHeader;
|
||||||
questions: MessageQuestion[]
|
questions: MessageQuestion[];
|
||||||
answers: MessageRecourceRecord[];
|
answers: MessageRecourceRecord[];
|
||||||
authorities: MessageRecourceRecord[];
|
authorities: MessageRecourceRecord[];
|
||||||
additionals: MessageRecourceRecord[];
|
additionals: MessageRecourceRecord[];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user