🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.socket
7 messages
7 total messages Started by DreamChaser Thu, 19 Jun 2008 05:49
IP_OPT_RR and IcmpSendEcho() anybody how how?
#228
Author: DreamChaser
Date: Thu, 19 Jun 2008 05:49
8 lines
1270 bytes
How do I make this work? 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.

Also, does IP_OPT_RR return each hop? If not: what does it do?

Thanks
DC
Re: IP_OPT_RR and IcmpSendEcho() anybody how how?
#229
Author: Remy Lebeau (TeamB)
Date: Thu, 19 Jun 2008 16:42
70 lines
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 
Re: IP_OPT_RR and IcmpSendEcho() anybody how how?
#230
Author: Bob Gonder
Date: Thu, 19 Jun 2008 17:07
12 lines
1328 bytes
Remy Lebeau (TeamB) wrote:
>"DreamChaser" wrote in message 
>
>> How do I make this work?
>
>Have you looked at Microsoft's examples yet?  Have you read RFC 791 yet?

Yes, always search MSDN in addition to your Googling.
http://search.msdn.microsoft.com/Default.aspx?locale=en-US&Query=IP_OPT_RR

And Wiki will point you to the RFC.
http://en.wikipedia.org/wiki/RFC-791
Re: IP_OPT_RR and IcmpSendEcho() anybody how how?
#231
Author: Remy Lebeau (TeamB)
Date: Thu, 19 Jun 2008 19:37
25 lines
1866 bytes
"Bob Gonder" <none@nowhere.invalid> wrote in message 
news:m94l54da7b5mtb6qhjrbvi8d71kkqeui4s@4ax.com...

> Yes, always search MSDN in addition to your Googling.
> http://search.msdn.microsoft.com/Default.aspx?locale=en-US&Query=IP_OPT_RR

None of those pages have code examples.  This one does, however:

    IcmpSendEcho Function
    http://msdn.microsoft.com/en-us/library/aa366050.aspx

The example does not make use of the RequestOptions parameter, though.  I 
had to piece that together by hand after reading RFC 791

> And Wiki will point you to the RFC.
> http://en.wikipedia.org/wiki/RFC-791

I prefer to always go right to the source instead when looking at RFCs:

    http://www.ietf.org/rfc/rfc0791.txt



Gambit 
Re: IP_OPT_RR and IcmpSendEcho() anybody how how?
#234
Author: DreamChaser
Date: Fri, 20 Jun 2008 21:59
19 lines
1669 bytes
Bob Gonder wrote:
> Remy Lebeau (TeamB) wrote:
>> "DreamChaser" wrote in message 
>>
>>> How do I make this work?
>> Have you looked at Microsoft's examples yet?  Have you read RFC 791 yet?
> 
> Yes, always search MSDN in addition to your Googling.
> http://search.msdn.microsoft.com/Default.aspx?locale=en-US&Query=IP_OPT_RR
> 
> And Wiki will point you to the RFC.
> http://en.wikipedia.org/wiki/RFC-791
> 
Thanks guys. When I said that I had spent hours on the Net... It was 
mostly on the msdn site and I couldn't find ANY examples of how to use 
the OptionsData.

I will try G's code later tonight. Thanks again
DC
Re: IP_OPT_RR and IcmpSendEcho() anybody how how?
#235
Author: DreamChaser
Date: Fri, 20 Jun 2008 22:05
19 lines
1529 bytes
Remy Lebeau (TeamB) wrote:
> "DreamChaser" <NO-Spam@No-Span.net> wrote in message 
> news:4859f37d@newsgroups.borland.com...
> 
>> 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.
> 
I guess I should have been explicate. I meant if it returned information 
about each that was made along the way. I was thinking it would be an 
array of replies that contained all the hops.

Thanks G

DC
Re: IP_OPT_RR and IcmpSendEcho() anybody how how?
#236
Author: Remy Lebeau (TeamB)
Date: Fri, 20 Jun 2008 22:13
14 lines
1470 bytes
"DreamChaser" <NO-Spam@No-Span.net> wrote in message 
news:485c2993$1@newsgroups.borland.com...

> I guess I should have been explicate. I meant if it returned
> information about each that was made along the way. I
> was thinking it would be an array of replies that contained
> all the hops.

Yes, it does return an array.  So you have to make sure your buffer is large 
enough to hold multiple reply items.


Gambit 
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads