• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ dial函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中dial函数的典型用法代码示例。如果您正苦于以下问题:C++ dial函数的具体用法?C++ dial怎么用?C++ dial使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了dial函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: authdial

int
authdial(char *netroot, char *dom)
{
	char *p;
	int rv;

	if(dom == nil)
		/* look for one relative to my machine */
		return dial(netmkaddr("$auth", netroot, "ticket"), 0, 0, 0);

	/* look up an auth server in an authentication domain */
	p = csgetvalue(netroot, "authdom", dom, "auth", nil);

	/* if that didn't work, just try the IP domain */
	if(p == nil)
		p = csgetvalue(netroot, "dom", dom, "auth", nil);
	/*
	 * if that didn't work, try p9auth.$dom.  this is very helpful if
	 * you can't edit /lib/ndb.
	 */
	if(p == nil)
		p = smprint("p9auth.%s", dom);
	if(p == nil){			/* should no longer ever happen */
		werrstr("no auth server found for %s", dom);
		return -1;
	}
	rv = dial(netmkaddr(p, netroot, "ticket"), 0, 0, 0);
	free(p);
	return rv;
}
开发者ID:aahud,项目名称:harvey,代码行数:30,代码来源:authdial.c


示例2: _authdial

int
_authdial(char *net, char *authdom)
{
	int fd, vanilla;

	vanilla = net==nil || strcmp(net, "/net")==0;

	if(!vanilla || bindnetcs()>=0)
		return authdial(net, authdom);

	/*
	 * If we failed to mount /srv/cs, assume that
	 * we're still bootstrapping the system and dial
	 * the one auth server passed to us on the command line.
	 * In normal operation, it is important *not* to do this,
	 * because the bootstrap auth server is only good for
	 * a single auth domain.
	 *
	 * The ticket request code should really check the
	 * remote authentication domain too.
	 */

	/* use the auth server passed to us as an arg */
	if(authaddr == nil)
		return -1;
	fd = dial(netmkaddr(authaddr, "il", "566"), 0, 0, 0);
	if(fd >= 0)
		return fd;
	return dial(netmkaddr(authaddr, "tcp", "567"), 0, 0, 0);
}
开发者ID:99years,项目名称:plan9,代码行数:30,代码来源:util.c


示例3: callmx

/*
 *  take an address and return all the mx entries for it,
 *  most preferred first
 */
static int
callmx(DS *ds, char *dest, char *domain)
{
	int fd, i, nmx;
	char addr[Maxstring];

	/* get a list of mx entries */
	nmx = mxlookup(ds, domain);
	if(nmx < 0){
		/* dns isn't working, don't just dial */
		return -1;
	}
	if(nmx == 0){
		if(debug)
			fprint(2, "mxlookup returns nothing\n");
		return dial(dest, 0, 0, 0);
	}

	/* refuse to honor loopback addresses given by dns */
	for(i = 0; i < nmx; i++){
		if(strcmp(mx[i].ip, "127.0.0.1") == 0){
			if(debug)
				fprint(2, "mxlookup returns loopback\n");
			werrstr("illegal: domain lists 127.0.0.1 as mail server");
			return -1;
		}
	}

	/* sort by preference */
	if(nmx > 1)
		qsort(mx, nmx, sizeof(Mx), compar);

	if(debug){
		for(i=0; i<nmx; i++)
			print("%s %d\n", mx[i].host, mx[i].pref);
	}
	/* dial each one in turn */
	for(i = 0; i < nmx; i++){
#ifdef PLAN9PORT
		snprint(addr, sizeof(addr), "%s", mx[i].host);
#else
		snprint(addr, sizeof(addr), "%s!%s!%s", ds->proto,
			mx[i].host, ds->service);
#endif
		if(debug)
			fprint(2, "mxdial trying %s (%d)\n", addr, i);
		atnotify(timeout, 1);
		alarm(10*1000);
#ifdef PLAN9PORT
		fd = smtpdial(addr);
#else
		fd = dial(addr, 0, 0, 0);
#endif
		alarm(0);
		atnotify(timeout, 0);
		if(fd >= 0)
			return fd;
	}
	return -1;
}
开发者ID:9fans,项目名称:plan9port,代码行数:64,代码来源:mxdial.c


