net_info_t data type

The net_info_t variable is structure or composite variable that is used to hold the network four tuples (local and remote IP addresses and port numbers) information from the specific socket descriptor through the sockfd_netinfo Vue function.

The members of net_info_t structure are accessed like any other user-defined structure in Vue script. The net_info_t type is an abstract data type and this variable cannot be used directly with standard C unary or binary operators. This variable is a structure containing 4 tuple information. This variable elements can be accessed by using the “.” operator like C structure elements.

Elements of the net_info_t data type are as follow:
net_info_t 
{ 
    int local_port; 
    int remote_port; 
    ip_addr_t local_addr; 
    ip_addr_t remote_addr;
};

Vue supports the following characteristics and operations for the net_info_t type variables:

Declaration of net_info_t type variable

net_info_t n1,n2                       
// n1 is variable of type net_info_t
sockfd_netinfo(fd, n1);           
// fd is socket descriptor and n1 contains network 
// four tuple information from sockfd_netinfo Vue function.                                   
n2.local_addr = __ip4hdr->src_addr; 
n2.remote_addr = __ip4hdr->dst_addr; 
n1.local_port = __tcphdr->src_port; 
n1.remote_port = __tcphdr->dst_port;
The signed, unsigned, register, static, thread, local, global, and kernel qualifiers are not supported for the net_info_t type variables.

Limitations for net_info_t type variable

  • Structure and union member variable cannot be supported.
  • Pointer to the net_info_t variable cannot be declared.
  • This variable is not supported in associative array.
  • The array of the net_info_t variable cannot be declared.
  • Typecasting of the net_info_t variable to any other type or typecasting any other type to net_info_t type is not allowed.
  • Arithmetic operator (+, -, *, /, ++, --, and so on) cannot be used with net_info_t type variable.