\doxysection{Device\+Pinger.\+h}
\hypertarget{a00377_source}{}\label{a00377_source}\index{DevicePinger.h@{DevicePinger.h}}

\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{preprocessor}{\#pragma\ once}}
\DoxyCodeLine{00002\ \textcolor{preprocessor}{\#include\ <winsock2.h>}}
\DoxyCodeLine{00003\ \textcolor{preprocessor}{\#include\ <ws2tcpip.h>}}
\DoxyCodeLine{00004\ \textcolor{preprocessor}{\#include\ <stdio.h>}}
\DoxyCodeLine{00005\ \textcolor{preprocessor}{\#include\ <stdlib.h>}}
\DoxyCodeLine{00006\ \textcolor{preprocessor}{\#include<string>};}
\DoxyCodeLine{00007\ }
\DoxyCodeLine{00008\ \textcolor{preprocessor}{\#include\ "{}iphdr.h"{}}}
\DoxyCodeLine{00009\ }
\DoxyCodeLine{00010\ \textcolor{preprocessor}{\#ifdef\ STARFLEETTOOLBOX\_EXPORTS}}
\DoxyCodeLine{00011\ \textcolor{preprocessor}{\#define\ ETHDEVICEPINGER\ \_\_declspec(dllexport)}}
\DoxyCodeLine{00012\ \textcolor{preprocessor}{\#else}}
\DoxyCodeLine{00013\ \textcolor{preprocessor}{\#define\ ETHDEVICEPINGER\ \_\_declspec(dllimport)}}
\DoxyCodeLine{00014\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00015\ }
\DoxyCodeLine{00016\ \textcolor{preprocessor}{\#define\ DEFAULT\_DATA\_SIZE\ \ \ \ \ \ \ 32\ \ \ \ \ \ \ }\textcolor{comment}{//\ default\ data\ size}}
\DoxyCodeLine{00017\ \textcolor{preprocessor}{\#define\ DEFAULT\_SEND\_COUNT\ \ \ \ \ \ 4\ \ \ \ \ \ \ \ }\textcolor{comment}{//\ number\ of\ ICMP\ requests\ to\ send}}
\DoxyCodeLine{00018\ \textcolor{preprocessor}{\#define\ DEFAULT\_RECV\_TIMEOUT\ \ \ \ 1000\ \ \ \ \ }\textcolor{comment}{//\ one\ second}}
\DoxyCodeLine{00019\ \textcolor{preprocessor}{\#define\ DEFAULT\_TTL\ \ \ \ \ \ \ \ \ \ \ \ \ 128}}
\DoxyCodeLine{00020\ \textcolor{preprocessor}{\#define\ MAX\_RECV\_BUF\_LEN\ \ \ \ \ \ \ \ 0xFFFF\ \ \ }\textcolor{comment}{//\ Max\ incoming\ packet\ size.}}
\DoxyCodeLine{00021\ \textcolor{preprocessor}{\#define\ PING\_SLEEP\ \ \ \ \ \ \ \ \ \ \ \ \ \ 250\ \ \ \ \ }\textcolor{comment}{//\ sleep\ between\ ping}}
\DoxyCodeLine{00022\ }
\DoxyCodeLine{00023\ \textcolor{keyword}{using\ namespace\ }std;}
\DoxyCodeLine{00024\ }
\DoxyCodeLine{00028\ \textcolor{keyword}{class\ }ETHDEVICEPINGER\ \mbox{\hyperlink{a00868}{DevicePinger}}}
\DoxyCodeLine{00029\ \{}
\DoxyCodeLine{00030\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00034\ \ \ \ \ \mbox{\hyperlink{a00868}{DevicePinger}}();}
\DoxyCodeLine{00035\ }
\DoxyCodeLine{00040\ \ \ \ \ \mbox{\hyperlink{a00868}{DevicePinger}}(\textcolor{keywordtype}{string}\ address);}
\DoxyCodeLine{00041\ }
\DoxyCodeLine{00047\ \ \ \ \ \mbox{\hyperlink{a00868}{DevicePinger}}(\textcolor{keywordtype}{string}\ address,\ \textcolor{keywordtype}{int}\ timeout);}
\DoxyCodeLine{00048\ }
\DoxyCodeLine{00053\ \ \ \ \ \textcolor{keywordtype}{void}\ SetAddress(\textcolor{keywordtype}{string}\ address);}
\DoxyCodeLine{00054\ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00055\ }
\DoxyCodeLine{00060\ \ \ \ \ \mbox{\hyperlink{a00884}{PING\_RESULT}}\ Ping();}
\DoxyCodeLine{00061\ }
\DoxyCodeLine{00062\ }
\DoxyCodeLine{00068\ \ \ \ \ \mbox{\hyperlink{a00884}{PING\_RESULT}}\ Ping(\textcolor{keywordtype}{int}\ packetAmount);}
\DoxyCodeLine{00069\ }
\DoxyCodeLine{00070\ \textcolor{keyword}{private}:}
\DoxyCodeLine{00071\ \ \ \ \ SOCKET\ \ \_s\ =\ INVALID\_SOCKET;}
\DoxyCodeLine{00072\ \ \ \ \ WSAOVERLAPPED\ \_recvol;}
\DoxyCodeLine{00073\ \ \ \ \ \textcolor{keywordtype}{char}*\ \_icmpbuf\ =\ NULL;}
\DoxyCodeLine{00074\ \ \ \ \ \textcolor{keywordtype}{int}\ \_packetlen\ =\ 0;}
\DoxyCodeLine{00075\ \ \ \ \ \textcolor{keywordtype}{int}\ \_receiveTimeOut\ =\ DEFAULT\_RECV\_TIMEOUT;}
\DoxyCodeLine{00076\ \ \ \ \ \textcolor{keyword}{struct\ }addrinfo*\ \_dest\ =\ NULL;}
\DoxyCodeLine{00077\ }
\DoxyCodeLine{00078\ }
\DoxyCodeLine{00079\ \ \ \ \ \textcolor{keywordtype}{int}\ \ \ \ \ \_addressFamily\ =\ AF\_INET,\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00080\ \ \ \ \ \ \ \ \ \ \ \ \ \_protocol\ =\ IPPROTO\_ICMP,\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00081\ \ \ \ \ \ \ \ \ \ \ \ \ \_ttl\ =\ DEFAULT\_TTL;\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00082\ \ \ \ \ \textcolor{keywordtype}{int}\ \ \ \ \ \_dataSize\ =\ DEFAULT\_DATA\_SIZE;\ \ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00083\ \ \ \ \ BOOL\ \ \ \ \_recordRoute\ =\ FALSE;\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00084\ \ \ \ \ \textcolor{keywordtype}{char}*\ \ \ \_destination\ =\ NULL,\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00085\ \ \ \ \ \ \ \ \ \ \ \ \ \_recvbuf[MAX\_RECV\_BUF\_LEN];\ \ \ \ \ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00086\ \ \ \ \ \textcolor{keywordtype}{int}\ \ \ \ \ \_recvbuflen\ =\ MAX\_RECV\_BUF\_LEN;\ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00087\ \ \ \ \ \textcolor{keywordtype}{char}\ \_lastKnownIp[100];\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00091\ \ \ \ \ \textcolor{keywordtype}{bool}\ Initialize();}
\DoxyCodeLine{00092\ }
\DoxyCodeLine{00098\ \ \ \ \ \textcolor{keywordtype}{void}\ InitIcmpHeader(\textcolor{keywordtype}{char}*\ buf,\ \textcolor{keywordtype}{int}\ datasize);}
\DoxyCodeLine{00099\ }
\DoxyCodeLine{00106\ \ \ \ \ USHORT\ Checksum(USHORT*\ buffer,\ \textcolor{keywordtype}{int}\ size);}
\DoxyCodeLine{00107\ }
\DoxyCodeLine{00111\ \ \ \ \ \textcolor{keywordtype}{void}\ \ SetIcmpSequence(\textcolor{keywordtype}{char}*\ buf);}
\DoxyCodeLine{00112\ }
\DoxyCodeLine{00125\ \ \ \ \ \textcolor{keywordtype}{void}\ ComputeIcmpChecksum(SOCKET\ s,\ \textcolor{keywordtype}{char}*\ buf,\ \textcolor{keywordtype}{int}\ packetlen,\ \textcolor{keyword}{struct}\ addrinfo*\ dest);}
\DoxyCodeLine{00126\ }
\DoxyCodeLine{00137\ \ \ \ \ \textcolor{keywordtype}{int}\ PostRecvfrom(SOCKET\ s,\ \textcolor{keywordtype}{char}*\ buf,\ \textcolor{keywordtype}{int}\ buflen,\ SOCKADDR*\ from,\ \textcolor{keywordtype}{int}*\ fromlen,\ WSAOVERLAPPED*\ ol);}
\DoxyCodeLine{00138\ }
\DoxyCodeLine{00145\ \ \ \ \ \textcolor{keywordtype}{int}\ SetTtl(SOCKET\ s,\ \textcolor{keywordtype}{int}\ ttl);}
\DoxyCodeLine{00146\ }
\DoxyCodeLine{00159\ \ \ \ \ \textcolor{keyword}{struct\ }addrinfo*\ ResolveAddress(\textcolor{keywordtype}{char}*\ addr,\ \textcolor{keywordtype}{char}*\ port,\ \textcolor{keywordtype}{int}\ af,\ \textcolor{keywordtype}{int}\ type,\ \textcolor{keywordtype}{int}\ proto);}
\DoxyCodeLine{00160\ \};}
\DoxyCodeLine{00161\ }

\end{DoxyCode}
