libosmo-sigtran 2.0.0.52-6412
Osmocom SIGTRAN library
ss7_asp_peer.h File Reference
#include <stdint.h>
#include <stdbool.h>
#include <unistd.h>

Go to the source code of this file.

Data Structures

struct  osmo_ss7_asp_peer
 

Functions

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)
 Set (copy) addresses for a given ASP peer. More...
 
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. More...
 
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. More...
 
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. More...
 
int ss7_asp_peer_del_host (struct osmo_ss7_asp_peer *peer, const char *host)
 Remove address from a given ASP peer. More...
 
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)
 Find the exact IP address match and return its index in the array. More...
 

Function Documentation

◆ 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.

Previous addresses are kept.

Parameters
[in]peerApplication Server Process peer the address is appended to.
[in]talloc_ctxtalloc context used to allocate new address.
[in]hoststring containing an IP address.
Returns
0 on success; negative otherwise

References ss7_asp_peer_add_host2().

Referenced by osmo_sccp_simple_server_add_clnt(), ss7_asp_set_default_peer_hosts(), and ss7_xua_server_add_local_host().

◆ 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.

Previous addresses are kept.

Parameters
[in]peerApplication Server Process peer the address is appended to.
[in]talloc_ctxtalloc context used to allocate new address.
[in]hoststring containing an IP address.
[in]is_primary_addrwhether this IP address is to be added as SCTP Primary Address
Returns
0 on success; negative otherwise

References osmo_ss7_asp_peer::host, osmo_ss7_asp_peer::host_cnt, host_is_ip_anyaddr(), and osmo_ss7_asp_peer::idx_primary.

Referenced by DEFUN_ATTR(), and ss7_asp_peer_add_host().

◆ 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.

Parameters
[in]peerApplication Server Process peer the address is removed from.
[in]hoststring containing an IP address.
Returns
0 on success; negative otherwise

References osmo_ss7_asp_peer::host, osmo_ss7_asp_peer::host_cnt, and osmo_ss7_asp_peer::idx_primary.

Referenced by DEFUN_ATTR(), and ss7_xua_server_del_local_host().

◆ 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.

Parameters
[in]peerApplication Server Process peer where the address is looked up.
[in]hoststring containing an IP address.
Returns
>=0 on success containing the index of the host; negative otherwise

References osmo_ss7_asp_peer::host, and osmo_ss7_asp_peer::host_cnt.

Referenced by DEFUN_ATTR().

◆ ss7_asp_peer_init()

void ss7_asp_peer_init ( struct osmo_ss7_asp_peer peer)

References osmo_ss7_asp_peer::idx_primary.

Referenced by ss7_asp_alloc().

◆ 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 
)

◆ 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.

Previous addresses are freed.

Parameters
[in]peerApplication Server Process peer whose addresses are to be set.
[in]talloc_ctxtalloc context used to allocate new addresses.
[in]hostsArray of strings containing IP addresses.
[in]host_cntNumber of strings in hosts
Returns
0 on success; negative otherwise

References ss7_asp_peer_set_hosts2().

Referenced by osmo_sccp_simple_client_on_ss7_id(), osmo_sccp_simple_server_add_clnt(), ss7_xua_server_set_local_hosts(), and xua_accept_cb().

◆ 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.

Previous addresses are freed.

Parameters
[in]peerApplication Server Process peer whose addresses are to be set.
[in]talloc_ctxtalloc context used to allocate new addresses.
[in]hostsArray of strings containing IP addresses.
[in]host_cntNumber of strings in hosts
[in]idx_primaryIndex in "hosts" array marking the SCTP Primary Address, -1 if no explicit Primary Address set
Returns
0 on success; negative otherwise

References osmo_ss7_asp_peer::host, osmo_ss7_asp_peer::host_cnt, and osmo_ss7_asp_peer::idx_primary.

Referenced by ss7_asp_peer_set_hosts().

◆ ss7_asp_peer_snprintf()