当前位置: 首页>>代码示例>>C++>>正文


C++ dial函数代码示例

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


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


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