PostgreSQL Source Code  git master
ifaddr.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * ifaddr.h
4  * IP netmask calculations, and enumerating network interfaces.
5  *
6  * Copyright (c) 2003-2024, PostgreSQL Global Development Group
7  *
8  * src/include/libpq/ifaddr.h
9  *
10  *-------------------------------------------------------------------------
11  */
12 #ifndef IFADDR_H
13 #define IFADDR_H
14 
15 #include "libpq/pqcomm.h" /* pgrminclude ignore */
16 
17 typedef void (*PgIfAddrCallback) (struct sockaddr *addr,
18  struct sockaddr *netmask,
19  void *cb_data);
20 
21 extern int pg_range_sockaddr(const struct sockaddr_storage *addr,
22  const struct sockaddr_storage *netaddr,
23  const struct sockaddr_storage *netmask);
24 
25 extern int pg_sockaddr_cidr_mask(struct sockaddr_storage *mask,
26  char *numbits, int family);
27 
28 extern int pg_foreach_ifaddr(PgIfAddrCallback callback, void *cb_data);
29 
30 #endif /* IFADDR_H */
int pg_sockaddr_cidr_mask(struct sockaddr_storage *mask, char *numbits, int family)
Definition: ifaddr.c:105
int pg_foreach_ifaddr(PgIfAddrCallback callback, void *cb_data)
Definition: ifaddr.c:425
void(* PgIfAddrCallback)(struct sockaddr *addr, struct sockaddr *netmask, void *cb_data)
Definition: ifaddr.h:17
int pg_range_sockaddr(const struct sockaddr_storage *addr, const struct sockaddr_storage *netaddr, const struct sockaddr_storage *netmask)
Definition: ifaddr.c:49
static void callback(struct sockaddr *addr, struct sockaddr *mask, void *unused)
Definition: test_ifaddrs.c:46