Monero
Macros | Functions | Variables
getifaddr.c File Reference
#include <stdio.h>
#include <string.h>
#include <syslog.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <net/if.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "config.h"
#include "getifaddr.h"
Include dependency graph for getifaddr.c:

Macros

#define IP(a, b, c, d)   (((a) << 24) + ((b) << 16) + ((c) << 8) + (d))
 
#define MSK(m)   (32-(m))
 

Functions

int getifaddr (const char *ifname, char *buf, int len, struct in_addr *addr, struct in_addr *mask)
 
int addr_is_reserved (struct in_addr *addr)
 

Variables

struct {
   uint32_t   address
 
   uint32_t   rmask
 
reserved []
 

Macro Definition Documentation

◆ IP

#define IP (   a,
  b,
  c,
  d 
)    (((a) << 24) + ((b) << 16) + ((c) << 8) + (d))

◆ MSK

#define MSK (   m)    (32-(m))

Function Documentation

◆ addr_is_reserved()

int addr_is_reserved ( struct in_addr *  addr)

◆ getifaddr()

int getifaddr ( const char *  ifname,
char *  buf,
int  len,
struct in_addr *  addr,
struct in_addr *  mask 
)

Variable Documentation

◆ address

uint32_t address

◆ reserved

const { ... } reserved[]
Initial value:
= {
{ IP( 0, 0, 0, 0), MSK( 8) },
{ IP( 10, 0, 0, 0), MSK( 8) },
{ IP(100, 64, 0, 0), MSK(10) },
{ IP(127, 0, 0, 0), MSK( 8) },
{ IP(169, 254, 0, 0), MSK(16) },
{ IP(172, 16, 0, 0), MSK(12) },
{ IP(192, 0, 0, 0), MSK(24) },
{ IP(192, 0, 2, 0), MSK(24) },
{ IP(192, 31, 196, 0), MSK(24) },
{ IP(192, 52, 193, 0), MSK(24) },
{ IP(192, 88, 99, 0), MSK(24) },
{ IP(192, 168, 0, 0), MSK(16) },
{ IP(192, 175, 48, 0), MSK(24) },
{ IP(198, 18, 0, 0), MSK(15) },
{ IP(198, 51, 100, 0), MSK(24) },
{ IP(203, 0, 113, 0), MSK(24) },
{ IP(224, 0, 0, 0), MSK( 4) },
{ IP(240, 0, 0, 0), MSK( 4) },
}
#define MSK(m)
Definition: getifaddr.c:268
#define IP(a, b, c, d)
Definition: getifaddr.c:267

◆ rmask

uint32_t rmask