當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。