IP、TCP 和 VLAN 结构

发布于 2024-10-22 03:10:56 字数 502 浏览 8 评论 0原文

我最近继承了一个近 7 年历史的代码库,其中包括一个带有公共标头的库,其中包含 IP、TCP、VLAN 结构的定义和一大堆定义(例如 #define TCP_NODELAY 1)。

我试图寻找这些结构的头文件,但我找不到任何东西(这在 Linux 上是主要的,但也有各种 BSD 变体)。当然已经有这个的标题了吗?

我认为 net/ethernet.h 对所有定义都有帮助。

编辑:找到了我正在寻找的大部分结构:
netinet/tcp.h中的struct tcphdr
netinet/udp.h中的struct udphdr
netinet/ip.h 中的 struct ip

有谁知道带有 vlan-header 的结构吗? (以太 VLAN 标头?)

I've recently inherited an almost 7 year old codebase, including a library with public headers with definitions of IP-, TCP, VLAN-structs and a shitload of defines (like #define TCP_NODELAY 1).

I tried to look for headers with these structs but I couldn't find anything (this is primary on linux, but also various BSD-variants). Surely there must be headers for this already?

I think net/ethernet.h helped with all the defines.

EDIT: Found most of the structs I'm looking for:
struct tcphdr in netinet/tcp.h
struct udphdr in netinet/udp.h
struct ip in netinet/ip.h

Does anyone have any clue about a struct with the vlan-header? (ether_vlan_header?)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

温柔戏命师 2024-10-29 03:10:56

尝试

find /usr/include -type f | xargs grep TCP_NODELAY

其中 TCP_NODELAY 是您要查找的符号。

您可以通过将所有符号写入文件(每行一个)并使用 grep -f FILE 来同时查找所有符号。

Try

find /usr/include -type f | xargs grep TCP_NODELAY

where TCP_NODELAY is the symbol you're looking for.

You can look for all symbols at the same time by writing them to a file (one per line), and using grep -f FILE.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文