ICMP6

Overview

Copyright (C) 2004-2022 OKTET Labs Ltd. More…

// typedefs

typedef struct icmp6_msg_body icmp6_msg_body;
typedef struct icmp6_msg_option icmp6_msg_option;

// enums

enum icmp6_msg_type;
enum icmp6_opt_type;

// structs

struct echo_body;
struct icmp6_msg_body;
struct icmp6_msg_option;
struct nadv_body;
struct nsol_body;
struct prefix_info;
struct radv_body;

// global functions

te_errno tapi_icmp_ip6_eth_csap_create(const char* ta_name, int sid, const char* eth_dev, unsigned int receive_mode, const uint8_t* loc_hwaddr, const uint8_t* rem_hwaddr, const uint8_t* loc_addr, const uint8_t* rem_addr, csap_handle_t* icmp_csap);
te_errno tapi_icmp6_add_pdu(asn_value** tmpl_or_ptrn, asn_value** pdu, bool is_pattern, int type, int code, icmp6_msg_body* body, icmp6_msg_option* optlist);
te_errno tapi_icmp6_add_csap_layer(asn_value** csap_spec);
te_errno tapi_ipproto_ip6_icmp_ip6_eth_csap_create(const char* ta_name, int sid, const char* eth_dev, unsigned int receive_mode, const uint8_t* loc_eth, const uint8_t* rem_eth, const uint8_t* loc_addr, const uint8_t* rem_addr, const struct sockaddr_in6* msg_loc_saddr, const struct sockaddr_in6* msg_rem_saddr, int ip_proto, csap_handle_t* ip_proto_csap);
te_errno tapi_udp_ip6_icmp_ip6_eth_csap_create(const char* ta_name, int sid, const char* eth_dev, unsigned int receive_mode, const uint8_t* loc_eth, const uint8_t* rem_eth, const uint8_t* loc_addr, const uint8_t* rem_addr, const struct sockaddr_in6* msg_loc_saddr, const struct sockaddr_in6* msg_rem_saddr, csap_handle_t* udp_csap);
te_errno tapi_tcp_ip6_icmp_ip6_eth_csap_create(const char* ta_name, int sid, const char* eth_dev, unsigned int receive_mode, const uint8_t* loc_eth, const uint8_t* rem_eth, const uint8_t* loc_addr, const uint8_t* rem_addr, const struct sockaddr_in6* msg_loc_saddr, const struct sockaddr_in6* msg_rem_saddr, csap_handle_t* tcp_csap);
te_errno tapi_icmp6_wrap_tmpl(asn_value* tmpl, const void* src_eth, const void* dst_eth, uint8_t* ip6_src, uint8_t* ip6_dst, int hop_limit, uint8_t icmp_type, uint8_t icmp_code, icmp6_msg_body* msg_body);

Detailed Documentation

Copyright (C) 2004-2022 OKTET Labs Ltd. All rights reserved.

Typedefs

typedef struct icmp6_msg_body icmp6_msg_body

Structure to keep ICMPv6 message body information

typedef struct icmp6_msg_option icmp6_msg_option

Structure to keep list of ICMPv6 options

Global Functions

te_errno tapi_icmp_ip6_eth_csap_create(const char* ta_name, int sid, const char* eth_dev, unsigned int receive_mode, const uint8_t* loc_hwaddr, const uint8_t* rem_hwaddr, const uint8_t* loc_addr, const uint8_t* rem_addr, csap_handle_t* icmp_csap)

Create ‘icmp6.ip6.eth’ CSAP on the specified Agent

Parameters:

ta_name

Test Agent name

sid

RCF SID

eth_dev

Name of Ethernet interface

receive_mode

Bitmask with receive mode, see ‘enum tad_eth_recv_mode’ in tad_common.h. Use TAD_ETH_RECV_DEF by default.

loc_hwaddr

Local MAC address (or NULL)

rem_hwaddr

Remote MAC address (or NULL)

loc_addr

Local IP address in network byte order (or NULL)

rem_addr

Remote IP address in network byte order (or NULL)

icmp_csap

Location for the CSAP handle (OUT)

Returns:

Zero on success or error code

te_errno tapi_icmp6_add_pdu(asn_value** tmpl_or_ptrn, asn_value** pdu, bool is_pattern, int type, int code, icmp6_msg_body* body, icmp6_msg_option* optlist)

Add ICMPv6 PDU as the last PDU to the last unit of the traffic template or pattern.

Parameters:

tmpl_or_ptrn

Location of ASN.1 value with traffic template or pattern

pdu

Location for ASN.1 value pointer with added PDU

is_pattern

Is the first argument template or pattern

type

Type of ICMPv6 message or negative to keep unspecified

code

ICMPv6 message code or negative to keep unspecified

body

ICMPv6 message body or NULL to keep unspecified

optlist

List of ICPMv6 options or NULL to keep unspecified

Returns:

Status code.

te_errno tapi_icmp6_add_csap_layer(asn_value** csap_spec)

