LIBKYHW(3)

NAME
kdk_net_get_port_stat, kdk_net_get_multiple_port_stat, kdk_net_get_route, kdk_net_free_route, kdk_net_get_iptable_rules, kdk_net_free_chain, kdk_net_get_netmask, kdk_net_get_proc_port, kdk_net_get_up_port, kdk_net_get_hosts, kdk_net_get_hosts_domain, kdk_net_get_resolv_conf, kdk_net_freeal - 获取网络信息

SYNOPSIS
#include <libkynetinfo.h>

extern int kdk_net_get_port_stat(int port);

extern int kdk_net_get_multiple_port_stat(int start, int end, int *result);

extern prouteMapList kdk_net_get_route();

extern void kdk_net_free_route(prouteMapList list);

extern pChain kdk_net_get_iptable_rules();

extern void kdk_net_free_chain(pChain list);

extern void kdk_net_get_netmask(IN const char *nc, OUT char *mask);

extern char **kdk_net_get_proc_port();

extern char **kdk_net_get_up_port();

extern char* kdk_net_get_hosts();

extern char* kdk_net_get_hosts_domain();

extern char** kdk_net_get_resolv_conf();

extern inline void kdk_net_freeall(char **ptr);

Link with -lkynetinfo.

Detailed Description
This library contains network information.

DATA STRUCTURES

Structure route contains information related to a Firewall:

typedef struct route {
    char name[32]; //网卡名
    char addr[16]; //网关地址
    struct route *next;
} routeMapList, *prouteMapList;

There are other members not documented here, which are only meant for libkynetinfo internal use.

Structure chain contains information related to a Gateway:

typedef struct chain {
    char total[16]; //链名
    char policy[32]; //链的规则
    pChainData data;
    struct chain *next;
} Chain, *pChain;

There are other members not documented here, which are only meant for libkynetinfo internal use.

Structure chain_data contains information related to a Gateway specific information:

typedef struct chain_data {
    char target[8];
    char prot[4 + 1];
    char opt[4 + 1];
    char source[32];
    char destination[64];
    char option[128];
    struct chain_data *next;
} chainData, *pChainData;

There are other members not documented here, which are only meant for libkynetinfo internal use.

RETURN VALUE
The return value is generally specific to the individual function called.

CONFORMING TO
These functions are as per the withdrawn POSIX.1e draft specification. The following functions are Linux extensions: kdk_net_get_multiple_port_stat(), kdk_net_get_port_stat(), kdk_net_get_route(), kdk_net_get_iptable_rules(), kdk_net_free_route(), kdk_net_get_netmask(), kdk_net_free_chain(), kdk_net_get_up_port(), kdk_net_get_hosts(), kdk_net_get_hosts_domain(), kdk_net_freeall(), kdk_net_get_proc_port() and kdk_net_get_resolv_conf().

SEE ALSO
kdk_net_get_multiple_port_stat(3), kdk_net_get_port_stat(3), kdk_net_get_route(3), kdk_net_get_iptable_rules(3), kdk_net_free_route(3), kdk_net_get_netmask(3), kdk_net_free_chain(3), kdk_net_get_up_port(3), kdk_net_get_hosts(3), kdk_net_get_hosts_domain(3), kdk_net_freeall(3), kdk_net_get_proc_port(3) and kdk_net_get_resolv_conf(3).