Extensible Connection-oriented Messaging (XCM)
Loading...
Searching...
No Matches
xcm_addr.h
Go to the documentation of this file.
1/*
2 * SPDX-License-Identifier: BSD-3-Clause
3 * Copyright(c) 2020 Ericsson AB
4 */
5
6#ifndef XCM_ADDR_H
7#define XCM_ADDR_H
8#ifdef __cplusplus
9extern "C" {
10#endif
11
12#include <errno.h>
13#include <inttypes.h>
14#include <netinet/in.h>
15#include <sys/socket.h>
16#include <sys/types.h>
17
25#define XCM_UTLS_PROTO "utls"
28#define XCM_TLS_PROTO "tls"
30#define XCM_TCP_PROTO "tcp"
32#define XCM_SCTP_PROTO "sctp"
35#define XCM_UX_PROTO "ux"
38#define XCM_UXF_PROTO "uxf"
39
42#define XCM_BTLS_PROTO "btls"
43
44enum xcm_addr_type {
45 xcm_addr_type_name,
46 xcm_addr_type_ip
47};
48
51{
53 sa_family_t family;
54
56 union {
59 in_addr_t ip4;
62 uint8_t ip6[16];
64};
65
68{
70 enum xcm_addr_type type;
71
73 union {
74 struct xcm_addr_ip ip;
75 /* Max DNS name length is 253 characters */
76 char name[254];
77 };
78};
79
93int xcm_addr_parse_proto(const char *addr_s, char *proto, size_t capacity);
94
108int xcm_addr_parse_utls(const char *utls_addr_s, struct xcm_addr_host *host,
109 uint16_t *port);
110
124int xcm_addr_parse_tls(const char *tls_addr_s, struct xcm_addr_host *host,
125 uint16_t *port);
126
141int xcm_addr_parse_tcp(const char *tcp_addr_s, struct xcm_addr_host *host,
142 uint16_t *port);
143
158int xcm_addr_parse_sctp(const char *sctp_addr_s, struct xcm_addr_host *host,
159 uint16_t *port);
160
174int xcm_addr_parse_ux(const char *ux_addr_s, char *ux_path, size_t capacity);
175
189int xcm_addr_parse_uxf(const char *uxf_addr_s, char *uxf_path,
190 size_t capacity);
191
205int xcm_addr_parse_btls(const char *btls_addr_s, struct xcm_addr_host *host,
206 uint16_t *port);
207
223int xcm_addr_make_utls(const struct xcm_addr_host *host, unsigned short port,
224 char *utls_addr_s, size_t capacity);
225
241int xcm_addr_make_tls(const struct xcm_addr_host *host, unsigned short port,
242 char *tls_addr_s, size_t capacity);
243
259int xcm_addr_make_tcp(const struct xcm_addr_host *host, unsigned short port,
260 char *tcp_addr_s, size_t capacity);
261
277int xcm_addr_make_sctp(const struct xcm_addr_host *host, unsigned short port,
278 char *sctp_addr_s, size_t capacity);
279
294int xcm_addr_make_ux(const char *ux_name, char *ux_addr_s, size_t capacity);
295
310int xcm_addr_make_uxf(const char *uxf_name, char *uxf_addr_s, size_t capacity);
311
327int xcm_addr_make_btls(const struct xcm_addr_host *host, unsigned short port,
328 char *btls_addr_s, size_t capacity);
329
330#include <xcm_addr_compat.h>
331
332#ifdef __cplusplus
333}
334#endif
335#endif
Definition xcm_addr.h:68
enum xcm_addr_type type
Definition xcm_addr.h:70
Definition xcm_addr.h:51
union xcm_addr_ip::@0 addr
sa_family_t family
Definition xcm_addr.h:53
uint8_t ip6[16]
Definition xcm_addr.h:62
in_addr_t ip4
Definition xcm_addr.h:59
int xcm_addr_parse_uxf(const char *uxf_addr_s, char *uxf_path, size_t capacity)
int xcm_addr_make_btls(const struct xcm_addr_host *host, unsigned short port, char *btls_addr_s, size_t capacity)
int xcm_addr_make_utls(const struct xcm_addr_host *host, unsigned short port, char *utls_addr_s, size_t capacity)
int xcm_addr_parse_sctp(const char *sctp_addr_s, struct xcm_addr_host *host, uint16_t *port)
int xcm_addr_make_ux(const char *ux_name, char *ux_addr_s, size_t capacity)
int xcm_addr_parse_utls(const char *utls_addr_s, struct xcm_addr_host *host, uint16_t *port)
int xcm_addr_parse_btls(const char *btls_addr_s, struct xcm_addr_host *host, uint16_t *port)
int xcm_addr_make_tcp(const struct xcm_addr_host *host, unsigned short port, char *tcp_addr_s, size_t capacity)
int xcm_addr_make_tls(const struct xcm_addr_host *host, unsigned short port, char *tls_addr_s, size_t capacity)
int xcm_addr_parse_ux(const char *ux_addr_s, char *ux_path, size_t capacity)
int xcm_addr_make_uxf(const char *uxf_name, char *uxf_addr_s, size_t capacity)
int xcm_addr_parse_proto(const char *addr_s, char *proto, size_t capacity)
int xcm_addr_parse_tls(const char *tls_addr_s, struct xcm_addr_host *host, uint16_t *port)
int xcm_addr_parse_tcp(const char *tcp_addr_s, struct xcm_addr_host *host, uint16_t *port)
int xcm_addr_make_sctp(const struct xcm_addr_host *host, unsigned short port, char *sctp_addr_s, size_t capacity)