ホーム › NetworkManagement.Dns › DNS_DS_DATA
DNS_DS_DATA
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| wKeyTag | WORD | 2 | +0 | +0 | 委任先DNSKEYを特定するキータグ値を示す。 |
| chAlgorithm | BYTE | 1 | +2 | +2 | 対象DNSKEYの暗号アルゴリズム識別番号を示す。 |
| chDigestType | BYTE | 1 | +3 | +3 | ダイジェスト計算に用いたハッシュ種別を示す。SHA-256は値2。 |
| wDigestLength | WORD | 2 | +4 | +4 | Digest配列に格納されたダイジェストのバイト長を示す。 |
| wPad | WORD | 2 | +6 | +6 | アラインメント調整用のパディング。値は通常0。 |
| Digest | BYTE | 1 | +8 | +8 | 委任先DNSKEYのダイジェスト値を保持する可変長配列の先頭。 |
各言語での定義
#include <windows.h>
// DNS_DS_DATA (x64 10 / x86 10 バイト)
typedef struct DNS_DS_DATA {
WORD wKeyTag;
BYTE chAlgorithm;
BYTE chDigestType;
WORD wDigestLength;
WORD wPad;
BYTE Digest[1];
} DNS_DS_DATA;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DNS_DS_DATA
{
public ushort wKeyTag;
public byte chAlgorithm;
public byte chDigestType;
public ushort wDigestLength;
public ushort wPad;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public byte[] Digest;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DNS_DS_DATA
Public wKeyTag As UShort
Public chAlgorithm As Byte
Public chDigestType As Byte
Public wDigestLength As UShort
Public wPad As UShort
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public Digest() As Byte
End Structureimport ctypes
from ctypes import wintypes
class DNS_DS_DATA(ctypes.Structure):
_fields_ = [
("wKeyTag", ctypes.c_ushort),
("chAlgorithm", ctypes.c_ubyte),
("chDigestType", ctypes.c_ubyte),
("wDigestLength", ctypes.c_ushort),
("wPad", ctypes.c_ushort),
("Digest", ctypes.c_ubyte * 1),
]#[repr(C)]
pub struct DNS_DS_DATA {
pub wKeyTag: u16,
pub chAlgorithm: u8,
pub chDigestType: u8,
pub wDigestLength: u16,
pub wPad: u16,
pub Digest: [u8; 1],
}import "golang.org/x/sys/windows"
type DNS_DS_DATA struct {
wKeyTag uint16
chAlgorithm byte
chDigestType byte
wDigestLength uint16
wPad uint16
Digest [1]byte
}type
DNS_DS_DATA = record
wKeyTag: Word;
chAlgorithm: Byte;
chDigestType: Byte;
wDigestLength: Word;
wPad: Word;
Digest: array[0..0] of Byte;
end;const DNS_DS_DATA = extern struct {
wKeyTag: u16,
chAlgorithm: u8,
chDigestType: u8,
wDigestLength: u16,
wPad: u16,
Digest: [1]u8,
};type
DNS_DS_DATA {.bycopy.} = object
wKeyTag: uint16
chAlgorithm: uint8
chDigestType: uint8
wDigestLength: uint16
wPad: uint16
Digest: array[1, uint8]struct DNS_DS_DATA
{
ushort wKeyTag;
ubyte chAlgorithm;
ubyte chDigestType;
ushort wDigestLength;
ushort wPad;
ubyte[1] Digest;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DNS_DS_DATA サイズ: 10 バイト(x64)
dim st, 3 ; 4byte整数×3(構造体サイズ 10 / 4 切り上げ)
; wKeyTag : WORD (+0, 2byte) wpoke st,0,値 / 値 = wpeek(st,0)
; chAlgorithm : BYTE (+2, 1byte) poke st,2,値 / 値 = peek(st,2)
; chDigestType : BYTE (+3, 1byte) poke st,3,値 / 値 = peek(st,3)
; wDigestLength : WORD (+4, 2byte) wpoke st,4,値 / 値 = wpeek(st,4)
; wPad : WORD (+6, 2byte) wpoke st,6,値 / 値 = wpeek(st,6)
; Digest : BYTE (+8, 1byte) varptr(st)+8 を基点に操作(1byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DNS_DS_DATA
#field short wKeyTag
#field byte chAlgorithm
#field byte chDigestType
#field short wDigestLength
#field short wPad
#field byte Digest 1
#endstruct
stdim st, DNS_DS_DATA ; NSTRUCT 変数を確保
st->wKeyTag = 100
mes "wKeyTag=" + st->wKeyTag