Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/61.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C 识别inet数据包头_C_Sockets_Packet - Fatal编程技术网

C 识别inet数据包头

C 识别inet数据包头,c,sockets,packet,C,Sockets,Packet,以身作则 switch(ether_type) case 0x800: //ip header next switch (ip_Protocol) case 6: // tcp header next switch tcp_dst_or_src_port: case 80: // http header next so what

以身作则

switch(ether_type)
    case 0x800: //ip header next
        switch (ip_Protocol)
            case 6: // tcp header next
                switch tcp_dst_or_src_port:
                    case 80: // http header next
                        so what tells me now whats next ??
刚刚发现在案例80的这个例子中,“content_type”字段会告诉我下一步是什么。。比如jpeg或者别的什么

有时我会在wireshark的http上看到3或2个其他头

一般的问题是,总是可以识别每个报头,例如udp或tcp上的报头

我想制作一个类似于这个开关盒示例的应用程序。。从乙醚总管开始


好的,这又不是http或特定的协议,我想知道我是否可以用类似于那个例子的方法,使用交换机和memcmp等每个协议,在下一个和下一个上下一个地工作。

你的问题是什么?是的,TCP端口80通信通常是HTTP。虽然下层是非常确定的,上层Wireshark解析器通常使用模糊启发式来确定如何解析数据。。。我的意思是我刚刚发现在http->“content-type”中,http头是文本。Jonathon Reinhart刚刚找到内容类型字段,它是ascii文本,因此下一个字段是ex.strcmp(http\u conten\u type,“image/png\r\n”)这也是我想知道的,请你删除这个问题