Win32 API 日本語リファレンス
ホームNetworking.Ldap › LDAP

LDAP

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

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

フィールド

フィールドサイズx64x86説明
ld_sb_ld_sb_e__Struct88/76+0+0LDAP接続の下位ソケットバッファ情報を保持する内部構造体。
ld_hostLPSTR8/4+88+76接続先LDAPサーバーのホスト名を表す文字列。
ld_versionDWORD4+96+80使用するLDAPプロトコルのバージョン(通常2または3)。
ld_lberoptionsBYTE1+100+84BERエンコード処理に関するオプションフラグ。
ld_derefDWORD4+104+88検索時のエイリアス参照解決(deref)動作を指定する値。
ld_timelimitDWORD4+108+92検索操作のサーバー側時間制限を秒単位で指定する。0は無制限。
ld_sizelimitDWORD4+112+96検索結果のエントリ数上限を指定する。0は無制限。
ld_errnoDWORD4+116+100直近の操作で発生したLDAPエラーコード。
ld_matchedLPSTR8/4+120+104エラー時にマッチした最も深いDNを示す文字列。
ld_errorLPSTR8/4+128+108サーバーから返されたエラーメッセージ文字列。
ld_msgidDWORD4+136+112直近に発行したリクエストのメッセージID。
Reserved3BYTE25+140+116将来の使用のために予約された領域。
ld_cldaptriesDWORD4+168+144コネクションレスLDAP(CLDAP)での再送試行回数。
ld_cldaptimeoutDWORD4+172+148CLDAP応答待ちのタイムアウト値。
ld_refhoplimitDWORD4+176+152リファーラル追跡時の最大ホップ数。
ld_optionsDWORD4+180+156LDAPセッションの各種オプションを示すビットフラグ。
ld_anonymousmaxvalrangeDWORD4+184+160匿名バインド時に取得可能な属性値範囲の上限。

構造体: _ld_sb_e__Struct x64 88B / x86 76B

フィールドサイズx64x86
sb_sdUINT_PTR8/4+0+0
Reserved1BYTE41+8+4
sb_naddrUINT_PTR8/4+56+48
Reserved2BYTE24+64+52

各言語での定義

#include <windows.h>

// LDAP  (x64 192 / x86 164 バイト)
typedef struct LDAP {
    _ld_sb_e__Struct ld_sb;
    LPSTR ld_host;
    DWORD ld_version;
    BYTE ld_lberoptions;
    DWORD ld_deref;
    DWORD ld_timelimit;
    DWORD ld_sizelimit;
    DWORD ld_errno;
    LPSTR ld_matched;
    LPSTR ld_error;
    DWORD ld_msgid;
    BYTE Reserved3[25];
    DWORD ld_cldaptries;
    DWORD ld_cldaptimeout;
    DWORD ld_refhoplimit;
    DWORD ld_options;
    DWORD ld_anonymousmaxvalrange;
} LDAP;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct LDAP
{
    public _ld_sb_e__Struct ld_sb;
    public IntPtr ld_host;
    public uint ld_version;
    public byte ld_lberoptions;
    public uint ld_deref;
    public uint ld_timelimit;
    public uint ld_sizelimit;
    public uint ld_errno;
    public IntPtr ld_matched;
    public IntPtr ld_error;
    public uint ld_msgid;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 25)] public byte[] Reserved3;
    public uint ld_cldaptries;
    public uint ld_cldaptimeout;
    public uint ld_refhoplimit;
    public uint ld_options;
    public uint ld_anonymousmaxvalrange;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure LDAP
    Public ld_sb As _ld_sb_e__Struct
    Public ld_host As IntPtr
    Public ld_version As UInteger
    Public ld_lberoptions As Byte
    Public ld_deref As UInteger
    Public ld_timelimit As UInteger
    Public ld_sizelimit As UInteger
    Public ld_errno As UInteger
    Public ld_matched As IntPtr
    Public ld_error As IntPtr
    Public ld_msgid As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=25)> Public Reserved3() As Byte
    Public ld_cldaptries As UInteger
    Public ld_cldaptimeout As UInteger
    Public ld_refhoplimit As UInteger
    Public ld_options As UInteger
    Public ld_anonymousmaxvalrange As UInteger
End Structure
import ctypes
from ctypes import wintypes

class LDAP(ctypes.Structure):
    _fields_ = [
        ("ld_sb", _ld_sb_e__Struct),
        ("ld_host", ctypes.c_void_p),
        ("ld_version", wintypes.DWORD),
        ("ld_lberoptions", ctypes.c_ubyte),
        ("ld_deref", wintypes.DWORD),
        ("ld_timelimit", wintypes.DWORD),
        ("ld_sizelimit", wintypes.DWORD),
        ("ld_errno", wintypes.DWORD),
        ("ld_matched", ctypes.c_void_p),
        ("ld_error", ctypes.c_void_p),
        ("ld_msgid", wintypes.DWORD),
        ("Reserved3", ctypes.c_ubyte * 25),
        ("ld_cldaptries", wintypes.DWORD),
        ("ld_cldaptimeout", wintypes.DWORD),
        ("ld_refhoplimit", wintypes.DWORD),
        ("ld_options", wintypes.DWORD),
        ("ld_anonymousmaxvalrange", wintypes.DWORD),
    ]
