ホーム › NetworkManagement.Dns › DNS_WIRE_QUESTION
DNS_WIRE_QUESTION
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| QuestionType | WORD | 2 | +0 | +0 | 質問セクションの DNS Question Type を表す値です。 |
| QuestionClass | WORD | 2 | +2 | +2 | 質問セクションの DNS Question Class を表す値です。 |
公式ドキュメント
DNS_WIRE_QUESTION 構造体は、RFC 1035 のセクション 4.1.2 で規定されているとおり、ネットワーク上で送受信される DNS の質問に関する情報を格納します。
解説(Remarks)
DNS メッセージを構築する際は、質問名を DNS_WIRE_QUESTION 構造体の前に配置しなければなりません。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での定義
#include <windows.h>
// DNS_WIRE_QUESTION (x64 4 / x86 4 バイト)
#pragma pack(push, 1)
typedef struct DNS_WIRE_QUESTION {
WORD QuestionType;
WORD QuestionClass;
} DNS_WIRE_QUESTION;
#pragma pack(pop)using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct DNS_WIRE_QUESTION
{
public ushort QuestionType;
public ushort QuestionClass;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure DNS_WIRE_QUESTION
Public QuestionType As UShort
Public QuestionClass As UShort
End Structureimport ctypes
from ctypes import wintypes
class DNS_WIRE_QUESTION(ctypes.Structure):
_pack_ = 1
_fields_ = [
("QuestionType", ctypes.c_ushort),
("QuestionClass", ctypes.c_ushort),
]#[repr(C, packed(1))]
pub struct DNS_WIRE_QUESTION {
pub QuestionType: u16,
pub QuestionClass: u16,
}import "golang.org/x/sys/windows"
type DNS_WIRE_QUESTION struct {
QuestionType uint16
QuestionClass uint16
}type
DNS_WIRE_QUESTION = packed record
QuestionType: Word;
QuestionClass: Word;
end;const DNS_WIRE_QUESTION = extern struct {
QuestionType: u16,
QuestionClass: u16,
};type
DNS_WIRE_QUESTION {.packed.} = object
QuestionType: uint16
QuestionClass: uint16align(1)
struct DNS_WIRE_QUESTION
{
ushort QuestionType;
ushort QuestionClass;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DNS_WIRE_QUESTION サイズ: 4 バイト(x64)
dim st, 1 ; 4byte整数×1(構造体サイズ 4 / 4 切り上げ)
; QuestionType : WORD (+0, 2byte) wpoke st,0,値 / 値 = wpeek(st,0)
; QuestionClass : WORD (+2, 2byte) wpoke st,2,値 / 値 = wpeek(st,2)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DNS_WIRE_QUESTION, pack=1
#field short QuestionType
#field short QuestionClass
#endstruct
stdim st, DNS_WIRE_QUESTION ; NSTRUCT 変数を確保
st->QuestionType = 100
mes "QuestionType=" + st->QuestionType