本文整理汇总了C++中Options::GetOptional方法的典型用法代码示例。如果您正苦于以下问题:C++ Options::GetOptional方法的具体用法?C++ Options::GetOptional怎么用?C++ Options::GetOptional使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Options
的用法示例。
在下文中一共展示了Options::GetOptional方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc,char *argv[])
{
if(!BaseSock::BaseInit())
{
cout << "base init failed\n";
return 0;
}
int arganz = 0;
string arg1 = "";
string arg2 = "";
arganz = argc -1;
if(arganz > 0) arg1 = argv[1];
if(arganz > 1) arg2 = argv[2];
cout << "Simple Win32/Linux traffic bouncer v0.2.2 2011/02/07 (c) _hawk_/PPX\n";
cout << "Using " << version << "\n";
if(arganz < 1 && arganz > 2)
{
cout << "usage: tbnc <configfile> or tbnc -u <configfile> for uncrypted conf\n";
return 0;
}
if(arganz == 1)
{
string key;
getpassword("Enter blowfish key",key);
if(!options.config.Init(arg1,key))
{
cout << "error reading conf\n";
return 0;
}
}
else
{
if(arg1 == "-u")
{
if(!options.config.Init(arg2,""))
{
cout << "error reading conf\n";
return 0;
}
}
else
{
cout << "usage: tbnc <configfile> or tbnc -u <configfile> for uncrypted conf\n";
return 0;
}
}
options.GetOptional();
if(!options.GetRequired())
{
cout << "one or more basic options not set\n";
return 0;
}
if(options.buffersize > 0)
{
BaseSock::Buffersize(options.buffersize);
}
if(options.sndrcvbufsize > 0)
{
BaseSock::SndRcvBufSize(options.sndrcvbufsize);
}
if(!BaseSock::BaseSslInit(options.certpath, options.certpath))
{
cout << "Ssl server init failed\n";
return 0;
}
if(options.delay > 0)
{
BaseSock::Delay(options.delay);
}
if(options.retrycount > 0)
{
BaseSock::Retrycount(options.retrycount);
}
ServerSock ss;
if(!ss.Init())
{
cout << "socket init failed\n";
return 0;
}
if(!ss.Bind(options.listenip, options.listenport))
{
cout << "could not bind\n";
return 0;
}
ss.Listen(100);
if(!options.logToScreen)
{
//.........这里部分代码省略.........