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


C++ ACCESS_CHECK函数代码示例

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


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

示例1: incoming_request

// They answered our finger request.  Nice of them.
void incoming_request(mapping info)
{
   object ob;
   mapping mudinfo;

   if(!ACCESS_CHECK(previous_object())) return;

   if (info["PORTUDP"] && info["NAME"]) {
     // dont want to finger ourselves
     if (info["NAME"] == Mud_name()) return ;

     // if we haven't got an entry for the mud, get one.
     if (!DNS_MASTER->dns_mudp(info["NAME"]))
        PING_Q->send_ping_q(info["HOSTADDRESS"], info["PORTUDP"]);

     // send the info to the player
     ob = find_player(info["ASKWIZ"]);
     if (ob) {
       mudinfo=DNS_MASTER->query_mud_info(info["NAME"]);
       message("finger", "\n"+
         ((!mudinfo || undefinedp(mudinfo["MUDNAME"]))?
           info["NAME"]:mudinfo["MUDNAME"])+
           "告诉你:\n"+info["MSG"],ob);
     }      
   }
}
开发者ID:aricxu,项目名称:xkx100,代码行数:27,代码来源:gfinger_a.c

示例2: incoming_request

// We received an answer answer to our 'do you support xx' request.
void incoming_request(mapping info)
{
	int idx;




	if(!ACCESS_CHECK(previous_object())) return;




	if (stringp(info["PORTUDP"]) && stringp(info["NAME"])) {
		// don't want requests from ourself
		if (info["NAME"] == Mud_name()) return ;




		// if we don't have an entry for the mud, then we ping it
		if (!DNS_MASTER->dns_mudp(info["NAME"]))
			PING_Q->send_ping_q(info["HOSTADDRESS"], info["PORTUDP"]);




		if(info["ANSWERID"] && sscanf(info["ANSWERID"], "%d", idx))
			index_call(idx, info);
	}
}
开发者ID:gongfuPanada,项目名称:xyj2006,代码行数:31,代码来源:support_a.c

示例3: incoming_request

// Support.  Do we support this protocol?
void incoming_request(mapping info)
{
	if(!ACCESS_CHECK(previous_object())) return;

	if (stringp(info["NAME"]) && stringp(info["PORTUDP"])) {
		// dont want requests from ourself
		if(info["NAME"] == Mud_name()) return;

		if(!DNS_MASTER->dns_mudp(info["NAME"]))
			PING_Q->send_ping_q(info["HOSTADDRESS"], info["PORTUDP"]);

		// if the file exists that is enough to know that we support
		// it, unless there is a param request, in which case we have
		// to call_other to the file to check.
		if( file_size(AUX_PATH+info["CMD"]+".c") <= 0
		||	(!undefinedp(info["PARAM"])
		&&	call_other(AUX_PATH+info["CMD"], "support_"+info["PARAM"]))) {
			// we don't support it
			DNS_MASTER->send_udp(info["HOSTADDRESS"], info["PORTUDP"],
				sprintf("@@@%s||NAME:%s||PORTUDP:%d||CMD:%s||NOTSUPPORTED:yes||ANSWERID:%[email protected]@@\n",
					DNS_SUPPORT_A, Mud_name(), udp_port(),
					info["CMD"]+ (!undefinedp(info["PARAM"]) ? "||PARAM:"+info["PARAM"] : ""),
					info["ANSWERID"]));
		} else {
			// we do support it
			DNS_MASTER->send_udp(info["HOSTADDRESS"], info["PORTUDP"],
				sprintf("@@@%s||NAME:%s||PORTUDP:%d||CMD:%s||SUPPORTED:yes||ANSWERID:%[email protected]@@\n",
					DNS_SUPPORT_A, Mud_name(), udp_port(),
					info["CMD"]+(!undefinedp(info["PARAM"]) ? "||PARAM:"+info["PARAM"] : ""),
					info["ANSWERID"]));
		}
	} //if (stringp(info["NAME"]) && stringp(info["PORTUDP"]))
}
开发者ID:heypnus,项目名称:xkx2001,代码行数:34,代码来源:support_q.c

示例4: send_gtell

int send_gtell(string mud, string wiz_to, object source, string msg)
{
	mapping minfo;

	if (! ACCESS_CHECK(previous_object()) &&
	    is_root(previous_object())) return 0;

	mud = htonn(mud);
	if (mud == mud_nname() || ! source) return 0;

	minfo = (mapping)DNS_MASTER->query_mud_info(mud);
	if (! minfo)
        {
                write(LOCAL_MUD_NAME() + "并没有和 " + mud + " 联系上。\n");
                return 0;
        }


	msg = replace_string(msg, "|", "");
	msg = replace_string(msg, "@@@", "");
	DNS_MASTER->send_udp(minfo["HOSTADDRESS"], minfo["PORTUDP"],
		"@@@" + DNS_GTELL +
		"||NAME:" + Mud_name() +
		"||PORTUDP:" + udp_port() +
		"||WIZTO:" + wiz_to +
		"||WIZFROM:" + capitalize(source->query("id")) +
		"||CNAME:" + source->name(1) +
                "||WIZ_LEVEL:" + wiz_level(source) +
		"||MSG:" + msg + "@@@\n");
        return 1;
}
开发者ID:mudchina,项目名称:nitan3,代码行数:31,代码来源:gtell.c

示例5: cpf_grant_magic

