Common functions for IPv4 and IPv6

Overview

Declaration of common functions for IPv4/IPv6 CSAP. More…

// typedefs

typedef struct tapi_ip_frag_spec tapi_ip_frag_spec;

// structs

struct tapi_ip_frag_spec;

// global functions

void tapi_ip_frag_specs_init(tapi_ip_frag_spec* frags, unsigned int num);
te_errno tapi_ip_eth_csap_create(const char* ta_name, int sid, const char* eth_dev, unsigned int receive_mode, const uint8_t* loc_mac_addr, const uint8_t* rem_mac_addr, int af, const void* loc_ip_addr, const void* rem_ip_addr, int ip_proto, csap_handle_t* ip_csap);
te_errno tapi_tcp_udp_ip_eth_csap_create(const char* ta_name, int sid, const char* eth_dev, unsigned int receive_mode, const uint8_t* loc_mac_addr, const uint8_t* rem_mac_addr, int af, int ip_proto, const void* loc_ip_addr, const void* rem_ip_addr, int loc_port, int rem_port, csap_handle_t* csap);
te_errno tapi_ip_pdu_tmpl_fragments(asn_value** tmpl, asn_value** pdu, bool ipv4, tapi_ip_frag_spec* fragments, unsigned int num_frags);

Detailed Documentation

Declaration of common functions for IPv4/IPv6 CSAP.

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

Typedefs

typedef struct tapi_ip_frag_spec tapi_ip_frag_spec

Specification of IPv4 or IPv6 fragment

Global Functions

void tapi_ip_frag_specs_init(tapi_ip_frag_spec* frags, unsigned int num)

Initialize array of IP fragment specifications.

Parameters:

frags

Pointer to array.

num

Number of fragment specifications.

te_errno tapi_ip_eth_csap_create(const char* ta_name, int sid, const char* eth_dev, unsigned int receive_mode, const uint8_t* loc_mac_addr, const uint8_t* rem_mac_addr, int af, const void* loc_ip_addr, const void* rem_ip_addr, int ip_proto, csap_handle_t* ip_csap)

Create CSAP for IPv4 or IPv6 traffic.

Parameters:

ta_name

Test Agent name.

sid

RCF SID.

eth_dev

Name of Ethernet interface.

receive_mode

Receive mode for Ethernet Layer on the interface.

loc_mac_addr

Local MAC address (or NULL).

rem_mac_addr

Remote MAC address (or NULL).

af

Address family (AF_INET or AF_INET6).

loc_ip_addr

Pointer to local IPv4 or IPv6 address (or NULL).

rem_ip_addr

Pointer to remote IPv4 or IPv6 address (or NULL).

proto

IP protocol or negative number.

ip_csap

Where to save pointer to created CSAP.

Returns:

Status code.

te_errno tapi_tcp_udp_ip_eth_csap_create(const char* ta_name, int sid, const char* eth_dev, unsigned int receive_mode, const uint8_t* loc_mac_addr, const uint8_t* rem_mac_addr, int af, int ip_proto, const void* loc_ip_addr, const void* rem_ip_addr, int loc_port, int rem_port, csap_handle_t* csap)

Create CSAP for TCP or UDP IPv4 or IPv6 traffic.

Parameters:

ta_name

Test Agent name.

sid

RCF SID.

eth_dev

Name of Ethernet interface.

receive_mode

Receive mode for Ethernet Layer on the interface.

loc_mac_addr

Local MAC address (or NULL).

rem_mac_addr

Remote MAC address (or NULL).

af

Address family (AF_INET or AF_INET6).

ip_proto

IPPROTO_TCP or IPPROTO_UDP.

loc_ip_addr

Pointer to local IPv4 or IPv6 address (or NULL).

rem_ip_addr

Pointer to remote IPv4 or IPv6 address (or NULL).

loc_port

Local port number in network byte order or -1.

rem_port

Remote port number in network byte order or -1.

csap

Where to save pointer to created CSAP.

Returns:

Status code.

te_errno tapi_ip_pdu_tmpl_fragments(asn_value** tmpl, asn_value** pdu, bool ipv4, tapi_ip_frag_spec* fragments, unsigned int num_frags)

Add fragments specification to IPv4 or IPv6 PDU.

Parameters:

tmpl

NULL or location of ASN.1 value with traffic template where IP PDU should be added

pdu

If tmpl is NULL, this parameter must point to IP PDU where to add fragments specification; on return, if this parameter is not NULL, pointer to IP PDU will be saved in it

ipv4

If true, IPv4 PDU is processed, otherwise IPv6 PDU

fragments

Array with IP fragments specifications

num_frags

Number of IP fragments

Returns:

Status code.