mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-20 02:27:51 +01:00
8c22bd9ee1
For future reference, done via: for f in `find wire/ bitcoin/ common/ lightningd -name '*.h' ! -name 'gen*'`; do ID=`echo -n LIGHTNING/$f | tr 'a-z' 'A-Z' | tr -cs 'A-Z0-9' _`; sed 's/^#\(ifndef\|define\) .*_H$/#\1 '$ID/ < $f | sed 's,#endif /..*_H ./$,#endif /* '$ID' */,' | bagto $f; done Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
35 lines
1019 B
C
35 lines
1019 B
C
#ifndef LIGHTNING_LIGHTNINGD_NETADDR_H
|
|
#define LIGHTNING_LIGHTNINGD_NETADDR_H
|
|
#include "config.h"
|
|
#include <ccan/tal/tal.h>
|
|
#include <netinet/in.h>
|
|
#include <netinet/ip.h>
|
|
#include <sys/socket.h>
|
|
|
|
struct addrinfo;
|
|
|
|
/* This can be extended to support other protocols in future. */
|
|
struct netaddr {
|
|
int type; /* See socket(2): SOCK_STREAM currently */
|
|
int protocol; /* See socket(2): 0 currently */
|
|
socklen_t addrlen;
|
|
union {
|
|
struct sockaddr s;
|
|
struct sockaddr_in ipv4;
|
|
struct sockaddr_in6 ipv6;
|
|
} saddr;
|
|
};
|
|
|
|
/* Get the name for this netaddr. */
|
|
char *netaddr_name(const tal_t *ctx, const struct netaddr *a);
|
|
|
|
/* Create a addrinfo (as wanted by io_connect) for this address. */
|
|
void netaddr_to_addrinfo(struct addrinfo *ai, const struct netaddr *a);
|
|
|
|
bool netaddr_from_fd(int fd, int type, int protocol, struct netaddr *a);
|
|
|
|
bool netaddr_from_blob(const void *linear, size_t len, struct netaddr *a);
|
|
char *netaddr_to_hex(const tal_t *ctx, const struct netaddr *a);
|
|
|
|
#endif /* LIGHTNING_LIGHTNINGD_NETADDR_H */
|