cp_grant_id_t
cpf_grant_magic(endpoint_t who_to, endpoint_t who_from,
	vir_bytes addr, size_t bytes, int access)
{
/* Grant process A access into process B. Not everyone can do this. */
	cp_grant_id_t g;
	int r;

	ACCESS_CHECK(access);

	/* Obtain new slot. */
	if((g = cpf_new_grantslot()) < 0)
		return -1;

	/* Basic sanity checks. */
	assert(GRANT_VALID(g));
	assert(g >= 0);
	assert(g < ngrants);
	assert(!(grants[g].cp_flags & CPF_USED));

	if((r=cpf_setgrant_magic(g, who_to, who_from, addr,
		bytes, access)) < 0) {
		cpf_revoke(g);
		return -1;
	}

	return g;
}
开发者ID:AgamAgarwal,项目名称:minix,代码行数:28,代码来源:safecopies.c

示例6: send_remote_q

// This is the interface to the intermud channels
void send_remote_q(string mud,string channel,string me,string who,string msg)
{
	mapping rhost;

	if( !this_player() || !ACCESS_CHECK(previous_object())) return;

	mud = htonn( mud );
	if (mud == mud_nname()) return;

	rhost = (mapping)DNS_MASTER->query_mud_info(mud);
	if (!rhost) return ;

	msg = replace_string(msg, "|", "");
	msg = replace_string(msg, "@@@", "");

#ifdef DEBUG
	CHANNEL_D->do_channel(this_object(), DEBUG,
		sprintf("send remote to host %s channel %s\n message (%s %s %s).", mud, channel, me, msg, who));
#endif

	DNS_MASTER->send_udp(rhost["HOSTADDRESS"], rhost["PORTUDP"],
			"@@@" + "remote_q" +
			"||NAME:" + Mud_name() +
			"||PORTUDP:" + udp_port() +
			"||CHANNEL:" + channel +
			"||SOURCE_ID:" + lower_case(me) +
			"||TARGET_ID:" + lower_case(who) +
			"||MSG:"     + msg+"@@@\n");
}
开发者ID:gongfuPanada,项目名称:xyj2006,代码行数:30,代码来源:remote_q.c

示例7: send_gtell

void send_gtell(string mud, string wiz_to, object source, string msg)
{
	mapping minfo;

	if(!ACCESS_CHECK(previous_object())
	&&	base_name(previous_object()) != TELL_CMD) return;

	mud = htonn( mud );

	if(mud == mud_nname() || !geteuid(source)) return;

	minfo = (mapping)DNS_MASTER->query_mud_info(mud);
	if (!minfo) return ;

	msg = replace_string(msg, "|", "");
	msg = replace_string(msg, "@@@", "");
	DNS_MASTER->send_udp(minfo["HOSTADDRESS"], minfo["PORTUDP"],
		"@@@" + DNS_GTELL +
		"||NAME:" + Mud_name() +
		"||PORTUDP:" + udp_port() +
		"||WIZTO:" + wiz_to +
		"||WIZFROM:" + capitalize(geteuid(source)) +
		"||CNAME:" + source->name(1) +
		"||MSG:"+msg+"@@@\n");
}
开发者ID:cosin,项目名称:XYJ,代码行数:25,代码来源:gtell.c

示例8: login

int login(string str)
{
	ACCESS_CHECK(previous_program() == LIB_CONN);

	previous_object()->message("Welcome to Shentino's mudclient extension.\n");

	return ::login(str);
}
开发者ID:shentino,项目名称:kotaka,代码行数:8,代码来源:mudclient.c

示例9: incoming_request

// Someone has ping'd us
void incoming_request(mapping info)
{
	if(!ACCESS_CHECK(previous_object())) return;




	if(info["NAME"] == Mud_name()) {
		dns_warning("ping_q::incoming_request: ping from ourselves\n");
		// we pinged ourselves!
		return;
	}




	if (info["PORTUDP"]) {
		// check we have an entry for the sender
		if (!DNS_MASTER->dns_mudp(info["NAME"]))
			PING_Q->send_ping_q(info["HOSTADDRESS"], info["PORTUDP"]);




		// send a ping answer along with our mud info
		DNS_MASTER->send_udp(info["HOSTADDRESS"], info["PORTUDP"],
			"@@@" + DNS_PING_A + (string)DNS_MASTER->start_message()+ "@@@\n");
    }
}
开发者ID:gongfuPanada,项目名称:xyj2006,代码行数:30,代码来源:ping_q.c

示例10: incoming_request

void incoming_request(mapping info)
{
	object ob;
	string msg;
	mapping minfo;

	if( !ACCESS_CHECK(previous_object())) return;

	minfo = (mapping)DNS_MASTER->query_mud_info(info["NAME"]);
	if (!minfo) return ;

	if (stringp(info["PORTUDP"]) && stringp(info["HOSTADDRESS"])) {
		if (info["NAME"] == Mud_name())	return ;
		if (!DNS_MASTER->dns_mudp(info["NAME"]))
			PING_Q->send_ping_q(info["HOSTADDRESS"], info["PORTUDP"]);
		ob = find_player(lower_case(info["SOURCE_ID"]));
		if (!ob) return;

		msg = EMOTE_D->do_emote(ob,lower_case(info["MSG"]),info["TARGET"],4);

#ifdef DEBUG
	CHANNEL_D->do_channel(this_object(), DEBUG, sprintf("%s %s.\n",info["MSG"],info["TARGET"] ));
#endif

		if (!stringp(msg)) {
			CHANNEL_D->do_channel(ob,"sys","error : Nothing get from emoted.c");
			return;
			}

		if(!userp(ob)) return;
		CHANNEL_D->do_channel(ob, info["CHANNEL"],msg,1,1);

	}
}
开发者ID:mudchina,项目名称:fy4,代码行数:34,代码来源:remote_a.c


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