\doxysection{iphdr.\+h}
\hypertarget{a00374_source}{}\label{a00374_source}\index{iphdr.h@{iphdr.h}}

\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{preprocessor}{\#include\ <pshpack1.h>}}
\DoxyCodeLine{00002\ }
\DoxyCodeLine{00003\ \textcolor{comment}{//\ Ping\ result}}
\DoxyCodeLine{00004\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct\ }\mbox{\hyperlink{a00844}{ping\_result}}}
\DoxyCodeLine{00005\ \{}
\DoxyCodeLine{00006\ \ \ \ \ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{a00844_a71711c9a8f8e5276f2ed4e707e46c63d}{success}};}
\DoxyCodeLine{00007\ \ \ \ \ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{a00844_a0fbcab82de3176a595c28352ee235750}{failed}};}
\DoxyCodeLine{00008\ \ \ \ \ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{a00844_a0cd17a49452108c2337e40aa53449d8e}{timeout}};}
\DoxyCodeLine{00009\ \}\ \mbox{\hyperlink{a00844}{PING\_RESULT}};}
\DoxyCodeLine{00010\ }
\DoxyCodeLine{00011\ \textcolor{comment}{//\ IPv4\ header}}
\DoxyCodeLine{00012\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct\ }\mbox{\hyperlink{a00848}{ip\_hdr}}}
\DoxyCodeLine{00013\ \{}
\DoxyCodeLine{00014\ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{char}\ \ \mbox{\hyperlink{a00848_a89b17cf57345b98f76ed1f5802e1be46}{ip\_verlen}};\ \ \ \ \ \ \ \ \textcolor{comment}{//\ 4-\/bit\ IPv4\ version}}
\DoxyCodeLine{00015\ \ \ \ \ \textcolor{comment}{//\ 4-\/bit\ header\ length\ (in\ 32-\/bit\ words)}}
\DoxyCodeLine{00016\ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{char}\ \ \mbox{\hyperlink{a00848_af50662ba23d9f6c2b0d00532e828d39d}{ip\_tos}};\ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ IP\ type\ of\ service}}
\DoxyCodeLine{00017\ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{short}\ \mbox{\hyperlink{a00848_a22464d852d064491ebb3cf42482a76fa}{ip\_totallength}};\ \ \ \textcolor{comment}{//\ Total\ length}}
\DoxyCodeLine{00018\ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{short}\ \mbox{\hyperlink{a00848_a4eda327cff29c1dddb471b5a9d07580b}{ip\_id}};\ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Unique\ identifier\ }}
\DoxyCodeLine{00019\ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{short}\ \mbox{\hyperlink{a00848_a27716c04b3248dd96cf50b43c1a20320}{ip\_offset}};\ \ \ \ \ \ \ \ \textcolor{comment}{//\ Fragment\ offset\ field}}
\DoxyCodeLine{00020\ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{char}\ \ \mbox{\hyperlink{a00848_af5bbc5a58545da2185f62dfc171bec7b}{ip\_ttl}};\ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Time\ to\ live}}
\DoxyCodeLine{00021\ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{char}\ \ \mbox{\hyperlink{a00848_a1c44fef80331a7e6450df1527fc85df9}{ip\_protocol}};\ \ \ \ \ \ \textcolor{comment}{//\ Protocol(TCP,UDP\ etc)}}
\DoxyCodeLine{00022\ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{short}\ \mbox{\hyperlink{a00848_abc1ee3f70a6d9b45823b34db2725b6f6}{ip\_checksum}};\ \ \ \ \ \ \textcolor{comment}{//\ IP\ checksum}}
\DoxyCodeLine{00023\ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{int}\ \ \ \mbox{\hyperlink{a00848_a9a476bbb0189de9904f5a84ad66d092c}{ip\_srcaddr}};\ \ \ \ \ \ \ \textcolor{comment}{//\ Source\ address}}
\DoxyCodeLine{00024\ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{int}\ \ \ \mbox{\hyperlink{a00848_ada1906244f30da3226eb76b15c6b334a}{ip\_destaddr}};\ \ \ \ \ \ \textcolor{comment}{//\ Source\ address}}
\DoxyCodeLine{00025\ \}\ \mbox{\hyperlink{a00848}{IPV4\_HDR}},\ *\ \mbox{\hyperlink{a00848}{PIPV4\_HDR}},\ FAR*\ \mbox{\hyperlink{a00848}{LPIPV4\_HDR}};}
\DoxyCodeLine{00026\ }
\DoxyCodeLine{00027\ \textcolor{comment}{//\ IPv4\ option\ header}}
\DoxyCodeLine{00028\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct\ }\mbox{\hyperlink{a00852}{ipv4\_option\_hdr}}}
\DoxyCodeLine{00029\ \{}
\DoxyCodeLine{00030\ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{char}\ \ \ \mbox{\hyperlink{a00852_aa7a3cd489ecd397767983916fb448499}{opt\_code}};\ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ option\ type}}
\DoxyCodeLine{00031\ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{char}\ \ \ \mbox{\hyperlink{a00852_a1347779c5ca8ea88086c268730801970}{opt\_len}};\ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ length\ of\ the\ option\ header}}
\DoxyCodeLine{00032\ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{char}\ \ \ \mbox{\hyperlink{a00852_a914fb8226df4ca8a4b37b6bc4d2a492b}{opt\_ptr}};\ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ offset\ into\ options}}
\DoxyCodeLine{00033\ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{long}\ \ \ \mbox{\hyperlink{a00852_a8f5c2c4abcc058bd4aaaee0996abcb96}{opt\_addr}}[9];\ \ \ \ \ \ \ \ \textcolor{comment}{//\ list\ of\ IPv4\ addresses}}
\DoxyCodeLine{00034\ \}\ \mbox{\hyperlink{a00852}{IPV4\_OPTION\_HDR}},\ *\ \mbox{\hyperlink{a00852}{PIPV4\_OPTION\_HDR}},\ FAR*\ \mbox{\hyperlink{a00852}{LPIPV4\_OPTION\_HDR}};}
\DoxyCodeLine{00035\ }
\DoxyCodeLine{00036\ \textcolor{comment}{//\ ICMP\ header}}
\DoxyCodeLine{00037\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct\ }\mbox{\hyperlink{a00856}{icmp\_hdr}}}
\DoxyCodeLine{00038\ \{}
\DoxyCodeLine{00039\ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{char}\ \ \ \mbox{\hyperlink{a00856_a3dcc70a57f1773ef07bfa429ef28562b}{icmp\_type}};}
\DoxyCodeLine{00040\ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{char}\ \ \ \mbox{\hyperlink{a00856_a6b33b4b417875378240058a381028ed7}{icmp\_code}};}
\DoxyCodeLine{00041\ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{short}\ \ \mbox{\hyperlink{a00856_a0ed19760a4328967471f35b0e7057641}{icmp\_checksum}};}
\DoxyCodeLine{00042\ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{short}\ \ \mbox{\hyperlink{a00856_a8f01703f3952d8d09db7ee859ecd0361}{icmp\_id}};}
\DoxyCodeLine{00043\ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{short}\ \ \mbox{\hyperlink{a00856_aaf65b7bf54d999916a455e927ee8d1a5}{icmp\_sequence}};}
\DoxyCodeLine{00044\ \}\ \mbox{\hyperlink{a00856}{ICMP\_HDR}},\ *\ \mbox{\hyperlink{a00856}{PICMP\_HDR}},\ FAR*\ \mbox{\hyperlink{a00856}{LPICMP\_HDR}};}
\DoxyCodeLine{00045\ }
\DoxyCodeLine{00046\ \textcolor{comment}{//\ IPv6\ protocol\ header}}
\DoxyCodeLine{00047\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct\ }\mbox{\hyperlink{a00860}{ipv6\_hdr}}}
\DoxyCodeLine{00048\ \{}
\DoxyCodeLine{00049\ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{long}\ \ \ \mbox{\hyperlink{a00860_a1dc423f01e97d14624bba4dbe1e20d67}{ipv6\_vertcflow}};\ \ \ \ \ \ \ \ \textcolor{comment}{//\ 4-\/bit\ IPv6\ version}}
\DoxyCodeLine{00050\ \ \ \ \ \textcolor{comment}{//\ 8-\/bit\ traffic\ class}}
\DoxyCodeLine{00051\ \ \ \ \ \textcolor{comment}{//\ 20-\/bit\ flow\ label}}
\DoxyCodeLine{00052\ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{short}\ \ \mbox{\hyperlink{a00860_a0e4d8c410be654ad03996eb5d4583ef1}{ipv6\_payloadlen}};\ \ \ \ \ \ \ \textcolor{comment}{//\ payload\ length}}
\DoxyCodeLine{00053\ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{char}\ \ \ \mbox{\hyperlink{a00860_a17831797428ae4433c5788aa8c632a52}{ipv6\_nexthdr}};\ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ next\ header\ protocol\ value}}
\DoxyCodeLine{00054\ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{char}\ \ \ \mbox{\hyperlink{a00860_ab5c83a05d2e86bbca07a2a9e3daf5b2d}{ipv6\_hoplimit}};\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ TTL\ }}
\DoxyCodeLine{00055\ \ \ \ \ \textcolor{keyword}{struct\ }in6\_addr\ \mbox{\hyperlink{a00860_a90454d2c1cd7e0c01e899e8a994a1649}{ipv6\_srcaddr}};\ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Source\ address}}
\DoxyCodeLine{00056\ \ \ \ \ \textcolor{keyword}{struct\ }in6\_addr\ \mbox{\hyperlink{a00860_adf720b8e9803c331ab1210617f020089}{ipv6\_destaddr}};\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Destination\ address}}
\DoxyCodeLine{00057\ \}\ \mbox{\hyperlink{a00860}{IPV6\_HDR}},\ *\ \mbox{\hyperlink{a00860}{PIPV6\_HDR}},\ FAR*\ \mbox{\hyperlink{a00860}{LPIPV6\_HDR}};}
\DoxyCodeLine{00058\ }
\DoxyCodeLine{00059\ \textcolor{comment}{//\ IPv6\ fragment\ header}}
\DoxyCodeLine{00060\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct\ }\mbox{\hyperlink{a00864}{ipv6\_fragment\_hdr}}}
\DoxyCodeLine{00061\ \{}
\DoxyCodeLine{00062\ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{char}\ \ \ \mbox{\hyperlink{a00864_a262d1e64982adb6f1a0b12c13ef4b0e3}{ipv6\_frag\_nexthdr}};}
\DoxyCodeLine{00063\ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{char}\ \ \ \mbox{\hyperlink{a00864_af5bca09a2913f66b9154a6cf761b0c91}{ipv6\_frag\_reserved}};}
\DoxyCodeLine{00064\ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{short}\ \ \mbox{\hyperlink{a00864_a64c43c443ab775e2f1f8d2a6a5fd335f}{ipv6\_frag\_offset}};}
\DoxyCodeLine{00065\ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{long}\ \ \ \mbox{\hyperlink{a00864_a5f23887b63ff12ab8bc8e1f781630643}{ipv6\_frag\_id}};}
\DoxyCodeLine{00066\ \}\ \mbox{\hyperlink{a00864}{IPV6\_FRAGMENT\_HDR}},\ *\ \mbox{\hyperlink{a00864}{PIPV6\_FRAGMENT\_HDR}},\ FAR*\ \mbox{\hyperlink{a00864}{LPIPV6\_FRAGMENT\_HDR}};}
\DoxyCodeLine{00067\ }
\DoxyCodeLine{00068\ \textcolor{comment}{//\ ICMPv6\ header}}
\DoxyCodeLine{00069\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct\ }\mbox{\hyperlink{a00868}{icmpv6\_hdr}}\ \{}
\DoxyCodeLine{00070\ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{char}\ \ \ \mbox{\hyperlink{a00868_a97f8b329a7494012d9733d1631862697}{icmp6\_type}};}
\DoxyCodeLine{00071\ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{char}\ \ \ \mbox{\hyperlink{a00868_af3e1434387932312291b8ba1c9967663}{icmp6\_code}};}
\DoxyCodeLine{00072\ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{short}\ \ \mbox{\hyperlink{a00868_aaf4020759596e4701d1887ec9d896172}{icmp6\_checksum}};}
\DoxyCodeLine{00073\ \}\ \mbox{\hyperlink{a00868}{ICMPV6\_HDR}};}
\DoxyCodeLine{00074\ }
\DoxyCodeLine{00075\ \textcolor{comment}{//\ ICMPv6\ echo\ request\ body}}
\DoxyCodeLine{00076\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct\ }\mbox{\hyperlink{a00872}{icmpv6\_echo\_request}}}
\DoxyCodeLine{00077\ \{}
\DoxyCodeLine{00078\ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{short}\ \ \mbox{\hyperlink{a00872_a13735745ec49c9f6bd14e47a6ec399fa}{icmp6\_echo\_id}};}
\DoxyCodeLine{00079\ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{short}\ \ \mbox{\hyperlink{a00872_ae47fd5482ef28b6bba9794e195f930da}{icmp6\_echo\_sequence}};}
\DoxyCodeLine{00080\ \}\ \mbox{\hyperlink{a00872}{ICMPV6\_ECHO\_REQUEST}};}
\DoxyCodeLine{00081\ }
\DoxyCodeLine{00082\ \textcolor{comment}{//\ Define\ the\ UDP\ header\ }}
\DoxyCodeLine{00083\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct\ }\mbox{\hyperlink{a00876}{udp\_hdr}}}
\DoxyCodeLine{00084\ \{}
\DoxyCodeLine{00085\ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{short}\ \mbox{\hyperlink{a00876_a9355643e87c58dcb244860e66a275519}{src\_portno}};\ \ \ \ \ \ \ \textcolor{comment}{//\ Source\ port\ no.}}
\DoxyCodeLine{00086\ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{short}\ \mbox{\hyperlink{a00876_abef3df6bc7ec471d6f06a353058f88fb}{dst\_portno}};\ \ \ \ \ \ \ \textcolor{comment}{//\ Dest.\ port\ no.}}
\DoxyCodeLine{00087\ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{short}\ \mbox{\hyperlink{a00876_af972b809a3a3af327e0065b206d5025e}{udp\_length}};\ \ \ \ \ \ \ \textcolor{comment}{//\ Udp\ packet\ length}}
\DoxyCodeLine{00088\ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{short}\ \mbox{\hyperlink{a00876_a0c9ef423a050af65120ae649e7b87cef}{udp\_checksum}};\ \ \ \ \ \textcolor{comment}{//\ Udp\ checksum\ (optional)}}
\DoxyCodeLine{00089\ \}\ \mbox{\hyperlink{a00876}{UDP\_HDR}},\ *\ \mbox{\hyperlink{a00876}{PUDP\_HDR}};}
\DoxyCodeLine{00090\ }
\DoxyCodeLine{00091\ \textcolor{comment}{//\ IPv4\ option\ for\ record\ route}}
\DoxyCodeLine{00092\ \textcolor{preprocessor}{\#define\ IP\_RECORD\_ROUTE\ \ \ \ \ 0x7}}
\DoxyCodeLine{00093\ }
\DoxyCodeLine{00094\ \textcolor{comment}{//\ ICMP6\ protocol\ value\ (used\ in\ the\ socket\ call\ and\ IPv6\ header)}}
\DoxyCodeLine{00095\ \textcolor{preprocessor}{\#define\ IPPROTO\_ICMP6\ \ \ \ \ \ \ 58}}
\DoxyCodeLine{00096\ }
\DoxyCodeLine{00097\ \textcolor{comment}{//\ ICMP\ types\ and\ codes}}
\DoxyCodeLine{00098\ \textcolor{preprocessor}{\#define\ ICMPV4\_ECHO\_REQUEST\_TYPE\ \ \ 8}}
\DoxyCodeLine{00099\ \textcolor{preprocessor}{\#define\ ICMPV4\_ECHO\_REQUEST\_CODE\ \ \ 0}}
\DoxyCodeLine{00100\ \textcolor{preprocessor}{\#define\ ICMPV4\_ECHO\_REPLY\_TYPE\ \ \ \ \ 0}}
\DoxyCodeLine{00101\ \textcolor{preprocessor}{\#define\ ICMPV4\_ECHO\_REPLY\_CODE\ \ \ \ \ 0}}
\DoxyCodeLine{00102\ \textcolor{preprocessor}{\#define\ ICMPV4\_MINIMUM\_HEADER\ \ \ \ \ \ 8}}
\DoxyCodeLine{00103\ }
\DoxyCodeLine{00104\ \textcolor{comment}{//\ ICPM6\ types\ and\ codes}}
\DoxyCodeLine{00105\ \textcolor{preprocessor}{\#define\ ICMPV6\_ECHO\_REQUEST\_TYPE\ \ \ 128}}
\DoxyCodeLine{00106\ \textcolor{preprocessor}{\#define\ ICMPV6\_ECHO\_REQUEST\_CODE\ \ \ 0}}
\DoxyCodeLine{00107\ \textcolor{preprocessor}{\#define\ ICMPV6\_ECHO\_REPLY\_TYPE\ \ \ \ \ 129}}
\DoxyCodeLine{00108\ \textcolor{preprocessor}{\#define\ ICMPV6\_ECHO\_REPLY\_CODE\ \ \ \ \ 0}}
\DoxyCodeLine{00109\ }
\DoxyCodeLine{00110\ \textcolor{comment}{//\ Restore\ byte\ alignment\ back\ to\ default}}
\DoxyCodeLine{00111\ \textcolor{preprocessor}{\#include\ <poppack.h>}}

\end{DoxyCode}
