BitLab 0.1.0
BitLab: A Browser for the Bitcoin P2P Network and Blockchain
Loading...
Searching...
No Matches
ip.h
Go to the documentation of this file.
1#ifndef __IP_H
2#define __IP_H
3
4#include <netdb.h>
5#include <sys/types.h>
6#include <sys/socket.h>
7
8#define MAX_IP_ADDR_LEN 1024
9
15void get_local_ip_address(char* ip_addr);
16
22void get_remote_ip_address(char* ip_addr);
23
31int lookup_address(const char* lookup_addr, char* ip_addr);
32
39int is_in_private_network(const char* ip_addr);
40
47int is_numeric_address(const char* ip_addr);
48
55int is_valid_domain_address(const char* domain_addr);
56
57
58
60
61struct addrinfo {
66 socklen_t ai_addrlen;
67 struct sockaddr* ai_addr;
70};
71
72int getaddrinfo(const char* restrict node,
73 const char* restrict service,
74 const struct addrinfo* restrict hints,
75 struct addrinfo** restrict res);
76
77void freeaddrinfo(struct addrinfo* res);
78
79const char* gai_strerror(int errcode);
80
81#endif // __IP_H
void get_local_ip_address(char *ip_addr)
Get the local IP address of the machine (e.g.
Definition ip.c:11
int lookup_address(const char *lookup_addr, char *ip_addr)
Perform lookup of given IP address by the domain address (e.g.
Definition ip.c:55
int is_numeric_address(const char *ip_addr)
Check if the IP address is a numeric address (e.g.
Definition ip.c:119
int is_in_private_network(const char *ip_addr)
Check if the IP address is in the private prefix (e.g.
Definition ip.c:98
void freeaddrinfo(struct addrinfo *res)
int is_valid_domain_address(const char *domain_addr)
Check if the IP address is a valid domain address (e.g.
Definition ip.c:136
const char * gai_strerror(int errcode)
int getaddrinfo(const char *restrict node, const char *restrict service, const struct addrinfo *restrict hints, struct addrinfo **restrict res)
void get_remote_ip_address(char *ip_addr)
Get the remote IP address of the machine (e.g.
Definition ip.c:33
Definition ip.h:61
struct sockaddr * ai_addr
Definition ip.h:67
char * ai_canonname
Definition ip.h:68
int ai_socktype
Definition ip.h:64
int ai_protocol
Definition ip.h:65
socklen_t ai_addrlen
Definition ip.h:66
struct addrinfo * ai_next
Definition ip.h:69
int ai_flags
Definition ip.h:62
int ai_family
Definition ip.h:63