|
libosmo-sigtran 2.1.0.165-6ea6
Osmocom SIGTRAN library
|
#include <string.h>#include <errno.h>#include <unistd.h>#include <inttypes.h>#include <netdb.h>#include <netinet/in.h>#include <netinet/sctp.h>#include <osmocom/core/utils.h>#include <osmocom/core/talloc.h>#include <osmocom/core/logging.h>#include <osmocom/core/socket.h>#include <osmocom/core/sockaddr_str.h>#include <osmocom/sigtran/osmo_ss7.h>#include "ss7_asp_peer.h"#include "ss7_internal.h"Functions | |
| void | ss7_asp_peer_init (struct osmo_ss7_asp_peer *peer) |
| int | ss7_asp_peer_snprintf (char *buf, size_t buf_len, struct osmo_ss7_asp_peer *peer) |
| 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_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... | |
| static bool | host_is_ip_anyaddr (const char *host, bool is_v6) |
| 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... | |
| 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... | |
| 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... | |
|
inlinestatic |
Referenced by ss7_asp_peer_add_host2(), and ss7_asp_peer_match_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.
| [in] | peer | Application Server Process peer the address is appended to. |
| [in] | talloc_ctx | talloc context used to allocate new address. |
| [in] | host | string containing an IP address. |
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().
| 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.
| [in] | peer | Application Server Process peer the address is appended to. |
| [in] | talloc_ctx | talloc context used to allocate new address. |
| [in] | host | string containing an IP address. |
| [in] | is_primary_addr | whether this IP address is to be added as SCTP Primary Address |
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().
| int ss7_asp_peer_del_host | ( | struct osmo_ss7_asp_peer * | peer, |
| const char * | host | ||
| ) |
Remove address from a given ASP peer.
| [in] | peer | Application Server Process peer the address is removed from. |
| [in] | host | string containing an IP address. |
References osmo_ss7_asp_peer::host, osmo_ss7_asp_peer::host_cnt, osmo_ss7_asp_peer::idx_primary, and NULL.
Referenced by DEFUN_ATTR(), and ss7_xua_server_del_local_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.
| [in] | peer | Application Server Process peer where the address is looked up. |
| [in] | host | string containing an IP address. |
References osmo_ss7_asp_peer::host, and osmo_ss7_asp_peer::host_cnt.
Referenced by DEFUN_ATTR().
| void ss7_asp_peer_init | ( | struct osmo_ss7_asp_peer * | peer | ) |
References osmo_ss7_asp_peer::idx_primary.
Referenced by ss7_asp_alloc().
| bool ss7_asp_peer_match_host | ( | const struct osmo_ss7_asp_peer * | peer, |
| const char * | host, | ||
| bool | host_is_v6 | ||
| ) |
References osmo_ss7_asp_peer::host, osmo_ss7_asp_peer::host_cnt, and host_is_ip_anyaddr().
Referenced by ss7_asp_find_by_socket_addr().
| 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.
| [in] | peer | Application Server Process peer whose addresses are to be set. |
| [in] | talloc_ctx | talloc context used to allocate new addresses. |
| [in] | hosts | Array of strings containing IP addresses. |
| [in] | host_cnt | Number of strings in hosts |
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().
| 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.
| [in] | peer | Application Server Process peer whose addresses are to be set. |
| [in] | talloc_ctx | talloc context used to allocate new addresses. |
| [in] | hosts | Array of strings containing IP addresses. |
| [in] | host_cnt | Number of strings in hosts |
| [in] | idx_primary | Index in "hosts" array marking the SCTP Primary Address, -1 if no explicit Primary Address set |
References osmo_ss7_asp_peer::host, osmo_ss7_asp_peer::host_cnt, osmo_ss7_asp_peer::idx_primary, and NULL.
Referenced by ss7_asp_peer_set_hosts().
| int ss7_asp_peer_snprintf | ( | char * | buf, |
| size_t | buf_len, | ||
| struct osmo_ss7_asp_peer * | peer | ||
| ) |
References osmo_ss7_asp_peer::host, osmo_ss7_asp_peer::host_cnt, osmo_ss7_asp_peer::idx_primary, len, and osmo_ss7_asp_peer::port.
Referenced by osmo_ss7_asp_restart(), show_one_asp(), ss7_xua_server_bind(), and vty_dump_xua_server().