LIBKYHW(3)

📦 version 3.0.1.4, in arch rolling, ubuntu resolute, ubuntu stonking

💖 LIBKYHW(3) — the libkynetinfo girlies' guide 💖

okay so bestie, welcome to the Library Functions Manual entry for LIBKYHW(3) — aka the whole kdk_net_* friend group. This is the vibe: a little library that goes and gets your network information for you. No cap. 🦋


✨ 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 — 获取网络信息

yes the whole squad is in the NAME section, they all showed up together, it's giving group project energy 💅


🌸 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.

do NOT forget the link flag bestie, I'm begging 😭

🎀 Detailed Description 🎀

This library contains network information.

that's it, that's the whole description. short. iconic. it knows what it is. ✨


🫶 DATA STRUCTURES 🫶

💜 Structure route — the Firewall one

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.

(so like… mind your business about the rest, they're private 🙈)


💜 Structure chain — the Gateway one

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 — the Gateway-specific-info one

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.

ngl that's the most "figure it out yourself" return value section ever but fr fr, each function does its own thing. check the individual page, iykyk 💅


🌈 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()
  • kdk_net_get_resolv_conf()

literally every single one of them is a Linux extension, the whole friend group said "we're built different" 😭🔥


🦋 SEE ALSO 🦋


that's the whole page bestie, you ate it up. go read the individual pages for the deets, and remember: free your pointers or the leaks will find you 💀

this one's from the Linux Programmer's Manual, dated Thu Sep 14 2023 — mwah, love that for us, periodt 🎀✨💖

📦 where this page comes from