Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

OTOptionManagement... specifying phone#,username and passw



Hi all,

I have been using the low Open Transport/PPP [port] interface for
establishing a PPP RAS connection. Following the documentation, when
opening an endpoint and launching the I_OTConnect command it
takes the current default PPP configuration specified by the user in the
Remote Access Panel.

In order to specify my own parameters and overwrite temporarily the
default ones (or non-existing): phone#, username and password the only
way is going through the nasty ::OTOptionManagement function calls.
Bellow I send you how I used it for you to tell me if I have been doing
anything wrong.

I have also noticed that it's needed to specify the modem script to execute
when it is empty the current modem script is empty? Is there any chance that

a properly installed modem could have its script empty??? how can I create
my own modem script in such case and make it as general as possible in order

to make it work with most modems.

Best Regards,
Giovanni

OTResult err;
TOptMgmt cmd;
TOption* opt;

// Specify phone#...

LONG size = sizeof(TOptionHeader) + strlen(m_pConnectDlg->m_strPhoneNumber);
UInt8* optBuff = new UInt8[size];

opt = (TOption*)optBuff;

cmd.opt.buf = optBuff;
cmd.opt.len = size;
cmd.opt.maxlen = size;
cmd.flags = T_NEGOTIATE;

opt->level = COM_PPP;
opt->name = CC_OPT_DTEADDRESS;
opt->len = size;
strcpy((char*)(opt->value[0]),m_pConnectDlg->m_strPhoneNumber);

err = ::OTOptionManagement(m_fEndPoint, &cmd, &cmd);

delete optBuff;

// Specify username...

size = sizeof(TOptionHeader) + strlen(m_pConnectDlg->m_strUserName);
optBuff = new UInt8[size];

opt = (TOption*)optBuff;

cmd.opt.buf = optBuff;
cmd.opt.len = size;
cmd.opt.maxlen = size;
cmd.flags = T_NEGOTIATE;

opt->level = COM_PPP;
opt->name = SEC_OPT_ID;
opt->len = size;
strcpy((char*)(opt->value[0]),m_pConnectDlg->m_strUserName);

err = ::OTOptionManagement(m_fEndPoint, &cmd, &cmd);

delete optBuff;

// Specify password...
size = sizeof(TOptionHeader) + strlen(m_pConnectDlg->m_strPassword);
optBuff = new UInt8[size];

opt = (TOption*)optBuff;

cmd.opt.buf = optBuff;
cmd.opt.len = size;
cmd.opt.maxlen = size;
cmd.flags = T_NEGOTIATE;

opt->level = COM_PPP;
opt->name = SEC_OPT_PASSWORD;
opt->len = size;
strcpy((char*)(opt->value[0]),m_pConnectDlg->m_strPassword);

err = ::OTOptionManagement(m_fEndPoint, &cmd, &cmd);

delete optBuff;




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.