Re: PPP Events
Re: PPP Events
- Subject: Re: PPP Events
- From: Jens Bauer <email@hidden>
- Date: Wed, 27 Feb 2002 03:58:48 +0100
Hi Morgan,
On Tue, 26 Feb, 2002, Morgan Redman <email@hidden> wrote:
>
Hi everyone. I know there has been discussion of PPP events on this list
>
before. What are the PPP events that you actually *get*?
>
>
I know I heard someone say the only one you can depend on is
>
kPPPConnectCompleteEvent. Do kPPPDisconnectCompleteEvent and
>
kPPPDisconnectEvent work aswell?
kPPPDisconnectCompleteEvent works, but I don't know about kPPPDisconnectEvent.
Here's my notifier, stripped down a bit, but I believe it'd still work:
static pascal void Notifier(void *context, OTEventCode event, OTResult
result, void *cookie)
{
#pragma unused(result)
EndpointRef ep;
int errorCode;
errorCode = (int) cookie;
ep = (EndpointRef) context;
switch(event)
{
case kPPPConnectCompleteEvent:
switch(errorCode)
{
case 0:
SetStatus(kConnected);
break;
case 1:
SetStatus(kDialing);
break;
case -6020: // No Dialtone
SetStatus(kIdle);
break;
case -6019: // Timeout (no answer, voice answer, illegal
phone#, busy, etc.)
SetStatus(kIdle);
break;
case -7114: // Modem in use
SetStatus(kIdle);
break;
case -7129: // Authentication failed
SetStatus(kIdle);
break;
case -7136: // Connection refused (Eg. can happen if TCP/IP
is set to use DHCP)
SetStatus(kIdle);
break;
default: // Save error code for debugging
gRealErrorCode = errorCode;
break;
}
break;
case kPPPSetScriptCompleteEvent:
// don't know if we get this
break;
case kPPPDisconnectCompleteEvent:
switch(errorCode)
{
case 0:
// SetStatus(kDisconnected);
SetStatus(kIdle);
break;
case 1:
SetStatus(kDisconnecting);
break;
default:
gRealErrorCode = errorCode;
break;
}
break;
// Here follows a bunch of events that I don't handle...
case kPPPDisconnectEvent:
break;
case kPPPIPCPUpEvent:
break;
case kPPPIPCPDownEvent:
break;
case kPPPLCPUpEvent:
break;
case kPPPLCPDownEvent:
break;
case kPPPLowerLayerUpEvent:
break;
case kPPPLowerLayerDownEvent:
break;
case kPPPAuthenticationStartedEvent:
break;
case kPPPAuthenticationFinishedEvent:
break;
case kPPPDCEInitStartedEvent:
break;
case kPPPDCEInitFinishedEvent:
break;
case kPPPDCECallStartedEvent:
// We get this, when dialing, cookie seem to always be 0.
break;
case kPPPDCECallFinishedEvent:
// We get this.
// if there's no modem, cookie is set to -6020
switch(errorCode)
{
case -6020:
SetLastError(kNoDialTone);
break;
case -6019:
SetLastError(kTimeout);
break;
default:
gRealErrorCode = errorCode;
SetLastError(kUnknownError);
break;
}
break;
case kStreamIoctlEvent:
switch((int) cookie)
{
case I_OTGetMiscellaneousEvents:
// we get this
break;
case I_OTConnect:
// we get this too
break;
default:
break;
}
break;
default:
break;
}
}
Love,
Jens
--
Jens Bauer, Faster Software.
-Let's make the World better, shall we ?
_______________________________________________
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.
References: | |
| >PPP Events (From: Morgan Redman <email@hidden>) |