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

RADIUS_VSA_FORMAT

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

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

フィールド

フィールドサイズx64x86説明
VendorIdBYTE4+0+0ベンダー固有属性(VSA)のベンダーIDの一部を表すバイト値。
VendorTypeBYTE1+4+4ベンダー定義のサブ属性タイプを示すバイト値。
VendorLengthBYTE1+5+5ベンダー固有データの長さをバイト単位で示す値。
AttributeSpecificBYTE1+6+6ベンダー固有の属性値の先頭バイト。可変長データの起点となる。

各言語での定義

#include <windows.h>

// RADIUS_VSA_FORMAT  (x64 7 / x86 7 バイト)
typedef struct RADIUS_VSA_FORMAT {
    BYTE VendorId[4];
    BYTE VendorType;
    BYTE VendorLength;
    BYTE AttributeSpecific[1];
} RADIUS_VSA_FORMAT;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct RADIUS_VSA_FORMAT
{
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] VendorId;
    public byte VendorType;
    public byte VendorLength;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public byte[] AttributeSpecific;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure RADIUS_VSA_FORMAT
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)> Public VendorId() As Byte
    Public VendorType As Byte
    Public VendorLength As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public AttributeSpecific() As Byte
End Structure
import ctypes
from ctypes import wintypes

class RADIUS_VSA_FORMAT(ctypes.Structure):
    _fields_ = [
        ("VendorId", ctypes.c_ubyte * 4),
        ("VendorType", ctypes.c_ubyte),
        ("VendorLength", ctypes.c_ubyte),
        ("AttributeSpecific", ctypes.c_ubyte * 1),
    ]
#[repr(C)]
pub struct RADIUS_VSA_FORMAT {
    pub VendorId: [u8; 4],
    pub VendorType: u8,
    pub VendorLength: u8,
    pub AttributeSpecific: [u8; 1],
}
import "golang.org/x/sys/windows"

type RADIUS_VSA_FORMAT struct {
	VendorId [4]byte
	VendorType byte
	VendorLength byte
	AttributeSpecific [1]byte
}
type
  RADIUS_VSA_FORMAT = record
    VendorId: array[0..3] of Byte;
    VendorType: Byte;
    VendorLength: Byte;
    AttributeSpecific: array[0..0] of Byte;
  end;
const RADIUS_VSA_FORMAT = extern struct {
    VendorId: [4]u8,
    VendorType: u8,
    VendorLength: u8,
    AttributeSpecific: [1]u8,
};
type
  RADIUS_VSA_FORMAT {.bycopy.} = object
    VendorId: array[4, uint8]
    VendorType: uint8
    VendorLength: uint8
    AttributeSpecific: array[1, uint8]
struct RADIUS_VSA_FORMAT
{
    ubyte[4] VendorId;
    ubyte VendorType;
    ubyte VendorLength;
    ubyte[1] AttributeSpecific;
}

HSP用 定義

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

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

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