Article View: borland.public.cppbuilder.internet.socket
Article #229Re: IP_OPT_RR and IcmpSendEcho() anybody how how?
From: Remy Lebeau (TeamB)
Date: Thu, 19 Jun 2008 16:42
Date: Thu, 19 Jun 2008 16:42
70 lines
2741 bytes
2741 bytes
"DreamChaser" <NO-Spam@No-Span.net> wrote in message
news:4859f37d@newsgroups.borland.com...
> How do I make this work?
Have you looked at Microsoft's examples yet? Have you read RFC 791 yet?
> I've spent HOURS on the net and every search I do only
> comes up with the thousands of #define IP_OPT_RR 0x7
> references but nothing on how to use it.
For example (untested):
#pragma pack(push, 1)
typedef struct
{
BYTE type;
BYTE length;
BYTE pointer;
ULONG addresses[64];
} RecordRouteOption, *PRecordRouteOption;
#pragma pack(pop)
HANDLE icmp = IcmpCreateFile();
...
IPAddr addr;
char *SendData = "Hello";
addr.S_un.S_addr = ...;
BYTE options[sizeof(RecordRouteOption)+1] = {0};
PRecordRouteOption option = (PRecordRouteOption) options;
option->type = IP_OPT_RR;
option->length = sizeof(RecordRouteOption);
option->pointer = 4;
(++option)->type = IP_OPT_EOL;
IP_OPTION_INFORMATION info = {0};
info.Ttl = ...;
info.Tos = ...;
info.Flags = ...;
info.OptionsSize = sizeof(options);
info.OptionsData = options;
DWORD ReplySize = sizeof(ICMP_ECHO_REPLY) + strlen(SendData);
ICMP_ECHO_REPLY *reply = (ICMP_ECHO_REPLY*) malloc(ReplySize);
...
if( IcmpSendEcho(icmp, addr, SendData, strlen(SendData), &info, reply,
ReplySize, 1000) > 0 )
{
// use reply->Options as needed...
}
...
free(reply);
IcmpCloseHandle(icmp);
> Also, does IP_OPT_RR return each hop?
No.
> If not: what does it do?
It returns all of the hops together in a single reply.
Gambit
Technical Details
Message-ID:
<485a8cbf$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<4859f37d@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,264eb84529f8f81e X-Google-Attributes: gid11508e,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> Newsgroups: borland.public.cppbuilder.internet.socket References: <4859f37d@newsgroups.borland.com> Subject: Re: IP_OPT_RR and IcmpSendEcho() anybody how how? Date: Thu, 19 Jun 2008 09:42:35 -0700 Lines: 72 Organization: Lebeau Software X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3138 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198 NNTP-Posting-Host: 207.178.157.90 Message-ID: <485a8cbf$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1213893823 207.178.157.90 (19 Jun 2008 09:43:43 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail