nodename-core/lib/request.d.ts

64 lines
1.8 KiB
TypeScript
Raw Normal View History

/// <reference types="node" />
2018-05-17 08:01:56 +00:00
import { IMessage, IMessageHeader, IMessageQuestion, MessageRecourceRecord, ErrorCodes } from "./types";
export declare function parseHeader(data: Buffer): IMessageHeader;
export declare function parseQuestions(count: number, packet: Buffer): IMessageQuestion[];
export declare function serializeName(name: string): Buffer;
export declare class Request implements IMessage {
private sendCallback;
2018-05-17 08:01:56 +00:00
private max_size;
private _header;
2018-05-17 08:01:56 +00:00
readonly header: Header;
private _questions;
2018-05-17 08:01:56 +00:00
readonly questions: Question[];
answers: RecourceRecord[];
authorities: RecourceRecord[];
additionals: RecourceRecord[];
2018-05-17 08:01:56 +00:00
constructor(packet: Buffer, sendCallback: (packet: Buffer) => any, max_size?: number);
2018-05-13 18:32:55 +00:00
error(error: ErrorCodes): void;
noRecursion(): void;
send(): void;
2018-05-17 08:01:56 +00:00
serialize(): Buffer;
}
export declare class Header implements IMessageHeader {
ID: number;
QR: 0 | 1;
OPCODE: number;
AA: 0 | 1;
TC: 0 | 1;
RD: 0 | 1;
RA: 0 | 1;
Z: 0 | 1;
AD: 0 | 1;
CD: 0 | 1;
RCODE: ErrorCodes;
QDCOUNT: number;
ANCOUNT: number;
NSCOUNT: number;
ARCOUNT: number;
constructor(header: IMessageHeader);
serialize(): Buffer;
}
export declare class Question implements IMessageQuestion {
QNAME: string;
QTYPE: number;
QCLASS: number;
constructor(question: IMessageQuestion);
serialize(): Buffer;
}
export declare class RecourceRecord implements MessageRecourceRecord {
/**
* This value can be set to identify if specific record is already set
*/
Identifier: string;
NAME: string;
private _TYPE;
TYPE: number;
private _CLASS;
CLASS: number;
2018-05-13 17:27:40 +00:00
private _TTL;
TTL: number;
RDATA: Buffer;
readonly RDLENGTH: number;
2018-05-17 08:01:56 +00:00
serialize(): Buffer;
}