跳转到内容

std.os.uefi.protocol.ip6

标准库Zig 0.17.0官方原文
源码std/os/uefi/protocol/ip6.zig

第 1 行

std.os.uefi.protocol.ip6.cc

别名

第 9 行

别名目标 std.os.uefi.cc

std.os.uefi.protocol.ip6.Event

别名

第 4 行

别名目标 std.os.uefi.Event

std.os.uefi.protocol.ip6.Guid

别名

第 3 行

别名目标 std.os.uefi.Guid

std.os.uefi.protocol.ip6.Ip6

容器

第 11 行

字段

_get_mode_data: *const fn (*const Ip6, ?*Mode, ?*ManagedNetworkConfigData, ?*SimpleNetwork) callconv(cc) Status
_configure: *const fn (*Ip6, ?*const Config) callconv(cc) Status
_groups: *const fn (*Ip6, bool, ?*const Address) callconv(cc) Status
_routes: *const fn (*Ip6, bool, ?*const Address, u8, ?*const Address) callconv(cc) Status
_neighbors: *const fn (*Ip6, bool, *const Address, ?*const MacAddress, u32, bool) callconv(cc) Status
_transmit: *const fn (*Ip6, *CompletionToken) callconv(cc) Status
_receive: *const fn (*Ip6, *CompletionToken) callconv(cc) Status
_cancel: *const fn (*Ip6, ?*CompletionToken) callconv(cc) Status
_poll: *const fn (*Ip6) callconv(cc) Status

std.os.uefi.protocol.ip6.Ip6.Address

类型

第 347 行

std.os.uefi.protocol.ip6.Ip6.AddressInfo

容器

第 349 行

字段

address: Address
prefix_length: u8

std.os.uefi.protocol.ip6.Ip6.cancel

函数

第 269 行

中止异步发送或接收请求。

pub fn cancel(self: *Ip6, token: ?*CompletionToken) CancelError!void

参数

self: *Ip6
token: ?*CompletionToken

错误

DeviceError
InvalidParameter
NotFound
NotStarted
Unexpected UnexpectedError

std.os.uefi.protocol.ip6.Ip6.CancelError

错误集合

第 80 行

错误

DeviceError
InvalidParameter
NotFound
NotStarted
Unexpected UnexpectedError

std.os.uefi.protocol.ip6.Ip6.CompletionToken

容器

第 379 行

字段

event: Event
status: Status
packet: *anyopaque

std.os.uefi.protocol.ip6.Ip6.Config

容器

第 333 行

字段

default_protocol: u8
accept_any_protocol: bool
accept_icmp_errors: bool
accept_promiscuous: bool
destination_address: Address
station_address: Address
traffic_class: u8
hop_limit: u8
flow_label: u32
receive_timeout: u32
transmit_timeout: u32

std.os.uefi.protocol.ip6.Ip6.configure

函数

第 113 行

为此 EFI IPv6 协议驱动实例分配 IPv6 地址及其他配置参数。

要重置配置,请改用 disable。

pub fn configure(self: *Ip6, ip6_config_data: *const Config) ConfigureError!void

参数

self: *Ip6
ip6_config_data: *const Config

错误

AlreadyStarted
DeviceError
InvalidParameter
NoMapping
OutOfResources
Unexpected UnexpectedError
Unsupported

std.os.uefi.protocol.ip6.Ip6.ConfigureError

错误集合

第 26 行

错误

AlreadyStarted
DeviceError
InvalidParameter
NoMapping
OutOfResources
Unexpected UnexpectedError
Unsupported

std.os.uefi.protocol.ip6.Ip6.DeleteFlag

容器

第 304 行

字段

delete
add

std.os.uefi.protocol.ip6.Ip6.disable

函数

第 126 行

pub fn disable(self: *Ip6) ConfigureError!void

参数

self: *Ip6

错误

AlreadyStarted
DeviceError
InvalidParameter
NoMapping
OutOfResources
Unexpected UnexpectedError
Unsupported

std.os.uefi.protocol.ip6.Ip6.getModeData

