Motr  M0
ip.h File Reference

Go to the source code of this file.

Data Structures

struct  m0_net_ip_inet_addr
 
struct  m0_net_ip_lnet_addr
 
struct  m0_net_ip_params
 
struct  m0_net_ip_addr
 

Macros

#define __MOTR_NET_IP_H__
 
#define M0_NET_IP_STRLEN_MAX   150
 
#define M0_NET_IP_PORTLEN_MAX   6
 
#define M0_NET_IP_PORT_MAX   65536
 

Enumerations

enum  m0_net_ip_format { M0_NET_IP_INET_IP_FORMAT, M0_NET_IP_INET_HOSTNAME_FORMAT, M0_NET_IP_LNET_FORMAT, M0_NET_IP_FORMAT_MAX }
 
enum  m0_net_ip_family { M0_NET_IP_AF_INET, M0_NET_IP_AF_INET6, M0_NET_IP_AF_UNIX, M0_NET_IP_AF_NR }
 
enum  m0_net_ip_proto {
  M0_NET_IP_PROTO_TCP, M0_NET_IP_PROTO_UDP, M0_NET_IP_PROTO_VERBS, M0_NET_IP_PROTO_O2IB,
  M0_NET_IP_PROTO_NR
}
 

Functions

M0_INTERNAL int m0_net_ip_parse (const char *name, struct m0_net_ip_addr *addr)
 
M0_INTERNAL int m0_net_ip_print (const struct m0_net_ip_addr *nia)
 
M0_INTERNAL int m0_net_hostname_to_ip (const char *hostname, char *ip, enum m0_net_ip_format *fmt)
 
M0_INTERNAL bool m0_net_ip_addr_eq (const struct m0_net_ip_addr *addr1, const struct m0_net_ip_addr *addr2, bool is_ncmp)
 
M0_INTERNAL int m0_net_ip_init (void)
 
M0_INTERNAL void m0_net_ip_fini (void)
 

Macro Definition Documentation

◆ __MOTR_NET_IP_H__

#define __MOTR_NET_IP_H__

Definition at line 26 of file ip.h.

◆ M0_NET_IP_PORT_MAX

#define M0_NET_IP_PORT_MAX   65536

Definition at line 30 of file ip.h.

◆ M0_NET_IP_PORTLEN_MAX

#define M0_NET_IP_PORTLEN_MAX   6

Definition at line 29 of file ip.h.

◆ M0_NET_IP_STRLEN_MAX

#define M0_NET_IP_STRLEN_MAX   150

Definition at line 28 of file ip.h.

Enumeration Type Documentation

◆ m0_net_ip_family

Represents family of network address

Enumerator
M0_NET_IP_AF_INET 
M0_NET_IP_AF_INET6 
M0_NET_IP_AF_UNIX 
M0_NET_IP_AF_NR 

Definition at line 41 of file ip.h.

◆ m0_net_ip_format

Represents format of network address

Enumerator
M0_NET_IP_INET_IP_FORMAT 
M0_NET_IP_INET_HOSTNAME_FORMAT 
M0_NET_IP_LNET_FORMAT 
M0_NET_IP_FORMAT_MAX 

Definition at line 33 of file ip.h.

◆ m0_net_ip_proto

Represent protocol of network address

Enumerator
M0_NET_IP_PROTO_TCP 
M0_NET_IP_PROTO_UDP 
M0_NET_IP_PROTO_VERBS 
M0_NET_IP_PROTO_O2IB 
M0_NET_IP_PROTO_NR 

Definition at line 49 of file ip.h.

Function Documentation

◆ m0_net_hostname_to_ip()

M0_INTERNAL int m0_net_hostname_to_ip ( const char *  hostname,
char *  ip,
enum m0_net_ip_format fmt 
)

This function convert the hostname/FQDN format to ip format. Here hostname can be FQDN or local machine hostname. Return value: = 0 in case of succesful fqdn to ip resolution. > 0 when gethostbyname fails (dns resolution failed). < 0 error.

Definition at line 415 of file ip.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_net_ip_addr_eq()

M0_INTERNAL bool m0_net_ip_addr_eq ( const struct m0_net_ip_addr addr1,
const struct m0_net_ip_addr addr2,
bool  is_ncmp 
)

This function is used to compare the fields in struct m0_net_ip_addr. If is_ncmp is true then numeric address fields are compared else string addr is compared. Returns true if addr1 and addr2 are equal else false.

Definition at line 464 of file ip.c.

Here is the call graph for this function:

◆ m0_net_ip_fini()

M0_INTERNAL void m0_net_ip_fini ( void  )

Definition at line 489 of file ip.c.

Here is the call graph for this function:

◆ m0_net_ip_init()

M0_INTERNAL int m0_net_ip_init ( void  )

Definition at line 482 of file ip.c.

Here is the call graph for this function:

◆ m0_net_ip_parse()

M0_INTERNAL int m0_net_ip_parse ( const char *  name,
struct m0_net_ip_addr addr 
)

This function decodes addresses based on address format type such as lnet or inet address format. Example: lnet format: <ip><type>:<pid=12345>:<portal>:<tmid> for example:"192.168.96.128@tcp:12345:34:1" inet format: <family>:<type>:<ipaddr/hostname_FQDN><port> for example: "inet:tcp:127.0.0.1@3000" Return value: 0 in case of success. < 0 in case of error.

Definition at line 343 of file ip.c.

Here is the call graph for this function:

◆ m0_net_ip_print()

M0_INTERNAL int m0_net_ip_print ( const struct m0_net_ip_addr nia)

This function generates printable address format from struct m0_net_ip_addr::nia_n into struct m0_net_ip_addr::nia_p.

Definition at line 349 of file ip.c.

Here is the call graph for this function: