学会计论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
热搜: 会计 考试 培训
查看: 787|回复: 0
打印 上一主题 下一主题

UDP包格式問题

[复制链接]
跳转到指定楼层
楼主
发表于 2020-3-11 19:03:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
    eth_array(1)<=dst_mac_addr(15downto0问题:首先发送6个字节的目的MAC地址及6个字节的源MAC地址,接着x"Version/Headerlength|diffServices,但是



大家好,我在利用verilog做以太网通信,封装UDP包时,不理解什么意思,下面是其中一段程序:
ethernet_data_process : process(c3_rst0,clk_50mhz)

begin

Tx_mac_BE <= "00";



-- UDP packet

eth_array(0) <= dst_mac_addr(47 downto 16);--要發送的目的MAC地址高4个字节

eth_array(1) <= dst_mac_addr(15 downto 0) & mac_addr(47 downto 32);--要发送的目的MAC地址低2个字节&源MAC地址

eth_array(2) <= mac_addr(31 downto 0);--源MAC低4个字节

--  ethernet type    | Version / Header length | diff Services

eth_array(3) <= x"0800"          & "0100" & "0101"         & "00000000"    ;

-- total length        |  identification

eth_array(4) <= "00000000"&"00100010" & x"0000";

-- Flags , Fragment Offeset  | time to live | protocol

eth_array(5) <= "0100000000000000"          &  "01000000"  & "00010001";

-- header checksum |  Source IP:

eth_array(6) <= calc_checksum     &  own_ip_addr(31 downto 16);

--         
     |  Destin IP:

eth_array(7) <= own_ip_addr(15 downto 0) &  dst_ip_addr(31 downto 16);

--            
| source port

eth_array(8) <= dst_ip_addr(15 downto 0)  &  source_port ;

-- dest port | length

eth_array(9) <= dest_port   & "00000000" & "00001110" ;

-- checksum  |  data

eth_array(10) <= x"0000"    &  x"4865";

-- data

eth_array(11) <= x"6c6c6f20";


问题:首先发送6个字節的目的MAC地址及6個字節的源MAC地址,接著x"0800" 是IP協议類型,后面的"0100" & "0101"  & "00000000" 是什么意思呢,它上面一行倒是解释了好像是
Version / Header length | diff Services,但是我没找有关UDP包格式是这样的,接着下面一行的-- Flags , Fragment Offeset  | time to live | protocol,又是什么意思呢,没见过UDP格式的包是这种格式的,能不能提供一下UDP详细的包的格式,謝谢

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|联系我们|会计培训网

GMT+8, 2024-4-25 18:05 , Processed in 0.125000 second(s), 17 queries .

Powered by Discuz! X3

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表