开发者

Dns protocol header

开发者 https://www.devze.com 2022-12-10 16:22 出处:网络
I want to encode DNS protocol header using C and create a UDP datagram. Lets say I have a query www.google.com.

I want to encode DNS protocol header using C and create a UDP datagram. Lets say I have a query www.google.com.

Can anyone suggest how to go about it?

You can find the header form开发者_如何学Cat here - http://www.nersc.gov/~scottc/software/snort/dns_head.html


RFC 1035 explains the DNS packet format in full detail. Note that the format is designed to be as compact as possible, so there are a lot of bit- and byte-level optimisations that you will have to pay attention to. A proper, robust DNS encoder and decoder is not for the faint of heart.


+1 to RFC 1035. You can take a look on Wireshark: http://www.wireshark.org/ It shows packets in both - binary and decoded view + contains source code in C so you can check how decoding is implemented.

0

精彩评论

暂无评论...
验证码 换一张
取 消