函数

第 100 行

获取 EFI IPv6 协议驱动程序此实例的当前操作设置。

pub fn getModeData(self: *const Ip6) GetModeDataError!ModeData

参数

self: *const Ip6

错误

InvalidParameter
OutOfResources
Unexpected UnexpectedError

std.os.uefi.protocol.ip6.Ip6.GetModeDataError

错误集合

第 22 行

错误

InvalidParameter
OutOfResources
Unexpected UnexpectedError

std.os.uefi.protocol.ip6.Ip6.groups

函数

第 156 行

加入和离开多播组。

若要离开所有组,请改用 leaveAllGroups。

pub fn groups( self: *Ip6, join_flag: JoinFlag, group_address: *const Address, ) GroupsError!void

参数

self: *Ip6
join_flag: JoinFlag
group_address: *const Address

错误

AlreadyStarted
DeviceError
InvalidParameter
NotFound
NotStarted
OutOfResources
Unexpected UnexpectedError
Unsupported

std.os.uefi.protocol.ip6.Ip6.GroupsError

错误集合

第 34 行

错误

AlreadyStarted
DeviceError
InvalidParameter
NotFound
NotStarted
OutOfResources
Unexpected UnexpectedError
Unsupported

std.os.uefi.protocol.ip6.Ip6.guid

常量

第 295 行

std.os.uefi.protocol.ip6.Ip6.IcmpType

容器

第 374 行

字段

type: u8
code: u8

std.os.uefi.protocol.ip6.Ip6.JoinFlag

容器

第 309 行

字段

join
leave

std.os.uefi.protocol.ip6.Ip6.leaveAllGroups

函数

第 139 行

pub fn leaveAllGroups(self: *Ip6) GroupsError!void

参数

self: *Ip6

错误

AlreadyStarted
DeviceError
InvalidParameter
NotFound
NotStarted
OutOfResources
Unexpected UnexpectedError
Unsupported

std.os.uefi.protocol.ip6.Ip6.Mode

容器

第 314 行

字段

is_started: bool
max_packet_size: u32
config_data: Config
is_configured: bool
address_count: u32
address_list: [*]AddressInfo
group_count: u32
group_table: [*]Address
route_count: u32
route_table: [*]RouteTable
neighbor_count: u32
neighbor_cache: [*]NeighborCache
prefix_count: u32
prefix_table: [*]AddressInfo
icmp_type_count: u32
icmp_type_list: [*]IcmpType

std.os.uefi.protocol.ip6.Ip6.ModeData

容器

第 93 行

字段

ip6_mode: Mode
mnp_config: ManagedNetworkConfigData
snp_mode: SimpleNetwork

std.os.uefi.protocol.ip6.Ip6.NeighborCache

容器

第 368 行

字段

neighbor: Address
link_address: MacAddress
state: NeighborState

std.os.uefi.protocol.ip6.Ip6.neighbors

函数

第 205 行

添加或删除邻居缓存条目。

pub fn neighbors( self: *Ip6, delete_flag: DeleteFlag, target_ip6_address: *const Address, target_link_address: ?*const MacAddress, timeout: u32, override: bool, ) NeighborsError!void

参数

self: *Ip6
delete_flag: DeleteFlag
target_ip6_address: *const Address
target_link_address: ?*const MacAddress
timeout: u32
override: bool

错误

AccessDenied
InvalidParameter
NotFound
NotStarted
OutOfResources
Unexpected UnexpectedError

std.os.uefi.protocol.ip6.Ip6.NeighborsError

错误集合

第 50 行

错误

AccessDenied
InvalidParameter
NotFound
NotStarted
OutOfResources
Unexpected UnexpectedError

std.os.uefi.protocol.ip6.Ip6.NeighborState

容器

第 360 行

字段

incomplete
reachable
stale
delay
probe

std.os.uefi.protocol.ip6.Ip6.poll

函数

第 283 行

轮询传入的数据包,并处理传出的数据包。

若接收或处理了数据包,则返回 true。

