AW: PPP_PATH
AW: PPP_PATH
- Subject: AW: PPP_PATH
- From: Halit Özüberk \(ProDyne\) <email@hidden>
- Date: Wed, 22 Jun 2005 11:59:14 +0200
- Thread-topic: PPP_PATH
Title: Nachricht
1.
The pppcallback function is called, but system message of the RAS
comes up, nevertheless.
How can I catch to this Event before is
indicated?
2.
after
I call CFRunLoopStop, callback function is called,
nevertheless.
SourceCode:
int
reftoAPIcallback;
u_int32_t Networklink;
int res;
CFSocketRef
callbackSocketRef;
CFRunLoopSourceRef runLoopSource;
CFSocketContext
context= { 0, NULL, NULL, NULL, NULL };
static
void
pppCallBack(CFSocketRef s, CFSocketCallBackType type, CFDataRef
address, const void *data, void *info)
{
CFSocketNativeHandle
socket;
socket=CFSocketGetNative(s);
if ( socket==
reftoAPIcallback)
{
fprintf(stderr, "MypppCallBack
called.... \n");
fprintf(stderr, "Data -> %2x ....
\n",data);
CFRunLoopStop(
CFRunLoopGetCurrent());
/// get event via calling PPPExec
}
}
MyPPPConnect
{
u_int32_t nLinks=0;
PPPInit(&reftoAPIcallback);
callbackSocketRef = CFSocketCreateWithNative(NULL,
reftoAPIcallback, kCFSocketReadCallBack, pppCallBack, &context);
if (callbackSocketRef == 0)
{
/// handle
error and exit
return;
}
CFSocketSetSocketFlags
(callbackSocketRef,CFSocketGetSocketFlags(callbackSocketRef) &&
!!kCFSocketCloseOnInvalidate);
CFSocketEnableCallBacks(callbackSocketRef,
kCFSocketConnectCallBack);
runLoopSource =
CFSocketCreateRunLoopSource(NULL, callbackSocketRef, 0);
if
(runLoopSource == 0)
{
/// handle error and exit
return;
}
CFRunLoopAddSource(CFRunLoopGetCurrent(),
runLoopSource,kCFRunLoopDefaultMode);
res =
PPPGetNumberOfLinks (reftoAPIcallback,&nLinks);
res =
PPPGetLinkByIndex(reftoAPIcallback,0,&Networklink);
res=
PPPEnableEvents(reftoAPIcallback, Networklink,true);
PPPConnect(reftoAPIcallback,
Networklink);
CFRunLoopRun();
return;
}
On Jun 21, 2005, at 4:59 PM, Halit Özüberk ((ProDyne)) wrote:
#define PPP_PATH "/var/run/pppconfd\0"
for which is this constant?
what does to this file "pppconfd" ?
It is used for the socket connection
__private_extern__
int
PPPInit(int *ref)
{
int sock;
int status;
struct sockaddr_un sun;
sock = socket(AF_LOCAL, SOCK_STREAM, 0);
bzero(&sun, sizeof(sun));
sun.sun_family = AF_LOCAL;
strncpy(sun.sun_path, PPP_PATH, sizeof(sun.sun_path));
status = connect(sock, (struct sockaddr
*)&sun, sizeof(sun));
if (status < 0)
{
return errno;
}
*ref = sock;
return 0;
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden