The question is not clear.
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;
}
-----Ursprüngliche Nachricht-----
Von: Guy Meyer
[mailto:email@hidden]
Gesendet: Dienstag, 21. Juni 2005
20:36
An: Halit Özüberk (ProDyne)
Betreff: Re: PPP_PATH
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;
}