Loading...
Searching...
No Matches
ss7_asp_peer.h
Go to the documentation of this file.
#pragma once
#include <stdint.h>
#include <stdbool.h>
#include <unistd.h>
/***********************************************************************
* SS7 ASP Peer
***********************************************************************/
struct osmo_ss7_asp_peer {
char *host[OSMO_SOCK_MAX_ADDRS];
size_t host_cnt;
uint16_t port;
/* index in "hosts" array marking the SCTP Primary Address, -1 if no explicit Primary Address set */
int idx_primary;
};
int ss7_asp_peer_snprintf(char *buf, size_t buf_len, struct osmo_ss7_asp_peer *peer);
void ss7_asp_peer_init(struct osmo_ss7_asp_peer *peer);
int ss7_asp_peer_set_hosts(struct osmo_ss7_asp_peer *peer, void *talloc_ctx,
const char *const*hosts, size_t host_cnt);
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);
int ss7_asp_peer_add_host(struct osmo_ss7_asp_peer *peer, void *talloc_ctx, const char *host);
int ss7_asp_peer_add_host2(struct osmo_ss7_asp_peer *peer, void *talloc_ctx, const char *host, bool is_primary_addr);
int ss7_asp_peer_del_host(struct osmo_ss7_asp_peer *peer, const char *host);
bool ss7_asp_peer_match_host(const struct osmo_ss7_asp_peer *peer, const char *host, bool host_is_v6);
int 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 osmo_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 osmo_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 osmo_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 osmo_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 osmo_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 osmo_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 osmo_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 osmo_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 osmo_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