示例4: main

int
main(int argc, char *argv[])
{
	int sport, dport;
	char *nick;

	nick = NICK;

	if (argc < 4 || strcmp(argv[1], "-h") == 0) {
		fprintf(stderr, "%s host sport dport [nick]\n", argv[0]);
		return 1;
	}

	if (initui() == -1)
		bye(-1);
	drawbar("connecting...");

	if (argc >= 5)
		nick = argv[4];

	sserve = dial(argv[1], argv[2]);
	sbroad = dial(argv[1], argv[3]);

	if (sserve == -1 || sbroad == -1)
		return -1;

	loop(nick, argv[1]);

	bye(0);

	return 0;
}
开发者ID:m-b-,项目名称:talk,代码行数:32,代码来源:ctalk.c


示例5: dfs

int
dfs(
  int depth,
  int max_depth,
  int move,/* order does not matter. */
  char* clocks,
  char* moves,
  char* num_moves_done
) {
  if (depth == max_depth) {
    return is_reset(clocks);
  }
  for (; move < NUM_CLOCKS; move++) {
    if (num_moves_done[move] == 3) {
      continue;
    }
    dial(clocks, move, 0);
    moves[depth] = move;
    num_moves_done[move]++;
    if (dfs(depth + 1, max_depth, move, clocks, moves, num_moves_done)) {
      return 1;
    }
    num_moves_done[move]--;
    dial(clocks, move, 1);
  }
  return 0;
}
开发者ID:mju,项目名称:usaco,代码行数:27,代码来源:clocks.c


示例6: dial

void MainWindow::onPreferences(void)
{
    PreferenceDialog dial(mController.getConfiguration(),this);
    if(dial.exec() == QDialog::Accepted) {
        mController.setConfiguration(dial.getConfiguration());
    }
}
开发者ID:remy-phelipot,项目名称:Planetarium,代码行数:7,代码来源:MainWindow.cpp


示例7: dial

void MainWindow::context_menu_full_calls(const QPoint &pos)
{
    QPoint globalPos = ui->tableAllCalls->mapToGlobal(pos);


    QMenu myMenu;
    myMenu.setFocusPolicy(Qt::NoFocus);
    myMenu.addAction(trUtf8("Κλήση πελάτη"));


    QAction* selectedItem = myMenu.exec(globalPos);

    QString phone;
    if (selectedItem)
    {
        QString src=full_calls_model->data(full_calls_model->index(ui->tableAllCalls->currentIndex().row(),1)).toString();
        QString dst=full_calls_model->data(full_calls_model->index(ui->tableAllCalls->currentIndex().row(),2)).toString();
        if (src.length()>dst.length())
            phone=src;
        else
            phone=dst.mid(1,15);

        dial(phone);
    }

}
开发者ID:algogr,项目名称:hourglass,代码行数:26,代码来源:mainwindow.cpp


示例8: query

void MainWindow::dial_customer(const QPoint& pos)
{
    QPoint globalPos = ui->tableCustomers->mapToGlobal(pos);
            //myWidget->mapToGlobal(pos);
    // for QAbstractScrollArea and derived classes you would use:
    // QPoint globalPos = myWidget->viewport()->mapToGlobal(pos);

    QMenu myMenu;
    myMenu.setFocusPolicy(Qt::NoFocus);
    myMenu.addAction(trUtf8("Κλήση πελάτη"));
    // ...

    QAction* selectedItem = myMenu.exec(globalPos);

    QString phone;
    if (selectedItem)
    {
        QSqlQuery query(db1);
        QString c_id=customer_model->data(customer_model->index(ui->tableCustomers->currentIndex().row(),0)).toString();
        query.exec("select phone from customers where id="+c_id);
        query.next();
        phone=query.value(0).toString();
        dial(phone);
    }



}
开发者ID:algogr,项目名称:hourglass,代码行数:28,代码来源:mainwindow.cpp


