libosmo-sigtran: src/ss7_asp_peer.h File Reference

libosmo-sigtran 2.2.1.95-893c Osmocom SIGTRAN library

Data Structures | Functions
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] | 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.

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] | 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

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] | peer | Application Server Process peer the address is removed from.
  [in] | host | string containing an IP address.

Returns
  0 on success; negative otherwise

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().

## ◆ 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] | peer | Application Server Process peer where the address is looked up.
  [in] | host | string 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
| ) |  |

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().

## ◆ 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] | 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

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] | 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

Returns
  0 on success; negative otherwise

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().

## ◆ ss7_asp_peer_snprintf()

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().