pub fn poll(self: *Ip6) PollError!bool

参数

self: *Ip6

错误

DeviceError
InvalidParameter
NotStarted
Timeout
Unexpected UnexpectedError

std.os.uefi.protocol.ip6.Ip6.PollError

错误集合

第 86 行

错误

DeviceError
InvalidParameter
NotStarted
Timeout
Unexpected UnexpectedError

std.os.uefi.protocol.ip6.Ip6.receive

函数

第 253 行

将接收请求放入接收队列。

pub fn receive(self: *Ip6, token: *CompletionToken) ReceiveError!void

参数

self: *Ip6
token: *CompletionToken

错误

AccessDenied
DeviceError
InvalidParameter
NoMapping
NoMedia
NotReady
NotStarted
OutOfResources
Unexpected UnexpectedError

std.os.uefi.protocol.ip6.Ip6.ReceiveError

错误集合

第 70 行

错误

AccessDenied
DeviceError
InvalidParameter
NoMapping
NoMedia
NotReady
NotStarted
OutOfResources
Unexpected UnexpectedError

std.os.uefi.protocol.ip6.Ip6.routes

函数

第 180 行

添加和删除路由表条目。

pub fn routes( self: *Ip6, delete_route: DeleteFlag, destination: ?*const Address, prefix_length: u8, gateway_address: ?*const Address, ) RoutesError!void

参数

self: *Ip6
delete_route: DeleteFlag
destination: ?*const Address
prefix_length: u8
gateway_address: ?*const Address

错误

AccessDenied
InvalidParameter
NotFound
NotStarted
OutOfResources
Unexpected UnexpectedError

std.os.uefi.protocol.ip6.Ip6.RoutesError

错误集合

第 43 行

错误

AccessDenied
InvalidParameter
NotFound
NotStarted
OutOfResources
Unexpected UnexpectedError

std.os.uefi.protocol.ip6.Ip6.RouteTable

容器

第 354 行

字段

gateway: Address
destination: Address
prefix_length: u8

std.os.uefi.protocol.ip6.Ip6.transmit

函数

第 234 行

将待发送数据包放入发送队列。

pub fn transmit(self: *Ip6, token: *CompletionToken) TransmitError!void

参数

self: *Ip6
token: *CompletionToken

错误

AccessDenied
BadBufferSize
BufferTooSmall
DeviceError
InvalidParameter
NoMapping
NoMedia
NotFound
NotReady
NotStarted
OutOfResources
Unexpected UnexpectedError

std.os.uefi.protocol.ip6.Ip6.TransmitError

错误集合

第 57 行

错误

AccessDenied
BadBufferSize
BufferTooSmall
DeviceError
InvalidParameter
NoMapping
NoMedia
NotFound
NotReady
NotStarted
OutOfResources
Unexpected UnexpectedError

std.os.uefi.protocol.ip6.MacAddress

别名

第 6 行

别名目标 std.os.uefi.MacAddress

std.os.uefi.protocol.ip6.ManagedNetworkConfigData

别名

第 7 行

别名目标 std.os.uefi.protocol.managed_network.ManagedNetwork.Config

std.os.uefi.protocol.ip6.SimpleNetwork

别名

第 8 行

别名目标 std.os.uefi.protocol.SimpleNetwork

std.os.uefi.protocol.ip6.Status

别名

第 5 行

别名目标 std.os.uefi.Status

std.os.uefi.protocol.ip6.std

别名

第 1 行

别名目标 std

std.os.uefi.protocol.ip6.uefi

别名

第 2 行

别名目标 std.os.uefi

源码

std/os/uefi/protocol/ip6.zig

const std = @import("std");
const uefi = std.os.uefi;
const Guid = uefi.Guid;
const Event = uefi.Event;
const Status = uefi.Status;
const MacAddress = uefi.MacAddress;
const ManagedNetworkConfigData = uefi.protocol.ManagedNetwork.Config;
const SimpleNetwork = uefi.protocol.SimpleNetwork;
const cc = uefi.cc;