#[repr(C)]
pub struct LDAP {
    pub ld_sb: _ld_sb_e__Struct,
    pub ld_host: *mut core::ffi::c_void,
    pub ld_version: u32,
    pub ld_lberoptions: u8,
    pub ld_deref: u32,
    pub ld_timelimit: u32,
    pub ld_sizelimit: u32,
    pub ld_errno: u32,
    pub ld_matched: *mut core::ffi::c_void,
    pub ld_error: *mut core::ffi::c_void,
    pub ld_msgid: u32,
    pub Reserved3: [u8; 25],
    pub ld_cldaptries: u32,
    pub ld_cldaptimeout: u32,
    pub ld_refhoplimit: u32,
    pub ld_options: u32,
    pub ld_anonymousmaxvalrange: u32,
}
import "golang.org/x/sys/windows"

type LDAP struct {
	ld_sb _ld_sb_e__Struct
	ld_host uintptr
	ld_version uint32
	ld_lberoptions byte
	ld_deref uint32
	ld_timelimit uint32
	ld_sizelimit uint32
	ld_errno uint32
	ld_matched uintptr
	ld_error uintptr
	ld_msgid uint32
	Reserved3 [25]byte
	ld_cldaptries uint32
	ld_cldaptimeout uint32
	ld_refhoplimit uint32
	ld_options uint32
	ld_anonymousmaxvalrange uint32
}
type
  LDAP = record
    ld_sb: _ld_sb_e__Struct;
    ld_host: Pointer;
    ld_version: DWORD;
    ld_lberoptions: Byte;
    ld_deref: DWORD;
    ld_timelimit: DWORD;
    ld_sizelimit: DWORD;
    ld_errno: DWORD;
    ld_matched: Pointer;
    ld_error: Pointer;
    ld_msgid: DWORD;
    Reserved3: array[0..24] of Byte;
    ld_cldaptries: DWORD;
    ld_cldaptimeout: DWORD;
    ld_refhoplimit: DWORD;
    ld_options: DWORD;
    ld_anonymousmaxvalrange: DWORD;
  end;
const LDAP = extern struct {
    ld_sb: _ld_sb_e__Struct,
    ld_host: ?*anyopaque,
    ld_version: u32,
    ld_lberoptions: u8,
    ld_deref: u32,
    ld_timelimit: u32,
    ld_sizelimit: u32,
    ld_errno: u32,
    ld_matched: ?*anyopaque,
    ld_error: ?*anyopaque,
    ld_msgid: u32,
    Reserved3: [25]u8,
    ld_cldaptries: u32,
    ld_cldaptimeout: u32,
    ld_refhoplimit: u32,
    ld_options: u32,
    ld_anonymousmaxvalrange: u32,
};
type
  LDAP {.bycopy.} = object
    ld_sb: _ld_sb_e__Struct
    ld_host: pointer
    ld_version: uint32
    ld_lberoptions: uint8
    ld_deref: uint32
    ld_timelimit: uint32
    ld_sizelimit: uint32
    ld_errno: uint32
    ld_matched: pointer
    ld_error: pointer
    ld_msgid: uint32
    Reserved3: array[25, uint8]
    ld_cldaptries: uint32
    ld_cldaptimeout: uint32
    ld_refhoplimit: uint32
    ld_options: uint32
    ld_anonymousmaxvalrange: uint32