示例9: xparse

CFsys*
xparse(char *name, char **path)
{
	int fd;
	char *p;
	CFsys *fs;

	if(addr == nil){
		p = strchr(name, '/');
		if(p == nil)
			p = name+strlen(name);
		else
			*p++ = 0;
		*path = p;
		fs = nsmnt(name, aname);
		if(fs == nil)
			sysfatal("mount: %r");
	}else{
		*path = name;
		if((fd = dial(addr, nil, nil, nil)) < 0)
			sysfatal("dial: %r");
		if((fs = fsmnt(fd, aname)) == nil)
			sysfatal("mount: %r");
	}
	return fs;
}
开发者ID:00001,项目名称:plan9port,代码行数:26,代码来源:9p.c


示例10: STR

void myFinanceMainWindow::deleteExchange_clicked() {
    bool ans = true;
    QString info = STR("撤消资产变化");
    int line = ui->listView->currentIndex().row();
    if (line < 0) {
        return;
    }
    myExchangeData originExchangeData = exchangeModel->getDataFromRow(line);
    myExchangeUI tmpUI(originExchangeData, true, true);
    myFinanceExchangeWindow dial(this, tmpUI, true);
    dial.setWindowTitle(info);
    //dial.setUI(originExchangeData, true);
    if(dial.exec() == QDialog::Accepted) {
        qDebug() << info + "Accepted";
        // 1. DO EXCHANGE ASSET_DATA
        if (dial.getIsRollback()) {
            ans = assetModel->doExchange(-originExchangeData) && ans;
        }
        // 2. DO EXCHANGE EXCHANGE_DATA
        if (false == ans) {
            QMessageBox::warning(this, info, info + " ERROR", QMessageBox::Ok, QMessageBox::Cancel);
        } else {
            exchangeModel->doExchange(originExchangeData, true);
        }
    }
    ui->treeView->expandAll();
}
开发者ID:Imrono,项目名称:myFinance,代码行数:27,代码来源:myFinanceMainWindow.cpp


示例11: new_project

		void new_project()
		{
			NewDialog dial(this);
			crn::xml::SAltoWrapper w(dial.run());
			if (w)
				alto.set_alto(w);
		}
开发者ID:Liris-Pleiad,项目名称:libcrn,代码行数:7,代码来源:nimrod.cpp


示例12: remoteside

void
remoteside(void *v)
{
	int srv_to_net[2];
	int net_to_srv[2];
	char *addr;
	int srvfd;

	if(ns == nil)
		ns = getns();

	addr = smprint("unix!%s/%s", ns, srv);
	if(addr == nil)
		fatal("%r");
	if(debug)
		fprint(dfd, "remoteside starting %s\n", addr);

	srvfd = dial(addr, 0, 0, 0);
	if(srvfd < 0)
		fatal("dial %s: %r", addr);
	if(debug)
		fprint(dfd, "remoteside dial %s succeeded\n", addr);
	fcntl(srvfd, F_SETFL, FD_CLOEXEC);

	/* threads to shuffle messages each way */
	srv_to_net[0] = srvfd;
	srv_to_net[1] = netfd[1];
	proccreate(shuffle, srv_to_net, Stack);
	net_to_srv[0] = netfd[0];
	net_to_srv[1] = srvfd;
	shuffle(net_to_srv);

	threadexitsall(0);
}
开发者ID:00001,项目名称:plan9port,代码行数:34,代码来源:import.c


示例13: wget_connect

