Re: Jaguar and PPPLIB
Re: Jaguar and PPPLIB
- Subject: Re: Jaguar and PPPLIB
- From: Rich Kubota <email@hidden>
- Date: Tue, 29 Oct 2002 14:08:42 -0800
At 8:58 PM +0000 10/29/02, email@hidden wrote:
>
Hi Rich,
>
This is very weird, but now all works fine, but I remember clearly it not
>
working, but I cannot reproduce the failure, but thanks for the pointers.
>
>
Out of interest is there a way I can override the telephone numbers
>
(primary and alternate) in the network preference using the PPPSetOption
>
???, as I would be very interested in this, as presently I am changing the
>
preferences which is heaps of code.
>
>
Thanks in advance
>
Mark.
>
Mark,
The PPPLib code is set up to handle these matters. First let me step
back and provide some background info.
the PPPLib code is considered private as NW Engineering has not made
the code available for inclusion into the standard Developer Kit. the
primary reason for this is the expectation that a higher level API
will be provided, something that will work with the Cocoa framework.
At present, the existing PPPLib code is strictly socket based and
trying to work this API into a Cocoa application would take some
work.There is no desire to change the existing PPPLib API, but
changes might be necessary when the higher level API is created.
Buyer beware!!
PPPLib presents a control API to the user. This means that for the
routines to work, there must be a PPP entity in the Network
Configuration defined for a PPP connection. It could be that for
some of you on the list, if there is no PPP connection defined in the
NW configs, then even if you use options to specify the remote
address, user, pass, etc, the connect attempt will fail to do
anything.
Prior to 10.2, several of the PPPxxx calls specify a link parameter.
One could specify NIL or -1 as the link argument, whereby PPPLib
would look for the first PPP connection type to use as the control
record for the PPP connection. The PPPGetLinkByIndex and the
PPPGetLinkByServiceID calls provide you with a means to get a
specific link value when multiple PPP control definitions exist.
For 10.2, support was implemented for using the ServiceID as an
argument for the PPP calls. At present, you don't have the modified
PPPLib files. I've asked engineering to get these files updated and
posted to the Darwin site. Even with the modified API, the existing
PPPLib calls continue to function as before under 10.2 and there is
no immediate plans to change this. Again, there is no commitment to
leaving the API alone.
As for answering the question - how to override the different settings -
Note the following
char remoteAddr[16] = "1234567";
char authName[32] = "valid_User_Name";
char password[32] = "valid_password";
char connectScript[64] = "Apple Internal 56K Modem (v.90)";
result = PPPSetOption(gpppRef, -1, PPP_OPT_COMM_REMOTEADDR,
remoteAddr, strlen(remoteAddr));
if (result)
fprintf(stderr, " Error calling PPPSetOption for
PPP_OPT_COMM_REMOTEADDR %d\n", result);
else
fprintf(stderr, " PPP_OPT_COMM_REMOTEADDR returned success\n");
result = PPPSetOption(gpppRef, -1, PPP_OPT_AUTH_NAME, authName ,
strlen(authName));
if (result)
fprintf(stderr, " Error calling PPPSetOption for
PPP_OPT_AUTH_NAME %d\n", result);
else
fprintf(stderr, " PPP_OPT_AUTH_NAME returned success\n");
result = PPPSetOption(gpppRef, -1, PPP_OPT_AUTH_PASSWD, password
, strlen(password));
if (result)
fprintf(stderr, " Error calling PPPSetOption for
PPP_OPT_AUTH_PASSWD %d\n", result);
else
fprintf(stderr, " PPP_OPT_AUTH_PASSWD returned success\n");
result = PPPSetOption(gpppRef, -1, PPP_OPT_DEV_CONNECTSCRIPT,
connectScript, strlen(connectScript));
if (result)
fprintf(stderr, " Error calling PPPSetOption for
PPP_OPT_DEV_CONNECTSCRIPT %d\n", result);
else
fprintf(stderr, " PPP_OPT_DEV_CONNECTSCRIPT returned success\n");
In these samples, I set the link parameter to -1 to tell the system
to use the first PPP Control record. In a real program, I would want
to verify that there was some PPP record already present before
making the PPPConnect call. Use SCF to identify a PPP record.
--
Sincerely,
Rich Kubota
email@hidden
(408) 974-6212
_______________________________________________
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.