• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: CC_OPT_GETMISCINFO status ???
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CC_OPT_GETMISCINFO status ???


  • Subject: Re: CC_OPT_GETMISCINFO status ???
  • From: Jérome Foucher <email@hidden>
  • Date: Fri, 14 Jun 2002 09:17:13 +0200

On vendredi, juin 14, 2002, at 12:01 , Herb Hrowal wrote:

Unfortunately, I always receive error -3151 (kOTBadOptionErr) when
trying to do that.
Only the PP_OPT_GETCURRENTSTATE call work.

This is a documented problem although I don't remember where we found the
answer. The solution is to modify the initialization of the TOption and
TOptMgmt structures. On both structures you need to set the len member
to the full size of the buffer instead of just the size of the TOption
structure. Just use the same value you use for maxlen.

After making this change our PPP status problems on X went away and things
still worked beautifully on 9.

Sorry, but this still doesn't work for me.
I've also been told to zero-out the structure before sending it to OTOptionManagement, but this also doesn't work.

I've enclosed my code below.

Can anyone point out what's wrong ?

Thanks
Jirome

----------


UInt8 buffer[sizeof(TOption) + sizeof(CCMiscInfo) + sizeof(UInt32)];
TOption* option = (TOption*) buffer;
CCMiscInfo* miscInfo = (CCMiscInfo*) &option->value[0];
TOptMgmt cmd;

memset(buffer, 0, sizeof(buffer)); // zeroed-out as suggested

cmd.opt.buf = buffer;
//cmd.opt.len = sizeof(TOptionHeader) + sizeof(UInt32);
cmd.opt.len = sizeof(buffer); // Changed as suggested
cmd.opt.maxlen = sizeof(buffer);
cmd.flags = T_CURRENT;
//option->len = cmd.opt.len;
option->len = sizeof(buffer); // Changed as suggested
option->level = COM_PPP;
option->name = CC_OPT_GETMISCINFO;
option->status = 0;

::OTSetSynchronous(mEndPoint);
::OTSetBlocking(mEndPoint);
err = ::OTOptionManagement(mEndPoint, &cmd, &cmd);

if (err == kOTNoError && option->status == T_SUCCESS) {
switch (miscInfo->connectionStatus) {
case kPPPConnectionStatusConnecting:
stats.state = kDial;
break;

case kPPPConnectionStatusConnected:
stats.state = kConnected;
break;

case kPPPConnectionStatusDisconnecting:
stats.state = kDisconnecting;
break;

default:
stats.state = kDisconnected;
break;
}
stats.dataRate = miscInfo->bytesTransmitted + miscInfo->bytesReceived;
stats.elapsedTime = miscInfo->connectionTimeElapsed;
stats.remainingTime = miscInfo->connectionTimeRemaining;
}
*error = err;

::OTSetAsynchronous(mEndPoint);
::OTSetNonBlocking(mEndPoint);
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: CC_OPT_GETMISCINFO status ??? solution !!!
      • From: Jérome Foucher <email@hidden>
References: 
 >Re: CC_OPT_GETMISCINFO status ??? (From: Herb Hrowal <email@hidden>)

  • Prev by Date: Re: Flood pings and memory leaks
  • Next by Date: Porting SimpleHTTPServer to CW/C++
  • Previous by thread: Re: CC_OPT_GETMISCINFO status ???
  • Next by thread: Re: CC_OPT_GETMISCINFO status ??? solution !!!
  • Index(es):
    • Date
    • Thread