int wget_connect(struct wgetfile *finfo)
{
	extern struct cfg global_cfg;
	const char *host, *port;

	if(finfo->proto == HTTP && global_cfg.http_proxy){
		host = global_cfg.http_proxy;
		port = global_cfg.http_proxy_port;
	}else{
		host = finfo->host_name;
		port = finfo->host_port;
	}

	finfo->sock = connection_fd(host, port);

	if(finfo->sock == -1){
		finfo->sock = dial(host, port);
		if(finfo->sock == -1)
			return 1; /* dial() prints the error */
		connection_add(finfo->sock, host, port);
	}else{
		output_err(OUT_INFO, "Reusing connection to %s:%s", host, port);
	}
	return 0;
}
开发者ID:bobrippling,项目名称:wgetlite,代码行数:25,代码来源:wgetlite.c


示例14: vtDial

VtSession *
vtDial(char *host, int canfail)
{
	VtSession *z;
	int fd;
	char *na;
	char e[ERRMAX];

	if(host == nil) 
		host = getenv("venti");
	if(host == nil)
		host = "$venti";

	if (host == nil) {
		if (!canfail)
			werrstr("no venti host set");
		na = "";
		fd = -1;
	} else {
		na = netmkaddr(host, 0, "venti");
		fd = dial(na, 0, 0, 0);
	}
	if(fd < 0){
		rerrstr(e, sizeof e);
		if(!canfail){
			vtSetError("venti dialstring %s: %s", na, e);
			return nil;
		}
	}
	z = vtClientAlloc();
	if(fd < 0)
		strcpy(z->fderror, e);
	vtSetFd(z, fd);
	return z;
}
开发者ID:aahud,项目名称:harvey,代码行数:35,代码来源:client.c


示例15: _iotlsdial

static int32_t
_iotlsdial(va_list *arg)
{
	char *addr, *local, *dir;
	int *cfdp, fd, tfd, usetls;
	TLSconn conn;

	addr = va_arg(*arg, char*);
	local = va_arg(*arg, char*);
	dir = va_arg(*arg, char*);
	cfdp = va_arg(*arg, int*);
	usetls = va_arg(*arg, int);

	fd = dial(addr, local, dir, cfdp);
	if(fd < 0)
		return -1;
	if(!usetls)
		return fd;

	memset(&conn, 0, sizeof conn);
	/* does no good, so far anyway */
	// conn.chain = readcertchain("/sys/lib/ssl/vsignss.pem");

	tfd = tlsClient(fd, &conn);
	close(fd);
	if(tfd < 0)
		fprint(2, "%s: tlsClient: %r\n", argv0);
	else {
		/* BUG: check cert here? */
		if(conn.cert)
			free(conn.cert);
	}
	return tfd;
}
开发者ID:aahud,项目名称:harvey,代码行数:34,代码来源:io.c


示例16: rexcall

char*
rexcall(int *fd, char *host, char *service)
{
	char *na;
	char dir[MaxStr];
	char err[ERRMAX];
	char msg[MaxStr];
	int n;

	na = netmkaddr(host, "tcp", "17010");
	if((*fd = dial(na, 0, dir, 0)) < 0)
		return "can't dial";

	/* negotiate authentication mechanism */
	if(ealgs != nil)
		snprint(msg, sizeof(msg), "%s %s", am->name, ealgs);
	else
		snprint(msg, sizeof(msg), "%s", am->name);
	writestr(*fd, msg, negstr, 0);
	n = readstr(*fd, err, sizeof err);
	if(n < 0)
		return negstr;
	if(*err){
		werrstr(err);
		return negstr;
	}

	/* authenticate */
	*fd = (*am->cf)(*fd);
	if(*fd < 0)
		return "can't authenticate";
	return 0;
}
开发者ID:npe9,项目名称:harvey,代码行数:33,代码来源:cpu-bl.c


示例17: authdial

int
authdial(char *net, char *dom)
{
	int fd;
	fd = dial(netmkaddr(authserver, "tcp", "567"), 0, 0, 0);
	//print("authdial %d\n", fd);
	return fd;
}
开发者ID:npe9,项目名称:harvey,代码行数:8,代码来源:cpu-bl.c


