forked from openkylin/docs
update 开始贡献/openKylin+SDK开发指南V2.0.md.
Signed-off-by: chipo <gugudu@sina.com>
This commit is contained in:
parent
cbef76220e
commit
799fedc0a2
|
@ -194,297 +194,70 @@ $ sudo apt-get install libkysdk-hardware libkysdk-hardware-dev |
|
|||
获取 CPU 架构
|
||||
|
||||
|
||||
```
|
||||
+----------------+------------+----------------+----------------+---+
|
||||
| 子模块 | 编程语言 | 声明 | 描述 | |
|
||||
+================+============+================+================+===+
|
||||
| <table> | C | extern const | 获取 CPU 架构 | |
|
||||
| <thead> | | char\* | | |
|
||||
| <tr c | | kdk_ | | |
|
||||
| lass="header"> | | cpu_get_arch() | | |
|
||||
| <t | | | | |
|
||||
| h><blockquote> | | | | |
|
||||
| <p>获</p> | | | | |
|
||||
| </bl | | | | |
|
||||
| ockquote></th> | | | | |
|
||||
| <th>取</th> | | | | |
|
||||
| </tr> | | | | |
|
||||
| </thead> | | | | |
|
||||
| <tbody> | | | | |
|
||||
| <t | | | | |
|
||||
| r class="odd"> | | | | |
|
||||
| <t | | | | |
|
||||
| d><blockquote> | | | | |
|
||||
| <p>CPU</p> | | | | |
|
||||
| </bl | | | | |
|
||||
| ockquote></td> | | | | |
|
||||
| <td>信</td> | | | | |
|
||||
| </tr> | | | | |
|
||||
| <tr | | | | |
|
||||
| class="even"> | | | | |
|
||||
| <t | | | | |
|
||||
| d><blockquote> | | | | |
|
||||
| <p>息</p> | | | | |
|
||||
| </bl | | | | |
|
||||
| ockquote></td> | | | | |
|
||||
| <td></td> | | | | |
|
||||
| </tr> | | | | |
|
||||
| </tbody> | | | | |
|
||||
| </table> | | | | |
|
||||
+----------------+------------+----------------+----------------+---+
|
||||
| | | > 参数说明 | > 返回值说明 | |
|
||||
+----------------+------------+----------------+----------------+---+
|
||||
| | | > 无 | const char\* | |
|
||||
| | | | 架构信息, | |
|
||||
| | | | | |
|
||||
| | | | 如\"x86_ | |
|
||||
| | | | 64\";返回的是 | |
|
||||
| | | | | |
|
||||
| | | | > const | |
|
||||
| | | | > char\*,不要 | |
|
||||
| | | | > free | |
|
||||
+----------------+------------+----------------+----------------+---+
|
||||
```
|
||||
| 子模块 | 编程语言 | 声明 | 描述 |
|
||||
|---------|------|---------------------------------------|---------------------------------------------------|
|
||||
| 获取CPU信息 | C | extern const char* kdk_cpu_get_arch() | 获取CPU架构 |
|
||||
| | | 参数说明 | 返回值说明 | |
|
||||
| | | 无 | const char* 架构信息,如"x86_64";返回的是const char*,不要free |
|
||||
|
||||
|
||||
|
||||
获取 CPU 制造厂商
|
||||
|
||||
|
||||
```
|
||||
+----------------+------------+----------------+----------------+---+
|
||||
| > 子模块 | > 编程语言 | 声明 | > 描述 | |
|
||||
+================+============+================+================+===+
|
||||
| <table> | C | extern const | 获取 CPU 制造 | |
|
||||
| <thead> | | char\* | | |
|
||||
| <tr c | | kdk_cp | 商 | |
|
||||
| lass="header"> | | u_get_vendor() | | |
|
||||
| <t | | | | |
|
||||
| h><blockquote> | | | | |
|
||||
| <p>获</p> | | | | |
|
||||
| </bl | | | | |
|
||||
| ockquote></th> | | | | |
|
||||
| <th>取</th> | | | | |
|
||||
| </tr> | | | | |
|
||||
| </thead> | | | | |
|
||||
| <tbody> | | | | |
|
||||
| <t | | | | |
|
||||
| r class="odd"> | | | | |
|
||||
| <t | | | | |
|
||||
| d><blockquote> | | | | |
|
||||
| <p>CPU</p> | | | | |
|
||||
| </bl | | | | |
|
||||
| ockquote></td> | | | | |
|
||||
| <td>信</td> | | | | |
|
||||
| </tr> | | | | |
|
||||
| </tbody> | | | | |
|
||||
| </table> | | | | |
|
||||
| | | | | |
|
||||
| > 息 | | | | |
|
||||
+----------------+------------+----------------+----------------+---+
|
||||
| | | > 参数说明 | > 返回值说明 | |
|
||||
+----------------+------------+----------------+----------------+---+
|
||||
| | | > 无 | const char\* | |
|
||||
| | | | 制 造 厂 商 字 | |
|
||||
| | | | | |
|
||||
| | | | > 符 串 , 如 | |
|
||||
| | | | | |
|
||||
| | | | "GenuineIntel" | |
|
||||
| | | | ; 返 回 | |
|
||||
| | | | | |
|
||||
| | | | 的 是 const | |
|
||||
| | | | char\* , 不要 | |
|
||||
| | | | | |
|
||||
| | | | > free | |
|
||||
+----------------+------------+----------------+----------------+---+
|
||||
```
|
||||
| 子模块 | 编程语言 | 声明 | 描述 |
|
||||
|---------|------|-----------------------------------------|------------------------------------------------------------|
|
||||
| 获取CPU信息 | C | extern const char* kdk_cpu_get_vendor() | 获取CPU制造商 |
|
||||
| | | 参数说明 | 返回值说明 | |
|
||||
| | | 无 | const char* 制造厂商字符串,如“GenuineIntel”;返回的是const char*,不要free |
|
||||
|
||||
|
||||
|
||||
获取 CPU 型号
|
||||
|
||||
|
||||
```
|
||||
+----------+------------+-----------------------------------------+-----------------+
|
||||
| > 子模块 | > 编程语言 | 声明 | > 描述 |
|
||||
+==========+============+=========================================+=================+
|
||||
| > 获 取 | C | extern const char\* kdk_cpu_get_model() | > 获取 CPU 型号 |
|
||||
+----------+------------+-----------------------------------------+-----------------+
|
||||
```
|
||||
| 子模块 | 编程语言 | 声明 | 描述 |
|
||||
|---------|------|----------------------------------------|----------------------------------------------------------------------------------------|
|
||||
| 获取CPU信息 | C | extern const char* kdk_cpu_get_model() | 获取CPU型号 |
|
||||
| | | 参数说明 | 返回值说明 | |
|
||||
| | | 无 | const char* CPU型号名称,如“Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz”;返回的是const char*,不要free |
|
||||
|
||||
|
||||
|
||||
```
|
||||
+----------+---+------------+---------------------------+---+
|
||||
| > CPU 信 | | > 参数说明 | > 返回值说明 | |
|
||||
| > | | | | |
|
||||
| > 息 | | | | |
|
||||
+==========+===+============+===========================+===+
|
||||
| | | > 无 | const char\* CPU 型 号 名 | |
|
||||
| | | | | |
|
||||
| | | | > 称 , 如 "Intel(R) | |
|
||||
| | | | | |
|
||||
| | | | Core(TM) i7-4790K CPU | |
|
||||
| | | | | |
|
||||
| | | | @ 4.00GHz";返回的是 | |
|
||||
| | | | | |
|
||||
| | | | > const char\*,不要 free | |
|
||||
+----------+---+------------+---------------------------+---+
|
||||
```
|
||||
|
||||
|
||||
获取 CPU 额定主频
|
||||
|
||||
|
||||
```
|
||||
+----------------+------------+----------------+----------------+---+
|
||||
| > 子模块 | > 编程语言 | 声明 | > 描述 | |
|
||||
+================+============+================+================+===+
|
||||
| <table> | C | extern const | 获取 CPU 额定 | |
|
||||
| <thead> | | char\* | | |
|
||||
| <tr c | | kdk_cpu_ | > 主频 | |
|
||||
| lass="header"> | | get_freq_MHz() | | |
|
||||
| <t | | | | |
|
||||
| h><blockquote> | | | | |
|
||||
| <p>获</p> | | | | |
|
||||
| </bl | | | | |
|
||||
| ockquote></th> | | | | |
|
||||
| <th>取</th> | | | | |
|
||||
| </tr> | | | | |
|
||||
| </thead> | | | | |
|
||||
| <tbody> | | | | |
|
||||
| <t | | | | |
|
||||
| r class="odd"> | | | | |
|
||||
| <t | | | | |
|
||||
| d><blockquote> | | | | |
|
||||
| <p>CPU</p> | | | | |
|
||||
| </bl | | | | |
|
||||
| ockquote></td> | | | | |
|
||||
| <td>信</td> | | | | |
|
||||
| </tr> | | | | |
|
||||
| </tbody> | | | | |
|
||||
| </table> | | | | |
|
||||
| | | | | |
|
||||
| > 息 | | | | |
|
||||
+----------------+------------+----------------+----------------+---+
|
||||
| | | > 参数说明 | > 返回值说明 | |
|
||||
+----------------+------------+----------------+----------------+---+
|
||||
| | | > 无 | const char\* | |
|
||||
| | | | 额定主频赫兹 | |
|
||||
| | | | | |
|
||||
| | | | 数,如 | |
|
||||
| | | | "1794.742",单 | |
|
||||
| | | | | |
|
||||
| | | | 位 是 MHz ; | |
|
||||
| | | | 返 回 的 是 | |
|
||||
| | | | | |
|
||||
| | | | > const | |
|
||||
| | | | > char\*,不要 | |
|
||||
| | | | > free | |
|
||||
+----------------+------------+----------------+----------------+---+
|
||||
```
|
||||
| 子模块 | 编程语言 | 声明 | 描述 |
|
||||
|---------|------|-------------------------------------------|---------------------------------------------------------------|
|
||||
| 获取CPU信息 | C | extern const char* kdk_cpu_get_freq_MHz() | 获取CPU额定主频 |
|
||||
| | | 参数说明 | 返回值说明 | |
|
||||
| | | 无 | const char* 额定主频赫兹数,如“1794.742”,单位是MHz;返回的是const char*,不要free |
|
||||
|
||||
|
||||
|
||||
|
||||
获取 CPU 核心数量
|
||||
|
||||
|
||||
```
|
||||
+----------------+------------+----------------+---------------+---+
|
||||
| > 子模块 | > 编程语言 | 声明 | > 描述 | |
|
||||
+================+============+================+===============+===+
|
||||
| <table> | C | extern | 获取 CPU 核心 | |
|
||||
| <thead> | | unsigned int | | |
|
||||
| <tr c | | kdk_cpu_ | > 数量 | |
|
||||
| lass="header"> | | get_corenums() | | |
|
||||
| <t | | | | |
|
||||
| h><blockquote> | | | | |
|
||||
| <p>获</p> | | | | |
|
||||
| </bl | | | | |
|
||||
| ockquote></th> | | | | |
|
||||
| <th>取</th> | | | | |
|
||||
| </tr> | | | | |
|
||||
| </thead> | | | | |
|
||||
| <tbody> | | | | |
|
||||
| <t | | | | |
|
||||
| r class="odd"> | | | | |
|
||||
| <t | | | | |
|
||||
| d><blockquote> | | | | |
|
||||
| <p>CPU</p> | | | | |
|
||||
| </bl | | | | |
|
||||
| ockquote></td> | | | | |
|
||||
| <td>信</td> | | | | |
|
||||
| </tr> | | | | |
|
||||
| </tbody> | | | | |
|
||||
| </table> | | | | |
|
||||
| | | | | |
|
||||
| > 息 | | | | |
|
||||
+----------------+------------+----------------+---------------+---+
|
||||
| | | > 参数说明 | > 返回值说明 | |
|
||||
+----------------+------------+----------------+---------------+---+
|
||||
```
|
||||
| 子模块 | 编程语言 | 声明 | 描述 |
|
||||
|---------|------|--------------------------------------------|---------------------------|
|
||||
| 获取CPU信息 | C | extern unsigned int kdk_cpu_get_corenums() | 获取CPU核心数量 |
|
||||
| | | 参数说明 | 返回值说明 | |
|
||||
| | | 无 | unsigned int 所有可用的CPU核心数量 |
|
||||
|
||||
|
||||
|
||||
```
|
||||
+---+---+------+-----------------------------+---+
|
||||
| | | > 无 | unsigned int 所 有 可 用 的 | |
|
||||
| | | | | |
|
||||
| | | | > CPU 核心数量 | |
|
||||
+---+---+------+-----------------------------+---+
|
||||
```
|
||||
|
||||
|
||||
获取 CPU 对虚拟化的支持
|
||||
|
||||
|
||||
```
|
||||
+----------------+------------+----------------+----------------+---+
|
||||
| > 子模块 | > 编程语言 | 声明 | > 描述 | |
|
||||
+================+============+================+================+===+
|
||||
| <table> | C | const char\* | 获取 CPU 对虚 | |
|
||||
| <thead> | | kdk_ | | |
|
||||
| <tr c | | cpu_get_virt() | > 拟化的支持 | |
|
||||
| lass="header"> | | | | |
|
||||
| <t | | | | |
|
||||
| h><blockquote> | | | | |
|
||||
| <p>获</p> | | | | |
|
||||
| </bl | | | | |
|
||||
| ockquote></th> | | | | |
|
||||
| <th>取</th> | | | | |
|
||||
| </tr> | | | | |
|
||||
| </thead> | | | | |
|
||||
| <tbody> | | | | |
|
||||
| <t | | | | |
|
||||
| r class="odd"> | | | | |
|
||||
| <t | | | | |
|
||||
| d><blockquote> | | | | |
|
||||
| <p>CPU</p> | | | | |
|
||||
| </bl | | | | |
|
||||
| ockquote></td> | | | | |
|
||||
| <td>信</td> | | | | |
|
||||
| </tr> | | | | |
|
||||
| </tbody> | | | | |
|
||||
| </table> | | | | |
|
||||
| | | | | |
|
||||
| > 息 | | | | |
|
||||
+----------------+------------+----------------+----------------+---+
|
||||
| | | > 参数说明 | > 返回值说明 | |
|
||||
+----------------+------------+----------------+----------------+---+
|
||||
| | | > 无 | const char\* | |
|
||||
| | | | 若 CPU 支持虚 | |
|
||||
| | | | | |
|
||||
| | | | 拟化, | |
|
||||
| | | | 则返回虚拟化技 | |
|
||||
| | | | | |
|
||||
| | | | 术,如 | |
|
||||
| | | | "vmx";若不支 | |
|
||||
| | | | | |
|
||||
| | | | 持,返回 | |
|
||||
| | | | NULL;返回的 | |
|
||||
| | | | | |
|
||||
| | | | > 是 const | |
|
||||
| | | | > char\*,不要 | |
|
||||
| | | | > free | |
|
||||
+----------------+------------+----------------+----------------+---+
|
||||
```
|
||||
| 子模块 | 编程语言 | 声明 | 描述 |
|
||||
|---------|------|--------------------------------|--------------------------------------------------------------------------|
|
||||
| 获取CPU信息 | C | const char* kdk_cpu_get_virt() | 获取CPU对虚拟化的支持 |
|
||||
| | | 参数说明 | 返回值说明 | |
|
||||
| | | 无 | const char* 若CPU支持虚拟化,则返回虚拟化技术,如“vmx”;若不支持,返回NULL;返回的是const char*,不要free |
|
||||
|
||||
|
||||
|
||||
#### **3.1.2.2** 获取网卡信息
|
||||
|
@ -512,319 +285,118 @@ $ sudo apt-get install libkysdk-hardware libkysdk-hardware-dev |
|
|||
获取系统中所有的网卡
|
||||
|
||||
|
||||
```
|
||||
+----------+------------+--------------------+--------------------+---+
|
||||
| > 子模块 | > 编程语言 | 声明 | > 描述 | |
|
||||
+==========+============+====================+====================+===+
|
||||
| 获 取 网 | C | extern char\*\* | 获取系统中 | |
|
||||
| | | kdk | | |
|
||||
| > 卡信息 | | _nc_get_cardlist() | > 所有的网卡 | |
|
||||
+----------+------------+--------------------+--------------------+---+
|
||||
| | | > 参数说明 | > 返回值说明 | |
|
||||
+----------+------------+--------------------+--------------------+---+
|
||||
| | | > 无 | char\*\* | |
|
||||
| | | | 网卡名称列表,由 | |
|
||||
| | | | | |
|
||||
| | | | NULL | |
|
||||
| | | | 字符串表示结尾; | |
|
||||
| | | | | |
|
||||
| | | | 由 alloc 生 成 , | |
|
||||
| | | | 需 要 被 | |
|
||||
| | | | | |
|
||||
| | | | kdk_nc_freeall | |
|
||||
| | | | 回收;若获 | |
|
||||
| | | | | |
|
||||
| | | | > 取出错,返回 | |
|
||||
| | | | > NULL; | |
|
||||
+----------+------------+--------------------+--------------------+---+
|
||||
```
|
||||
| 子模块 | 编程语言 | 声明 | 描述 |
|
||||
|--------|------|-------------------------------------|-----------------------------------------------------------------------|
|
||||
| 获取网卡信息 | C | extern char** kdk_nc_get_cardlist() | 获取系统中所有的网卡 |
|
||||
| | | 参数说明 | 返回值说明 | |
|
||||
| | | 无 | char** 网卡名称列表,由NULL字符串表示结尾;由alloc生成,需要被kdk_nc_freeall回收;若获取出错,返回NULL; |
|
||||
|
||||
|
||||
检测指定网卡是否处于 UP 状态
|
||||
|
||||
|
||||
```
|
||||
+----------+------------+--------------------+--------------------+---+
|
||||
| > 子模块 | > 编程语言 | 声明 | > 描述 | |
|
||||
+==========+============+====================+====================+===+
|
||||
| 获 取 网 | C | extern int | 检测指定网 | |
|
||||
| | | kdk_nc_is_up(const | | |
|
||||
| > 卡信息 | | char \*nc) | 卡是否处于 | |
|
||||
| | | | | |
|
||||
| | | | > UP 状态 | |
|
||||
+----------+------------+--------------------+--------------------+---+
|
||||
| | | > 参数说明 | > 返回值说明 | |
|
||||
+----------+------------+--------------------+--------------------+---+
|
||||
| | | nc:网卡名称, | int Up 返回 | |
|
||||
| | | | 1,Down 返回 | |
|
||||
| | | > 如 eno1 | | |
|
||||
| | | | > 0 | |
|
||||
+----------+------------+--------------------+--------------------+---+
|
||||
```
|
||||
| 子模块 | 编程语言 | 声明 | 描述 |
|
||||
|--------|------|-----------------------------------------|-------------------|
|
||||
| 获取网卡信息 | C | extern int kdk_nc_is_up(const char *nc) | 检测指定网卡是否处于UP状态 |
|
||||
| | | 参数说明 | 返回值说明 | |
|
||||
| | | nc:网卡名称,如eno1 | int Up返回1,Down返回0 |
|
||||
|
||||
|
||||
|
||||
获取系统中当前处于 link up 状态的网卡列表
|
||||
|
||||
| 子模块 | 编程语言 | 声明 | 描述 |
|
||||
|--------|------|------------------------------------|-----------------------------------------------------------------------|
|
||||
| 获取网卡信息 | C | extern char** kdk_nc_get_upcards() | 获取系统中当前处于 link up 状态的网卡列表 |
|
||||
| | | 参数说明 | 返回值说明 | |
|
||||
| | | 无 | char** 网卡名称列表,由NULL字符串表示结尾;由alloc生成,需要被kdk_nc_freeall回收;若获取出错,返回NULL; |
|
||||
|
||||
```
|
||||
+----------+------------+--------------------------------------+--------------+
|
||||
| > 子模块 | > 编程语言 | 声明 | > 描述 |
|
||||
+==========+============+======================================+==============+
|
||||
| 获 取 网 | C | extern char\*\* kdk_nc_get_upcards() | 获取系统中当 |
|
||||
+----------+------------+--------------------------------------+--------------+
|
||||
```
|
||||
|
||||
|
||||
|
||||
```
|
||||
+----------+---+------------+----------------------------+---+
|
||||
| > 卡信息 | | | 前处于 link up | |
|
||||
| | | | | |
|
||||
| | | | 状态的网卡列 | |
|
||||
| | | | | |
|
||||
| | | | > 表 | |
|
||||
+==========+===+============+============================+===+
|
||||
| | | > 参数说明 | > 返回值说明 | |
|
||||
+----------+---+------------+----------------------------+---+
|
||||
| | | > 无 | char\*\* 网卡名称列表,由 | |
|
||||
| | | | | |
|
||||
| | | | NULL 字符串表示结尾; | |
|
||||
| | | | | |
|
||||
| | | | 由 alloc 生 成 , 需 要 被 | |
|
||||
| | | | | |
|
||||
| | | | kdk_nc_freeall 回 收 ; 若 | |
|
||||
| | | | | |
|
||||
| | | | > 获取出错,返回 NULL; | |
|
||||
+----------+---+------------+----------------------------+---+
|
||||
```
|
||||
|
||||
|
||||
获取指定网卡的物理 MAC 地址
|
||||
|
||||
| 子模块 | 编程语言 | 声明 | 描述 |
|
||||
|--------|------|------------------------------------------------|-------------------------------------------------|
|
||||
| 获取网卡信息 | C | extern char* kdk_nc_get_phymac(const char *nc) | 获取指定网卡的物理MAC地址 |
|
||||
| | | 参数说明 | 返回值说明 | |
|
||||
| | | nc:网卡名称,如eno1 | char* 物理MAC地址,由alloc生成,应当被free;若指定网卡不存在,则返回NULL |
|
||||
|
||||
```
|
||||
+----------+------------+--------------------+--------------------+---+
|
||||
| > 子模块 | > 编程语言 | 声明 | > 描述 | |
|
||||
+==========+============+====================+====================+===+
|
||||
| 获 取 网 | C | extern char\* | 获取指定网卡 | |
|
||||
| | | kdk_n | | |
|
||||
| > 卡信息 | | c_get_phymac(const | 的物理 MAC 地 | |
|
||||
| | | char | | |
|
||||
| | | | > 址 | |
|
||||
| | | \*nc) | | |
|
||||
+----------+------------+--------------------+--------------------+---+
|
||||
| | | > 参数说明 | > 返回值说明 | |
|
||||
+----------+------------+--------------------+--------------------+---+
|
||||
| | | nc:网卡名称, | char\* 物 理 MAC | |
|
||||
| | | | 地 址, | |
|
||||
| | | > 如 eno1 | | |
|
||||
| | | | 由 alloc 生 成 , | |
|
||||
| | | | 应 当 被 | |
|
||||
| | | | | |
|
||||
| | | | free ; 若 指 定 | |
|
||||
| | | | 网 卡 不 存 | |
|
||||
| | | | | |
|
||||
| | | | > 在,则返回 NULL | |
|
||||
+----------+------------+--------------------+--------------------+---+
|
||||
```
|
||||
|
||||
|
||||
获取指定网卡的第一个 IPv4 地址
|
||||
|
||||
|
||||
```
|
||||
+----------+------------+---------------------+------------------+
|
||||
| > 子模块 | > 编程语言 | 声明 | > 描述 |
|
||||
+==========+============+=====================+==================+
|
||||
| 获 取 网 | C | extern char\* | 获取指定网卡 |
|
||||
| | | kdk_nc_get | |
|
||||
| | | _private_ipv4(const | 的 第 一 个 IPv4 |
|
||||
+----------+------------+---------------------+------------------+
|
||||
```
|
||||
| 子模块 | 编程语言 | 声明 | 描述 |
|
||||
|--------|------|------------------------------------------------------|-----------------------------|
|
||||
| 获取网卡信息 | C | extern char* kdk_nc_get_private_ipv4(const char *nc) | 获取指定网卡的第一个IPv4地址 |
|
||||
| | | 参数说明 | 返回值说明 | |
|
||||
| | | nc:网卡名称,如eno1 | char* IPv4地址,获取出错或无IP返回NULL |
|
||||
|
||||
|
||||
|
||||
```
|
||||
+----------+---+----------------+--------------------------+---+
|
||||
| > 卡信息 | | char \*nc) | > 地址 | |
|
||||
+==========+===+================+==========================+===+
|
||||
| | | > 参数说明 | > 返回值说明 | |
|
||||
+----------+---+----------------+--------------------------+---+
|
||||
| | | nc:网卡名称, | char\* IPv4 地址,获取出 | |
|
||||
| | | | | |
|
||||
| | | > 如 eno1 | > 错或无 IP 返回 NULL | |
|
||||
+----------+---+----------------+--------------------------+---+
|
||||
```
|
||||
|
||||
|
||||
获取指定网卡的所有 IPv4 地址
|
||||
|
||||
|
||||
```
|
||||
+----------+------------+--------------------+--------------------+---+
|
||||
| > 子模块 | > 编程语言 | 声明 | > 描述 | |
|
||||
+==========+============+====================+====================+===+
|
||||
| 获 取 网 | C | extern char\*\* | 获取指定网卡 | |
|
||||
| | | kdk | | |
|
||||
| > 卡信息 | | _nc_get_ipv4(const | 的所有 IPv4 地 | |
|
||||
| | | char\* nc) | | |
|
||||
| | | | > 址 | |
|
||||
+----------+------------+--------------------+--------------------+---+
|
||||
| | | > 参数说明 | > 返回值说明 | |
|
||||
+----------+------------+--------------------+--------------------+---+
|
||||
| | | nc:网卡名称, | char\*\* IPv4 | |
|
||||
| | | | 地址列 表, | |
|
||||
| | | > 如 eno1 | | |
|
||||
| | | | 以 NULL 表示结尾, | |
|
||||
| | | | 由 | |
|
||||
| | | | | |
|
||||
| | | | alloc 生 成 , 需 | |
|
||||
| | | | 要 被 | |
|
||||
| | | | | |
|
||||
| | | | kdk_nc_freeall 回 | |
|
||||
| | | | 收 ; 若 | |
|
||||
| | | | | |
|
||||
| | | | 获取出错,返回 | |
|
||||
| | | | NULL; | |
|
||||
+----------+------------+--------------------+--------------------+---+
|
||||
```
|
||||
| 子模块 | 编程语言 | 声明 | 描述 |
|
||||
|--------|------|-----------------------------------------------|----------------------------------------------------------------------|
|
||||
| 获取网卡信息 | C | extern char** kdk_nc_get_ipv4(const char* nc) | 获取指定网卡的所有IPv4地址 |
|
||||
| | | 参数说明 | 返回值说明 | |
|
||||
| | | nc:网卡名称,如eno1 | char** IPv4地址列表,以NULL表示结尾,由alloc生成,需要被kdk_nc_freeall回收;若获取出错,返回NULL; |
|
||||
|
||||
|
||||
|
||||
获取指定网卡的第一个 IPv6 地址
|
||||
|
||||
|
||||
```
|
||||
+----------+------------+--------------------+------------------+---+
|
||||
| > 子模块 | > 编程语言 | 声明 | > 描述 | |
|
||||
+==========+============+====================+==================+===+
|
||||
| 获 取 网 | C | extern char\* | 获 取 指定 网 卡 | |
|
||||
| | | kdk_nc_get_ | | |
|
||||
| > 卡信息 | | private_ipv6(const | 的 第 一 个 IPv6 | |
|
||||
| | | | | |
|
||||
| | | char \*nc) | > 地址 | |
|
||||
+----------+------------+--------------------+------------------+---+
|
||||
| | | > 参数说明 | > 返回值说明 | |
|
||||
+----------+------------+--------------------+------------------+---+
|
||||
```
|
||||
|
||||
|
||||
|
||||
```
|
||||
+---+---+----------------+--------------------------+---+
|
||||
| | | nc:网卡名称, | char\* IPv6 地址,获取出 | |
|
||||
| | | | | |
|
||||
| | | > 如 eno1 | > 错或无 IP 返回 NULL | |
|
||||
+---+---+----------------+--------------------------+---+
|
||||
```
|
||||
| 子模块 | 编程语言 | 声明 | 描述 |
|
||||
|--------|------|------------------------------------------------------|-----------------------------|
|
||||
| 获取网卡信息 | C | extern char* kdk_nc_get_private_ipv6(const char *nc) | 获取指定网卡的第一个IPv6地址 |
|
||||
| | | 参数说明 | 返回值说明 | |
|
||||
| | | nc:网卡名称,如eno1 | char* IPv6地址,获取出错或无IP返回NULL |
|
||||
|
||||
|
||||
获取指定网卡的所有 IPv6 地址
|
||||
|
||||
| 子模块 | 编程语言 | 声明 | 描述 |
|
||||
|--------|------|-----------------------------------------------|----------------------------------------------------------------------|
|
||||
| 获取网卡信息 | C | extern char** kdk_nc_get_ipv6(const char *nc) | 获取指定网卡的所有IPv6地址 |
|
||||
| | | 参数说明 | 返回值说明 | |
|
||||
| | | nc:网卡名称,如eno1 | char** IPv6地址列表,以NULL表示结尾,由alloc生成,需要被kdk_nc_freeall回收;若获取出错,返回NULL; |
|
||||
|
||||
```
|
||||
+----------+------------+--------------------+--------------------+---+
|
||||
| > 子模块 | > 编程语言 | 声明 | > 描述 | |
|
||||
+==========+============+====================+====================+===+
|
||||
| 获 取 网 | C | extern char\*\* | 获 取 指定 网 卡 | |
|
||||
| | | kdk | | |
|
||||
| > 卡信息 | | _nc_get_ipv6(const | 的所有 IPv6 地 | |
|
||||
| | | char \*nc) | | |
|
||||
| | | | > 址 | |
|
||||
+----------+------------+--------------------+--------------------+---+
|
||||
| | | > 参数说明 | > 返回值说明 | |
|
||||
+----------+------------+--------------------+--------------------+---+
|
||||
| | | nc:网卡名称, | char\*\* IPv6 地 | |
|
||||
| | | | 址 列 表 , | |
|
||||
| | | > 如 eno1 | | |
|
||||
| | | | 以 NULL 表示 | |
|
||||
| | | | 结尾, 由 | |
|
||||
| | | | | |
|
||||
| | | | alloc 生 成 , 需 | |
|
||||
| | | | 要 被 | |
|
||||
| | | | | |
|
||||
| | | | kdk_nc_freeall 回 | |
|
||||
| | | | 收 ; 若 | |
|
||||
| | | | | |
|
||||
| | | | > 获取出错,返回 | |
|
||||
| | | | > NULL; | |
|
||||
+----------+------------+--------------------+--------------------+---+
|
||||
```
|
||||
|
||||
|
||||
获取指定网卡的有线/无线类型
|
||||
|
||||
|
||||
```
|
||||
| 子模块 | 编程语言 | 声明 | 描述 |
|
||||
|--------|------|------------------------------------------------|----------------|
|
||||
| 获取网卡信息 | C | extern int kdk_nc_is_wireless(const char *nc); | 获取指定网卡的有线/无线类型 |
|
||||
| | | 参数说明 | 返回值说明 | |
|
||||
| | | nc:网卡名称,如eno1 | 0 : 有线 |
|
||||
| 1 : 无线 |
|
||||
|
||||
+----------+------------+--------------------+------------------+---+
|
||||
| > 子模块 | > 编程语言 | 声明 | > 描述 | |
|
||||
+==========+============+====================+==================+===+
|
||||
| 获 取 网 | C | extern int | 获 取 指定 网 卡 | |
|
||||
| | | kdk_nc | | |
|
||||
| > 卡信息 | | _is_wireless(const | 的有线/无线类 | |
|
||||
| | | char \*nc); | | |
|
||||
| | | | > 型 | |
|
||||
+----------+------------+--------------------+------------------+---+
|
||||
| | | > 参数说明 | > 返回值说明 | |
|
||||
+----------+------------+--------------------+------------------+---+
|
||||
| | | nc:网卡名称, | > 0 : 有线 | |
|
||||
| | | | > | |
|
||||
| | | > 如 eno1 | > 1 : 无线 | |
|
||||
+----------+------------+--------------------+------------------+---+
|
||||
```
|
||||
|
||||
|
||||
获取指定网卡的厂商名称和设备型号
|
||||
|
||||
|
||||
```
|
||||
+----------+------------+--------------------+------------------+---+
|
||||
| > 子模块 | > 编程语言 | 声明 | > 描述 | |
|
||||
+==========+============+====================+==================+===+
|
||||
| 获 取 网 | C | extern int | 获 取 指定 网 卡 | |
|
||||
| | | | | |
|
||||
| > 卡信息 | | kdk_nc_get_vendor | 的 厂 商 名称 和 | |
|
||||
| | | _and_product(const | | |
|
||||
| | | char | > 设备型号 | |
|
||||
| | | | | |
|
||||
| | | \*nc, char | | |
|
||||
| | | \*vendor, char | | |
|
||||
| | | \*product); | | |
|
||||
+----------+------------+--------------------+------------------+---+
|
||||
| | | > 参数说明 | > 返回值说明 | |
|
||||
+----------+------------+--------------------+------------------+---+
|
||||
| | | nc:网卡名称, | > 0 : 成功 | |
|
||||
| | | | > | |
|
||||
| | | > 如 eno1 | > 1 : 失败 | |
|
||||
| | | | | |
|
||||
| | | vendor : 接 受 厂 | | |
|
||||
| | | | | |
|
||||
| | | > 商名称的缓冲区 | | |
|
||||
| | | | | |
|
||||
| | | product:接受设 | | |
|
||||
| | | | | |
|
||||
| | | > 备型号的缓冲区 | | |
|
||||
+----------+------------+--------------------+------------------+---+
|
||||
```
|
||||
| 子模块 | 编程语言 | 声明 | 描述 |
|
||||
|--------------------|--------|----------------------------------------------------------------------------------------|------------------|
|
||||
| 获取网卡信息 | C | extern int kdk_nc_get_vendor_and_product(const char *nc, char *vendor, char *product); | 获取指定网卡的厂商名称和设备型号 |
|
||||
| | | 参数说明 | 返回值说明 | |
|
||||
| | | nc:网卡名称,如eno1 |
|
||||
| vendor:接受厂商名称的缓冲区 |
|
||||
| product:接受设备型号的缓冲区 | 0 : 成功 |
|
||||
| 1 : 失败 |
|
||||
|
||||
|
||||
回收字符串列表
|
||||
|
||||
| 子模块 | 编程语言 | 声明 | 描述 |
|
||||
|--------|------|-----------------------------------------------|---------|
|
||||
| 获取网卡信息 | C | extern inline void kdk_nc_freeall(char **ptr) | 回收字符串列表 |
|
||||
| | | 参数说明 | 返回值说明 | |
|
||||
| | | ptr:字符串列表 | 无 |
|
||||
|
||||
```
|
||||
+----------+------------+--------------------+------------------+---+
|
||||
| > 子模块 | > 编程语言 | 声明 | > 描述 | |
|
||||
+==========+============+====================+==================+===+
|
||||
| 获 取 网 | C | extern inline void | 回 收 字符 串 列 | |
|
||||
| | | k | | |
|
||||
| > 卡信息 | | dk_nc_freeall(char | > 表 | |
|
||||
| | | \*\*ptr) | | |
|
||||
+----------+------------+--------------------+------------------+---+
|
||||
| | | > 参数说明 | > 返回值说明 | |
|
||||
+----------+------------+--------------------+------------------+---+
|
||||
| | | > ptr:字符串列表 | > 无 | |
|
||||
+----------+------------+--------------------+------------------+---+
|
||||
```
|
||||
|
||||
|
||||
#### **3.1.2.3** 获取磁盘信息
|
||||
|
|
Loading…
Reference in New Issue