Win32 API 日本語リファレンス
ホームNetworkManagement.Dns › DNS_NSEC3_DATA

DNS_NSEC3_DATA

構造体
サイズx64: 10 バイト / x86: 10 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
chAlgorithmBYTE1+0+0ハッシュ計算に用いるアルゴリズム識別番号を示す。SHA-1は値1。
bFlagsBYTE1+1+1オプトアウト等を示すNSEC3フラグ値を保持する。
wIterationsWORD2+2+2ハッシュを反復適用する追加回数を示す。
bSaltLengthBYTE1+4+4ソルトのバイト長を示す。0の場合ソルトなし。
bHashLengthBYTE1+5+5次ハッシュ名のハッシュ値バイト長を示す。
wTypeBitMapsLengthWORD2+6+6タイプビットマップ部分のバイト長を示す。
chDataBYTE1+8+8ソルト・次ハッシュ名・タイプビットマップを連結した可変長データの先頭。

各言語での定義

#include <windows.h>

// DNS_NSEC3_DATA  (x64 10 / x86 10 バイト)
typedef struct DNS_NSEC3_DATA {
    BYTE chAlgorithm;
    BYTE bFlags;
    WORD wIterations;
    BYTE bSaltLength;
    BYTE bHashLength;
    WORD wTypeBitMapsLength;
    BYTE chData[1];
} DNS_NSEC3_DATA;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DNS_NSEC3_DATA
{
    public byte chAlgorithm;
    public byte bFlags;
    public ushort wIterations;
    public byte bSaltLength;
    public byte bHashLength;
    public ushort wTypeBitMapsLength;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public byte[] chData;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DNS_NSEC3_DATA
    Public chAlgorithm As Byte
    Public bFlags As Byte
    Public wIterations As UShort
    Public bSaltLength As Byte
    Public bHashLength As Byte
    Public wTypeBitMapsLength As UShort
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public chData() As Byte
End Structure
import ctypes
from ctypes import wintypes

class DNS_NSEC3_DATA(ctypes.Structure):
    _fields_ = [
        ("chAlgorithm", ctypes.c_ubyte),
        ("bFlags", ctypes.c_ubyte),
        ("wIterations", ctypes.c_ushort),
        ("bSaltLength", ctypes.c_ubyte),
        ("bHashLength", ctypes.c_ubyte),
        ("wTypeBitMapsLength", ctypes.c_ushort),
        ("chData", ctypes.c_ubyte * 1),
    ]
#[repr(C)]
pub struct DNS_NSEC3_DATA {
    pub chAlgorithm: u8,
    pub bFlags: u8,
    pub wIterations: u16,
    pub bSaltLength: u8,
    pub bHashLength: u8,
    pub wTypeBitMapsLength: u16,
    pub chData: [u8; 1],
}
import "golang.org/x/sys/windows"

type DNS_NSEC3_DATA struct {
	chAlgorithm byte
	bFlags byte
	wIterations uint16
	bSaltLength byte
	bHashLength byte
	wTypeBitMapsLength uint16
	chData [1]byte
}
type
  DNS_NSEC3_DATA = record
    chAlgorithm: Byte;
    bFlags: Byte;
    wIterations: Word;
    bSaltLength: Byte;
    bHashLength: Byte;
    wTypeBitMapsLength: Word;
    chData: array[0..0] of Byte;
  end;
const DNS_NSEC3_DATA = extern struct {
    chAlgorithm: u8,
    bFlags: u8,
    wIterations: u16,
    bSaltLength: u8,
    bHashLength: u8,
    wTypeBitMapsLength: u16,
    chData: [1]u8,
};
type
  DNS_NSEC3_DATA {.bycopy.} = object
    chAlgorithm: uint8
    bFlags: uint8
    wIterations: uint16
    bSaltLength: uint8
    bHashLength: uint8
    wTypeBitMapsLength: uint16
    chData: array[1, uint8]
struct DNS_NSEC3_DATA
{
    ubyte chAlgorithm;
    ubyte bFlags;
    ushort wIterations;
    ubyte bSaltLength;
    ubyte bHashLength;
    ushort wTypeBitMapsLength;
    ubyte[1] chData;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DNS_NSEC3_DATA サイズ: 10 バイト(x64)
dim st, 3    ; 4byte整数×3(構造体サイズ 10 / 4 切り上げ)
; chAlgorithm : BYTE (+0, 1byte)  poke st,0,値  /  値 = peek(st,0)
; bFlags : BYTE (+1, 1byte)  poke st,1,値  /  値 = peek(st,1)
; wIterations : WORD (+2, 2byte)  wpoke st,2,値  /  値 = wpeek(st,2)
; bSaltLength : BYTE (+4, 1byte)  poke st,4,値  /  値 = peek(st,4)
; bHashLength : BYTE (+5, 1byte)  poke st,5,値  /  値 = peek(st,5)
; wTypeBitMapsLength : WORD (+6, 2byte)  wpoke st,6,値  /  値 = wpeek(st,6)
; chData : BYTE (+8, 1byte)  varptr(st)+8 を基点に操作(1byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DNS_NSEC3_DATA
    #field byte chAlgorithm
    #field byte bFlags
    #field short wIterations
    #field byte bSaltLength
    #field byte bHashLength
    #field short wTypeBitMapsLength
    #field byte chData 1
#endstruct

stdim st, DNS_NSEC3_DATA        ; NSTRUCT 変数を確保
st->chAlgorithm = 100
mes "chAlgorithm=" + st->chAlgorithm