struct LDAP
{
    _ld_sb_e__Struct ld_sb;
    void* ld_host;
    uint ld_version;
    ubyte ld_lberoptions;
    uint ld_deref;
    uint ld_timelimit;
    uint ld_sizelimit;
    uint ld_errno;
    void* ld_matched;
    void* ld_error;
    uint ld_msgid;
    ubyte[25] Reserved3;
    uint ld_cldaptries;
    uint ld_cldaptimeout;
    uint ld_refhoplimit;
    uint ld_options;
    uint ld_anonymousmaxvalrange;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; LDAP サイズ: 164 バイト(x86)
dim st, 41    ; 4byte整数×41(構造体サイズ 164 / 4 切り上げ)
; ld_sb : _ld_sb_e__Struct (+0, 76byte)  varptr(st)+0 を基点に操作(76byte:入れ子/配列)
; ld_host : LPSTR (+76, 4byte)  st.19 = 値  /  値 = st.19   (lpoke/lpeek も可)
; ld_version : DWORD (+80, 4byte)  st.20 = 値  /  値 = st.20   (lpoke/lpeek も可)
; ld_lberoptions : BYTE (+84, 1byte)  poke st,84,値  /  値 = peek(st,84)
; ld_deref : DWORD (+88, 4byte)  st.22 = 値  /  値 = st.22   (lpoke/lpeek も可)
; ld_timelimit : DWORD (+92, 4byte)  st.23 = 値  /  値 = st.23   (lpoke/lpeek も可)
; ld_sizelimit : DWORD (+96, 4byte)  st.24 = 値  /  値 = st.24   (lpoke/lpeek も可)
; ld_errno : DWORD (+100, 4byte)  st.25 = 値  /  値 = st.25   (lpoke/lpeek も可)
; ld_matched : LPSTR (+104, 4byte)  st.26 = 値  /  値 = st.26   (lpoke/lpeek も可)
; ld_error : LPSTR (+108, 4byte)  st.27 = 値  /  値 = st.27   (lpoke/lpeek も可)
; ld_msgid : DWORD (+112, 4byte)  st.28 = 値  /  値 = st.28   (lpoke/lpeek も可)
; Reserved3 : BYTE (+116, 25byte)  varptr(st)+116 を基点に操作(25byte:入れ子/配列)
; ld_cldaptries : DWORD (+144, 4byte)  st.36 = 値  /  値 = st.36   (lpoke/lpeek も可)
; ld_cldaptimeout : DWORD (+148, 4byte)  st.37 = 値  /  値 = st.37   (lpoke/lpeek も可)
; ld_refhoplimit : DWORD (+152, 4byte)  st.38 = 値  /  値 = st.38   (lpoke/lpeek も可)
; ld_options : DWORD (+156, 4byte)  st.39 = 値  /  値 = st.39   (lpoke/lpeek も可)
; ld_anonymousmaxvalrange : DWORD (+160, 4byte)  st.40 = 値  /  値 = st.40   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; LDAP サイズ: 192 バイト(x64)
dim st, 48    ; 4byte整数×48(構造体サイズ 192 / 4 切り上げ)
; ld_sb : _ld_sb_e__Struct (+0, 88byte)  varptr(st)+0 を基点に操作(88byte:入れ子/配列)
; ld_host : LPSTR (+88, 8byte)  qpoke st,88,値 / qpeek(st,88)  ※IronHSPのみ。3.7/3.8は lpoke st,88,下位 : lpoke st,92,上位
; ld_version : DWORD (+96, 4byte)  st.24 = 値  /  値 = st.24   (lpoke/lpeek も可)
; ld_lberoptions : BYTE (+100, 1byte)  poke st,100,値  /  値 = peek(st,100)
; ld_deref : DWORD (+104, 4byte)  st.26 = 値  /  値 = st.26   (lpoke/lpeek も可)
; ld_timelimit : DWORD (+108, 4byte)  st.27 = 値  /  値 = st.27   (lpoke/lpeek も可)
; ld_sizelimit : DWORD (+112, 4byte)  st.28 = 値  /  値 = st.28   (lpoke/lpeek も可)
; ld_errno : DWORD (+116, 4byte)  st.29 = 値  /  値 = st.29   (lpoke/lpeek も可)
; ld_matched : LPSTR (+120, 8byte)  qpoke st,120,値 / qpeek(st,120)  ※IronHSPのみ。3.7/3.8は lpoke st,120,下位 : lpoke st,124,上位
; ld_error : LPSTR (+128, 8byte)  qpoke st,128,値 / qpeek(st,128)  ※IronHSPのみ。3.7/3.8は lpoke st,128,下位 : lpoke st,132,上位
; ld_msgid : DWORD (+136, 4byte)  st.34 = 値  /  値 = st.34   (lpoke/lpeek も可)
; Reserved3 : BYTE (+140, 25byte)  varptr(st)+140 を基点に操作(25byte:入れ子/配列)
; ld_cldaptries : DWORD (+168, 4byte)  st.42 = 値  /  値 = st.42   (lpoke/lpeek も可)
; ld_cldaptimeout : DWORD (+172, 4byte)  st.43 = 値  /  値 = st.43   (lpoke/lpeek も可)
; ld_refhoplimit : DWORD (+176, 4byte)  st.44 = 値  /  値 = st.44   (lpoke/lpeek も可)
; ld_options : DWORD (+180, 4byte)  st.45 = 値  /  値 = st.45   (lpoke/lpeek も可)
; ld_anonymousmaxvalrange : DWORD (+184, 4byte)  st.46 = 値  /  値 = st.46   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global LDAP
    #field _ld_sb_e__Struct ld_sb
    #field intptr ld_host
    #field int ld_version
    #field byte ld_lberoptions
    #field int ld_deref
    #field int ld_timelimit
    #field int ld_sizelimit
    #field int ld_errno
    #field intptr ld_matched
    #field intptr ld_error
    #field int ld_msgid
    #field byte Reserved3 25
    #field int ld_cldaptries
    #field int ld_cldaptimeout
    #field int ld_refhoplimit
    #field int ld_options
    #field int ld_anonymousmaxvalrange
#endstruct

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