pub const Ip6 = extern struct {
    _get_mode_data: *const fn (*const Ip6, ?*Mode, ?*ManagedNetworkConfigData, ?*SimpleNetwork) callconv(cc) Status,
    _configure: *const fn (*Ip6, ?*const Config) callconv(cc) Status,
    _groups: *const fn (*Ip6, bool, ?*const Address) callconv(cc) Status,
    _routes: *const fn (*Ip6, bool, ?*const Address, u8, ?*const Address) callconv(cc) Status,
    _neighbors: *const fn (*Ip6, bool, *const Address, ?*const MacAddress, u32, bool) callconv(cc) Status,
    _transmit: *const fn (*Ip6, *CompletionToken) callconv(cc) Status,
    _receive: *const fn (*Ip6, *CompletionToken) callconv(cc) Status,
    _cancel: *const fn (*Ip6, ?*CompletionToken) callconv(cc) Status,
    _poll: *const fn (*Ip6) callconv(cc) Status,

    pub const GetModeDataError = uefi.UnexpectedError || error{
        InvalidParameter,
        OutOfResources,
    };
    pub const ConfigureError = uefi.UnexpectedError || error{
        InvalidParameter,
        OutOfResources,
        NoMapping,
        AlreadyStarted,
        DeviceError,
        Unsupported,
    };
    pub const GroupsError = uefi.UnexpectedError || error{
        InvalidParameter,
        NotStarted,
        OutOfResources,
        Unsupported,
        AlreadyStarted,
        NotFound,
        DeviceError,
    };
    pub const RoutesError = uefi.UnexpectedError || error{
        NotStarted,
        InvalidParameter,
        OutOfResources,
        NotFound,
        AccessDenied,
    };
    pub const NeighborsError = uefi.UnexpectedError || error{
        NotStarted,
        InvalidParameter,
        OutOfResources,
        NotFound,
        AccessDenied,
    };
    pub const TransmitError = uefi.UnexpectedError || error{
        NotStarted,
        NoMapping,
        InvalidParameter,
        AccessDenied,
        NotReady,
        NotFound,
        OutOfResources,
        BufferTooSmall,
        BadBufferSize,
        DeviceError,
        NoMedia,
    };
    pub const ReceiveError = uefi.UnexpectedError || error{
        NotStarted,
        NoMapping,
        InvalidParameter,
        OutOfResources,
        DeviceError,
        AccessDenied,
        NotReady,
        NoMedia,
    };
    pub const CancelError = uefi.UnexpectedError || error{
        InvalidParameter,
        NotStarted,
        NotFound,
        DeviceError,
    };
    pub const PollError = uefi.UnexpectedError || error{
        NotStarted,
        InvalidParameter,
        DeviceError,
        Timeout,
    };

    pub const ModeData = struct {
        ip6_mode: Mode,
        mnp_config: ManagedNetworkConfigData,
        snp_mode: SimpleNetwork,
    };

    /// 获取 EFI IPv6 协议驱动程序此实例的当前操作设置。
    pub fn getModeData(self: *const Ip6) GetModeDataError!ModeData {
        var data: ModeData = undefined;
        switch (self._get_mode_data(self, &data.ip6_mode, &data.mnp_config, &data.snp_mode)) {
            .success => return data,
            .invalid_parameter => return error.InvalidParameter,
            .out_of_resources => return error.OutOfResources,
            else => |status| return uefi.unexpectedStatus(status),
        }
    }

    /// 为此 EFI IPv6 协议驱动实例分配 IPv6 地址及其他配置参数。
    ///
    /// 要重置配置,请改用 `disable`。
    pub fn configure(self: *Ip6, ip6_config_data: *const Config) ConfigureError!void {
        switch (self._configure(self, ip6_config_data)) {
            .success => {},
            .invalid_parameter => return error.InvalidParameter,
            .out_of_resources => return error.OutOfResources,
            .no_mapping => return error.NoMapping,
            .already_started => return error.AlreadyStarted,
            .device_error => return error.DeviceError,
            .unsupported => return error.Unsupported,
            else => |status| return uefi.unexpectedStatus(status),
        }
    }

    pub fn disable(self: *Ip6) ConfigureError!void {
        switch (self._configure(self, null)) {
            .success => {},
            .invalid_parameter => return error.InvalidParameter,
            .out_of_resources => return error.OutOfResources,
            .no_mapping => return error.NoMapping,
            .already_started => return error.AlreadyStarted,
            .device_error => return error.DeviceError,
            .unsupported => return error.Unsupported,
            else => |status| return uefi.unexpectedStatus(status),
        }
    }

    pub fn leaveAllGroups(self: *Ip6) GroupsError!void {
        switch (self._groups(self, false, null)) {
            .success => {},
            .invalid_parameter => return error.InvalidParameter,
            .not_started => return error.NotStarted,
            .out_of_resources => return error.OutOfResources,
            .unsupported => return error.Unsupported,
            .already_started => return error.AlreadyStarted,
            .not_found => return error.NotFound,
            .device_error => return error.DeviceError,
            else => |status| return uefi.unexpectedStatus(status),
        }
    }

    /// 加入和离开多播组。
    ///
    /// 若要离开所有组,请改用 `leaveAllGroups`。
    pub fn groups(
        self: *Ip6,
        join_flag: JoinFlag,
        group_address: *const Address,
    ) GroupsError!void {
        switch (self._groups(
            self,
            // 设为 TRUE 以加入多播组会话,设为 FALSE 以离开
            join_flag == .join,
            group_address,
        )) {
            .success => {},
            .invalid_parameter => return error.InvalidParameter,
            .not_started => return error.NotStarted,
            .out_of_resources => return error.OutOfResources,
            .unsupported => return error.Unsupported,
            .already_started => return error.AlreadyStarted,
            .not_found => return error.NotFound,
            .device_error => return error.DeviceError,
            else => |status| return uefi.unexpectedStatus(status),
        }
    }

    /// 添加和删除路由表条目。
    pub fn routes(
        self: *Ip6,
        delete_route: DeleteFlag,
        destination: ?*const Address,
        prefix_length: u8,
        gateway_address: ?*const Address,
    ) RoutesError!void {
        switch (self._routes(
            self,
            delete_route == .delete,
            destination,
            prefix_length,
            gateway_address,
        )) {
            .success => {},
            .not_started => return error.NotStarted,
            .invalid_parameter => return error.InvalidParameter,
            .out_of_resources => return error.OutOfResources,
            .not_found => return error.NotFound,
            .access_denied => return error.AccessDenied,
            else => |status| return uefi.unexpectedStatus(status),
        }
    }

    /// 添加或删除邻居缓存条目。
    pub fn neighbors(
        self: *Ip6,
        delete_flag: DeleteFlag,
        target_ip6_address: *const Address,
        target_link_address: ?*const MacAddress,
        timeout: u32,
        override: bool,
    ) NeighborsError!void {
        switch (self._neighbors(
            self,
            // 设为 TRUE,从路由表删除此路由。
            // 设为 FALSE,将此路由加入路由表。
            delete_flag == .delete,
            target_ip6_address,
            target_link_address,
            timeout,
            override,
        )) {
            .success => {},
            .not_started => return error.NotStarted,
            .invalid_parameter => return error.InvalidParameter,
            .out_of_resources => return error.OutOfResources,
            .not_found => return error.NotFound,
            .access_denied => return error.AccessDenied,
            else => |status| return uefi.unexpectedStatus(status),
        }
    }

    /// 将待发送数据包放入发送队列。
    pub fn transmit(self: *Ip6, token: *CompletionToken) TransmitError!void {
        switch (self._transmit(self, token)) {
            .success => {},
            .not_started => return error.NotStarted,
            .no_mapping => return error.NoMapping,
            .invalid_parameter => return error.InvalidParameter,
            .access_denied => return error.AccessDenied,
            .not_ready => return error.NotReady,
            .not_found => return error.NotFound,
            .out_of_resources => return error.OutOfResources,
            .buffer_too_small => return error.BufferTooSmall,
            .bad_buffer_size => return error.BadBufferSize,
            .device_error => return error.DeviceError,
            .no_media => return error.NoMedia,
            else => |status| return uefi.unexpectedStatus(status),
        }
    }

    /// 将接收请求放入接收队列。
    pub fn receive(self: *Ip6, token: *CompletionToken) ReceiveError!void {
        switch (self._receive(self, token)) {
            .success => {},
            .not_started => return error.NotStarted,
            .no_mapping => return error.NoMapping,
            .invalid_parameter => return error.InvalidParameter,
            .out_of_resources => return error.OutOfResources,
            .device_error => return error.DeviceError,
            .access_denied => return error.AccessDenied,
            .not_ready => return error.NotReady,
            .no_media => return error.NoMedia,
            else => |status| return uefi.unexpectedStatus(status),
        }
    }

    /// 中止异步发送或接收请求。
    pub fn cancel(self: *Ip6, token: ?*CompletionToken) CancelError!void {
        switch (self._cancel(self, token)) {
            .success => {},
            .invalid_parameter => return error.InvalidParameter,
            .not_started => return error.NotStarted,
            .not_found => return error.NotFound,
            .device_error => return error.DeviceError,
            else => |status| return uefi.unexpectedStatus(status),
        }
    }

    /// 轮询传入的数据包,并处理传出的数据包。
    ///
    /// 若接收或处理了数据包,则返回 true。
    pub fn poll(self: *Ip6) PollError!bool {
        switch (self._poll(self)) {
            .success => return true,
            .not_ready => return false,
            .not_started => return error.NotStarted,
            .invalid_parameter => return error.InvalidParameter,
            .device_error => return error.DeviceError,
            .timeout => return error.Timeout,
            else => |status| return uefi.unexpectedStatus(status),
        }
    }

    pub const guid align(8) = Guid{
        .time_low = 0x2c8759d5,
        .time_mid = 0x5c2d,
        .time_high_and_version = 0x66ef,
        .clock_seq_high_and_reserved = 0x92,
        .clock_seq_low = 0x5f,
        .node = [_]u8{ 0xb6, 0x6c, 0x10, 0x19, 0x57, 0xe2 },
    };

    pub const DeleteFlag = enum {
        delete,
        add,
    };

    pub const JoinFlag = enum {
        join,
        leave,
    };

    pub const Mode = extern struct {
        is_started: bool,
        max_packet_size: u32,
        config_data: Config,
        is_configured: bool,
        address_count: u32,
        address_list: [*]AddressInfo,
        group_count: u32,
        group_table: [*]Address,
        route_count: u32,
        route_table: [*]RouteTable,
        neighbor_count: u32,
        neighbor_cache: [*]NeighborCache,
        prefix_count: u32,
        prefix_table: [*]AddressInfo,
        icmp_type_count: u32,
        icmp_type_list: [*]IcmpType,
    };

    pub const Config = extern struct {
        default_protocol: u8,
        accept_any_protocol: bool,
        accept_icmp_errors: bool,
        accept_promiscuous: bool,
        destination_address: Address,
        station_address: Address,
        traffic_class: u8,
        hop_limit: u8,
        flow_label: u32,
        receive_timeout: u32,
        transmit_timeout: u32,
    };

    pub const Address = [16]u8;

    pub const AddressInfo = extern struct {
        address: Address,
        prefix_length: u8,
    };

    pub const RouteTable = extern struct {
        gateway: Address,
        destination: Address,
        prefix_length: u8,
    };

    pub const NeighborState = enum(u32) {
        incomplete,
        reachable,
        stale,
        delay,
        probe,
    };

    pub const NeighborCache = extern struct {
        neighbor: Address,
        link_address: MacAddress,
        state: NeighborState,
    };

    pub const IcmpType = extern struct {
        type: u8,
        code: u8,
    };

    pub const CompletionToken = extern struct {
        event: Event,
        status: Status,
        packet: *anyopaque, // 联合体 TODO
    };
};