libosmo-sigtran: src/ss7_asp_peer.h Source File

libosmo-sigtran 2.2.1.99-1c6a Osmocom SIGTRAN library

ss7_asp_peer.h
Go to the documentation of this file.
1#pragma once
2
3#include <stdint.h>
4#include <stdbool.h>
5#include <unistd.h>
6
7/***********************************************************************
8 * SS7 ASP Peer
9 ***********************************************************************/
10
11 struct osmo_ss7_asp_peer {
12 char *host[OSMO_SOCK_MAX_ADDRS];
13 size_t host_cnt;
14 uint16_t port;
15 /* index in "hosts" array marking the SCTP Primary Address, -1 if no explicit Primary Address set */
16 int idx_primary;
17};
18
19int ss7_asp_peer_snprintf(char *buf, size_t buf_len, struct osmo_ss7_asp_peer *peer);
20void ss7_asp_peer_init(struct osmo_ss7_asp_peer *peer);
21int ss7_asp_peer_set_hosts(struct osmo_ss7_asp_peer *peer, void *talloc_ctx,
22 const char *const*hosts, size_t host_cnt);
23int ss7_asp_peer_set_hosts2(struct osmo_ss7_asp_peer *peer, void *talloc_ctx,
24 const char *const*hosts, size_t host_cnt, int idx_primary);
25int ss7_asp_peer_add_host(struct osmo_ss7_asp_peer *peer, void *talloc_ctx, const char *host);
26int ss7_asp_peer_add_host2(struct osmo_ss7_asp_peer *peer, void *talloc_ctx, const char *host, bool is_primary_addr);
27int ss7_asp_peer_del_host(struct osmo_ss7_asp_peer *peer, const char *host);
28
29bool ss7_asp_peer_match_host(const struct osmo_ss7_asp_peer *peer, const char *host, bool host_is_v6);
30int ss7_asp_peer_find_host(const struct osmo_ss7_asp_peer *peer, const char *host);
ss7_asp_peer_init
void ss7_asp_peer_init(struct osmo_ss7_asp_peer *peer)
Definition: ss7_asp_peer.c:48
ss7_asp_peer_find_host
int ss7_asp_peer_find_host(const struct osmo_ss7_asp_peer *peer, const char *host)
Find the exact IP address match and return its index in the array.
Definition: ss7_asp_peer.c:286
ss7_asp_peer_snprintf
int ss7_asp_peer_snprintf(char *buf, size_t buf_len, struct osmo_ss7_asp_peer *peer)
Definition: ss7_asp_peer.c:54
ss7_asp_peer_set_hosts2
int ss7_asp_peer_set_hosts2(struct osmo_ss7_asp_peer *peer, void *talloc_ctx, const char *const *hosts, size_t host_cnt, int idx_primary)
Set (copy) addresses for a given ASP peer.
Definition: ss7_asp_peer.c:94
ss7_asp_peer_set_hosts
int ss7_asp_peer_set_hosts(struct osmo_ss7_asp_peer *peer, void *talloc_ctx, const char *const *hosts, size_t host_cnt)
Set (copy) addresses for a given ASP peer.
Definition: ss7_asp_peer.c:122
ss7_asp_peer_add_host2
int ss7_asp_peer_add_host2(struct osmo_ss7_asp_peer *peer, void *talloc_ctx, const char *host, bool is_primary_addr)
Append (copy) address to a given ASP peer.
Definition: ss7_asp_peer.c:143
ss7_asp_peer_add_host
int ss7_asp_peer_add_host(struct osmo_ss7_asp_peer *peer, void *talloc_ctx, const char *host)
Append (copy) address to a given ASP peer.
Definition: ss7_asp_peer.c:261
ss7_asp_peer_del_host
int ss7_asp_peer_del_host(struct osmo_ss7_asp_peer *peer, const char *host)
Remove address from a given ASP peer.
Definition: ss7_asp_peer.c:216
ss7_asp_peer_match_host
bool ss7_asp_peer_match_host(const struct osmo_ss7_asp_peer *peer, const char *host, bool host_is_v6)
Definition: ss7_asp_peer.c:267
osmo_ss7_asp_peer
Definition: ss7_asp_peer.h:11
osmo_ss7_asp_peer::host_cnt
size_t host_cnt
Definition: ss7_asp_peer.h:13
osmo_ss7_asp_peer::port
uint16_t port
Definition: ss7_asp_peer.h:14
osmo_ss7_asp_peer::host
char * host[OSMO_SOCK_MAX_ADDRS]
Definition: ss7_asp_peer.h:12
osmo_ss7_asp_peer::idx_primary
int idx_primary
Definition: ss7_asp_peer.h:16