Motr  M0
ip.h
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2021 Seagate Technology LLC and/or its Affiliates
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * For any questions about this software or licensing,
18  * please email opensource@seagate.com or cortx-questions@seagate.com.
19  *
20  */
21 
22 
23 #pragma once
24 
25 #ifndef __MOTR_NET_IP_H__
26 #define __MOTR_NET_IP_H__
27 
28 #define M0_NET_IP_STRLEN_MAX 150
29 #define M0_NET_IP_PORTLEN_MAX 6
30 #define M0_NET_IP_PORT_MAX 65536
31 
38 };
39 
46 };
47 
55 };
56 
59  uint16_t nia_family; /* AF_INET, AF_INET6, AF_UNIX */
60  uint16_t nia_type; /* tcp, udp, verbs, o2ib */
61 };
62 
65  uint16_t nla_type; /* tcp, o2ib */
66  uint16_t nla_portal;
67  uint16_t nla_tmid;
68  bool nla_autotm;
69 };
70 
74  union {
75  uint64_t ln[2];
76  uint32_t sn[4];
77  } nip_ip_n;
78  uint16_t nip_port;
79  union {
82  } nip_fmt_pvt;
83 };
84 
89 };
90 
102 M0_INTERNAL int m0_net_ip_parse(const char *name, struct m0_net_ip_addr *addr);
103 
108 M0_INTERNAL int m0_net_ip_print(const struct m0_net_ip_addr *nia);
109 
117 M0_INTERNAL int m0_net_hostname_to_ip(const char *hostname, char *ip,
118  enum m0_net_ip_format *fmt);
119 
126 M0_INTERNAL bool m0_net_ip_addr_eq(const struct m0_net_ip_addr *addr1,
127  const struct m0_net_ip_addr *addr2, bool is_ncmp);
128 
129 M0_INTERNAL int m0_net_ip_init(void);
130 
131 M0_INTERNAL void m0_net_ip_fini(void);
132 
133 #endif /* __MOTR_NET_IP_H__ */
134 
135 /*
136  * Local variables:
137  * c-indentation-style: "K&R"
138  * c-basic-offset: 8
139  * tab-width: 8
140  * fill-column: 80
141  * scroll-step: 1
142  * End:
143  */
union m0_net_ip_params::@377 nip_fmt_pvt
struct m0_net_ip_lnet_addr la
Definition: ip.h:81
uint16_t nla_portal
Definition: ip.h:66
enum m0_net_ip_format nip_format
Definition: ip.h:73
m0_net_ip_format
Definition: ip.h:33
m0_net_ip_family
Definition: ip.h:41
uint16_t nia_family
Definition: ip.h:59
M0_INTERNAL int m0_net_ip_parse(const char *name, struct m0_net_ip_addr *addr)
Definition: ip.c:343
M0_INTERNAL void m0_net_ip_fini(void)
Definition: ip.c:489
m0_net_ip_proto
Definition: ip.h:49
M0_INTERNAL int m0_net_ip_print(const struct m0_net_ip_addr *nia)
Definition: ip.c:349
struct m0_net_ip_params nia_n
Definition: ip.h:87
char nia_p[M0_NET_IP_STRLEN_MAX]
Definition: ip.h:88
uint16_t nip_port
Definition: ip.h:78
bool nla_autotm
Definition: ip.h:68
const char * name
Definition: trace.c:110
struct m0_net_ip_inet_addr ia
Definition: ip.h:80
union m0_net_ip_params::@376 nip_ip_n
uint16_t nla_type
Definition: ip.h:65
char * fmt(const char *format,...) __attribute__((format(printf
Definition: xcode.h:73
M0_INTERNAL int m0_net_ip_init(void)
Definition: ip.c:482
uint16_t nla_tmid
Definition: ip.h:67
M0_INTERNAL int m0_net_hostname_to_ip(const char *hostname, char *ip, enum m0_net_ip_format *fmt)
Definition: ip.c:415
uint16_t nia_type
Definition: ip.h:60
uint64_t ln[2]
Definition: ip.h:75
uint32_t sn[4]
Definition: ip.h:76
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)
Definition: ip.c:464
#define M0_NET_IP_STRLEN_MAX
Definition: ip.h:28