Re: OTOptionManagement
Re: OTOptionManagement
- Subject: Re: OTOptionManagement
- From: Xavier Jubier <email@hidden>
- Date: Mon, 6 Oct 2003 12:35:57 +0200
How do I use OTOptionManagement to set the username (account name),
password, and telephone number when using Open Transport to establish
a PPP dialup connection. Is this even the correct function? From what
I have read in the documentation I do this before starting a
connection using I_OTConnect.
I am currently dialing a PPP connection using Open Transport. The
connection is using the default settings (username, password, access
number, etc). I need to set these settings programmatically or even
better without the user ever being able to see the changes (temporary
for the current connection).
To set the username you should do (check the code as I have typed it by
memory):
Str255 myARAUserNameID; // Contains the username
TOptMgmt myOptionsManagement;
TOption *myOption;
unsigned char myUsernameBuffer[sizeof(TOptionHeader) + kPPPMaxIDLength];
myOptionsManagement.opt.buf = myUsernameBuffer;
myOptionsManagement.opt.len = kOTOptionHeaderSize + (myARAUserNameID[0]
* sizeof(unsigned char));
myOptionsManagement.opt.maxlen = sizeof(myUsernameBuffer);
myOptionsManagement.flags = T_NEGOTIATE;
myOption = (TOption *) myUsernameBuffer;
myOption->len = kOTOptionHeaderSize + (myARAUserNameID[0] *
sizeof(unsigned char));
myOption->level = COM_PPP;
myOption->name = SEC_OPT_ID;
myOption->status = T_SUCCESS;
BlockMoveData(&(myARAUserNameID[1]), &(myOption->value[0]),
myARAUserNameID[0]);
myOTStatus = OTOptionManagement(myEndpointRef, &myOptionsManagement,
&myOptionsManagement);
Then you wait for the option to be set (event in notifier).
To set the password you use the SEC_OPT_PASSWORD option,
CC_OPT_DTEADDRESS for the phone number, CC_OPT_DTEADDRESSTYPE for the
Data Terminal Equipment, OPT_ALERTENABLE for the information set, ...
(there are other option such as reminder timer, PPP header compression,
...)
Also, is there a way to programmatically set the "Connect
automatically when needed" PPP option?
Not to my knowledge. But since you want to control when to make or
close a connection it shouldn't be a problem.
Xavier
Thanks,
Todd
The New Yahoo! Shopping - with improved product search
_______________________________________________
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.
_______________________________________________
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.