busybox/networking/libiproute/utils.h
<<
>>
Prefs
   1/* vi: set sw=4 ts=4: */
   2#ifndef UTILS_H
   3#define UTILS_H 1
   4
   5#include "libnetlink.h"
   6#include "ll_map.h"
   7#include "rtm_map.h"
   8
   9PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
  10
  11extern family_t preferred_family;
  12extern smallint show_stats;    /* UNUSED */
  13extern smallint show_details;  /* UNUSED */
  14extern smallint show_raw;      /* UNUSED */
  15extern smallint resolve_hosts; /* UNUSED */
  16extern smallint oneline;
  17extern char _SL_;
  18
  19#ifndef IPPROTO_ESP
  20#define IPPROTO_ESP  50
  21#endif
  22#ifndef IPPROTO_AH
  23#define IPPROTO_AH  51
  24#endif
  25
  26#define SPRINT_BSIZE 64
  27#define SPRINT_BUF(x)  char x[SPRINT_BSIZE]
  28
  29typedef struct {
  30        uint8_t family;
  31        uint8_t bytelen;
  32        int16_t bitlen;
  33        uint32_t data[4];
  34} inet_prefix;
  35
  36#define PREFIXLEN_SPECIFIED 1
  37
  38#define DN_MAXADDL 20
  39#ifndef AF_DECnet
  40#define AF_DECnet 12
  41#endif
  42
  43struct dn_naddr {
  44        unsigned short a_len;
  45        unsigned char  a_addr[DN_MAXADDL];
  46};
  47
  48#define IPX_NODE_LEN 6
  49
  50struct ipx_addr {
  51        uint32_t ipx_net;
  52        uint8_t  ipx_node[IPX_NODE_LEN];
  53};
  54
  55char** next_arg(char **argv) FAST_FUNC;
  56#define NEXT_ARG() do { argv = next_arg(argv); } while (0)
  57
  58uint32_t get_addr32(char *name) FAST_FUNC;
  59int get_addr_1(inet_prefix *dst, char *arg, int family) FAST_FUNC;
  60/*void get_prefix_1(inet_prefix *dst, char *arg, int family) FAST_FUNC;*/
  61int get_addr(inet_prefix *dst, char *arg, int family) FAST_FUNC;
  62void get_prefix(inet_prefix *dst, char *arg, int family) FAST_FUNC;
  63
  64unsigned get_unsigned(char *arg, const char *errmsg) FAST_FUNC;
  65uint32_t get_u32(char *arg, const char *errmsg) FAST_FUNC;
  66uint16_t get_u16(char *arg, const char *errmsg) FAST_FUNC;
  67
  68const char *rt_addr_n2a(int af, void *addr) FAST_FUNC;
  69#ifdef RESOLVE_HOSTNAMES
  70const char *format_host(int af, int len, void *addr) FAST_FUNC;
  71#else
  72#define format_host(af, len, addr) \
  73        rt_addr_n2a(af, addr)
  74#endif
  75
  76void invarg_1_to_2(const char *, const char *) FAST_FUNC NORETURN;
  77void duparg(const char *, const char *) FAST_FUNC NORETURN;
  78void duparg2(const char *, const char *) FAST_FUNC NORETURN;
  79
  80int inet_addr_match(const inet_prefix *a, const inet_prefix *b, int bits) FAST_FUNC;
  81
  82//const char *dnet_ntop(int af, const void *addr, char *str, size_t len);
  83//int dnet_pton(int af, const char *src, void *addr);
  84
  85//const char *ipx_ntop(int af, const void *addr, char *str, size_t len);
  86//int ipx_pton(int af, const char *src, void *addr);
  87
  88unsigned get_hz(void) FAST_FUNC;
  89
  90POP_SAVED_FUNCTION_VISIBILITY
  91
  92#endif
  93