Add ICMPv6 layer in CSAP specification.

Parameters:

csap_spec

Location of CSAP specification pointer.

Status

code.

te_errno tapi_ipproto_ip6_icmp_ip6_eth_csap_create(const char* ta_name, int sid, const char* eth_dev, unsigned int receive_mode, const uint8_t* loc_eth, const uint8_t* rem_eth, const uint8_t* loc_addr, const uint8_t* rem_addr, const struct sockaddr_in6* msg_loc_saddr, const struct sockaddr_in6* msg_rem_saddr, int ip_proto, csap_handle_t* ip_proto_csap)

Create ‘{udp,tcp}.ip6.icmp.ip6.eth’ CSAP on the specified Agent

Parameters:

ta_name

Test Agent name

sid

RCF SID

eth_dev

Name of Ethernet interface

receive_mode

Bitmask with receive mode, see ‘enum tad_eth_recv_mode’ in tad_common.h. Use TAD_ETH_RECV_DEF by default.

loc_eth

Local MAC address (or NULL)

rem_eth

Remote MAC address (or NULL)

loc_addr

Local IPv6 address (or NULL)

rem_addr

Remote IPv6 address (or NULL)

msg_loc_saddr

Local IPv6 address/port of ICMP Error message (or NULL)

msg_rem_saddr

Remote IPv6 address/port of ICMP Error message (or NULL)

ip_proto

IPPROTO_UDP or IPPROTO_TCP

ip_proto_csap

Location for the CSAP handle (OUT)

Returns:

Status code

te_errno tapi_udp_ip6_icmp_ip6_eth_csap_create(const char* ta_name, int sid, const char* eth_dev, unsigned int receive_mode, const uint8_t* loc_eth, const uint8_t* rem_eth, const uint8_t* loc_addr, const uint8_t* rem_addr, const struct sockaddr_in6* msg_loc_saddr, const struct sockaddr_in6* msg_rem_saddr, csap_handle_t* udp_csap)

Create ‘udp.ip6.icmp.ip6.eth’ CSAP on the specified Agent

Parameters:

ta_name

Test Agent name

sid

RCF SID

eth_dev

Name of Ethernet interface

receive_mode

Bitmask with receive mode, see ‘enum tad_eth_recv_mode’ in tad_common.h. Use TAD_ETH_RECV_DEF by default.

loc_eth

Local MAC address (or NULL)

rem_eth

Remote MAC address (or NULL)

loc_addr

Local IPv6 address (or NULL)

rem_addr

Remote IPv6 address (or NULL)

msg_loc_saddr

Local IPv6 address/port of ICMP Error message (or NULL)

msg_rem_saddr

Remote IPv6 address/port of ICMP Error message (or NULL)

udp_csap

Location for the CSAP handle (OUT)

Returns:

Status code

te_errno tapi_tcp_ip6_icmp_ip6_eth_csap_create(const char* ta_name, int sid, const char* eth_dev, unsigned int receive_mode, const uint8_t* loc_eth, const uint8_t* rem_eth, const uint8_t* loc_addr, const uint8_t* rem_addr, const struct sockaddr_in6* msg_loc_saddr, const struct sockaddr_in6* msg_rem_saddr, csap_handle_t* tcp_csap)

Create ‘tcp.ip6.icmp.ip6.eth’ CSAP on the specified Agent

Parameters:

ta_name

Test Agent name

sid

RCF SID

eth_dev

Name of Ethernet interface

receive_mode

Bitmask with receive mode, see ‘enum tad_eth_recv_mode’ in tad_common.h. Use TAD_ETH_RECV_DEF by default.

loc_eth

Local MAC address (or NULL)

rem_eth

Remote MAC address (or NULL)

loc_addr

Local IPv6 address (or NULL)

rem_addr

Remote IPv6 address (or NULL)

msg_loc_saddr

Local IPv6 address/port of ICMP Error message (or NULL)

msg_rem_saddr

Remote IPv6 address/port of ICMP Error message (or NULL)

tcp_csap

Location for the CSAP handle (OUT)

Returns:

Status code

te_errno tapi_icmp6_wrap_tmpl(asn_value* tmpl, const void* src_eth, const void* dst_eth, uint8_t* ip6_src, uint8_t* ip6_dst, int hop_limit, uint8_t icmp_type, uint8_t icmp_code, icmp6_msg_body* msg_body)

Encapsulate packet template in ICMPv6 header, adding required IPv6 and Ethernet layers.

Parameters:

tmpl

Packet template to encapsulate.

src_eth

Source MAC address for the Ethernet header.

dst_eth

Destination MAC address for the Ethernet header.

ip6_src

Source IPv6 address (in network byte order).

ip6_dst

Destination IPv6 address (in network byte order).

hop_limit

Hop Limit value for the IPv6 header.

icmp_type

ICMPv6 type.

icmp_code

ICMPv6 code.

msg_body

Optional ICMPv6 message body (may be NULL).

Returns:

Status code.