Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
Updated example code to Julia 1.0 compatibility and correct IP header checksum output.
  • Loading branch information
zak21rs authored Oct 18, 2018
1 parent 218501b commit 64f469c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,23 @@ function display_ip_hdr(iphdr::IpHdr)
println(" |- Protocol : $(iphdr.protocol)")
println(" |- Src Ip : $(iphdr.src_ip)")
println(" |- Dest Ip : $(iphdr.dest_ip)")
println(" |- Checksum : 0x$(hex(iphdr.checksum,4))")
println(" |- Checksum : $(iphdr.checksum)")
end # function display_ip_hdr

function display_udp_hdr(udphdr::UdpHdr)
println("UDP Header")
println(" |- Src Port : $(udphdr.src_port)")
println(" |- Dest Port : $(udphdr.dest_port)")
println(" |- Length : $(udphdr.length)")
println(" |- Checksum : 0x$(hex(udphdr.checksum, 4))")
println(" |- Checksum : 0x$(string(udphdr.checksum, base = 16, pad = 4))")
print(" |- Data : ")

n = 0
for byte = udphdr.data
if n % 16 == 0 && n != 0
print("\n ")
end
print("$(hex(byte, 2)) ")
print("$(string(byte, base = 16, pad = 2)) ")
n = n + 1
end
end # function display_udp_hdr
Expand Down Expand Up @@ -74,7 +74,7 @@ IP Header
|- Protocol : 17
|- Src Ip : 192.168.0.51
|- Dest Ip : 192.168.0.1
|- Checksum : 0x67ca
|- Checksum : true
UDP Header
|- Src Port : 34904
|- Dest Port : 53
Expand Down

0 comments on commit 64f469c

Please sign in to comment.