示例18: open_project

		void open_project()
		{
			GtkCRN::FileSelecterDialog dial(crn::Document::GetDefaultDirName(), this);
			if (dial.run() == Gtk::RESPONSE_ACCEPT)
			{
				alto.set_alto(crn::xml::AltoWrapper::NewFromDocument(dial.get_selection()));
			}
		}
开发者ID:Liris-Pleiad,项目名称:libcrn,代码行数:8,代码来源:nimrod.cpp


示例19: main

void
main(int argc, char* argv[])
{
	char*	srv = nil;
	char*	sname = nil;
	char*	addr = nil;
	int	fd;
	int	p[2];

	ARGBEGIN{
	case 'D':
		debug = 1;
		break;
	case 'n':
		addr = EARGF(usage());
		break;
	case 'v':
		verbose = 1;
		break;
	case 's':
		sname = EARGF(usage());
		break;
	default:
		altspc = ARGC();
	}ARGEND;
	if (addr == nil){
		if (argc < 1)
			usage();
		srv = *argv;
		argc--;
	}
	if (argc > 0)
		usage();
	if (sname == nil)
		sname = (addr != nil) ? addr : "trfs";
	fmtinstall('D', dirfmt);
	fmtinstall('M', dirmodefmt);
	fmtinstall('F', fcallfmt);

	if (addr == nil)
		fd = open(srv, ORDWR);
	else
		fd = dial(netmkaddr(addr, "net", "9fs"), 0, 0, 0);
	if (fd < 0 || pipe(p) < 0)
		sysfatal("can't connect to  server %s: %r\n", (addr?addr:srv));
	if (postfd(sname, p[0]) < 0)
		sysfatal("can't post srv: %r\n");
	rfork(RFNOTEG);
	switch(rfork(RFPROC|RFNOTEG)){
	case 0:
		service(p[1], fd, 2);
		break;
	case -1:
		sysfatal("can't fork server: %r\n");
		break;
	}
	exits(nil);	
}
开发者ID:CoryXie,项目名称:nix-os,代码行数:58,代码来源:trfs.c


示例20: smtpdial

/* Taken from imapdial, replaces tlsclient call with stunnel */
static int
smtpdial(char *server)
{
	int p[2];
	int fd[3];
	char *tmp;
	char *fpath;

	if(pipe(p) < 0)
		return -1;
	fd[0] = dup(p[0], -1);
	fd[1] = dup(p[0], -1);
	fd[2] = dup(2, -1);
#ifdef PLAN9PORT
	tmp = smprint("%s:587", server);
	fpath = searchpath("stunnel3");
	if (!fpath) {
		werrstr("stunnel not found. it is required for tls support.");
		return -1;
	}
	if(threadspawnl(fd, fpath, "stunnel", "-n", "smtp" , "-c", "-r", tmp, nil) < 0) {
#else
	tmp = smprint("tcp!%s!587", server);
	if(threadspawnl(fd, "/bin/tlsclient", "tlsclient", tmp, nil) < 0){
#endif
		free(tmp);
		close(p[0]);
		close(p[1]);
		close(fd[0]);
		close(fd[1]);
		close(fd[2]);
		return -1;
	}
	free(tmp);
	close(p[0]);
	return p[1];
}

int
mxdial(char *addr, char *ddomain, char *gdomain)
{
	int fd;
	DS ds;
	char err[Errlen];

	addr = netmkaddr(addr, 0, "smtp");
	dial_string_parse(addr, &ds);

	/* try connecting to destination or any of it's mail routers */
	fd = callmx(&ds, addr, ddomain);

	/* try our mail gateway */
	rerrstr(err, sizeof(err));
	if(fd < 0 && gdomain && strstr(err, "can't translate") != 0)
		fd = dial(netmkaddr(gdomain, 0, "smtp"), 0, 0, 0);

	return fd;
}
开发者ID:9fans,项目名称:plan9port,代码行数:59,代码来源:mxdial.c



注:本文中的dial函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ dialog函数代码示例发布时间:2022-05-30
下一篇:
C++ diagnostics函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap