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

C++ AF函数代码示例

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

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



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

示例1: AF

int HVS_B0307::Init(__u16 v)
{
	int rc=Base::Init();
	if( rc ) return rc;
	rc = AF(afClearLAM)
	   | AF(afWrite,&v)|AF(afOn);
	return rc;
}
开发者ID:basilevs,项目名称:libcamac,代码行数:8,代码来源:HVS_B0307.cpp


示例2: restrict_source

/*
 * restrict_source - maintains dynamic "restrict source ..." entries as
 *		     peers come and go.
 */
void
restrict_source(
	sockaddr_u *	addr,
	int		farewell,	/* 0 to add, 1 to remove */
	u_long		expire		/* 0 is infinite, valid until */
	)
{
	sockaddr_u	onesmask;
	restrict_u *	res;
	int		found_specific;

	if (!restrict_source_enabled || SOCK_UNSPEC(addr) ||
	    IS_MCAST(addr) || ISREFCLOCKADR(addr))
		return;

	REQUIRE(AF_INET == AF(addr) || AF_INET6 == AF(addr));

	SET_HOSTMASK(&onesmask, AF(addr));
	if (farewell) {
		hack_restrict(RESTRICT_REMOVE, addr, &onesmask,
			      0, 0, 0);
		DPRINTF(1, ("restrict_source: %s removed", stoa(addr)));
		return;
	}

	/*
	 * If there is a specific entry for this address, hands
	 * off, as it is condidered more specific than "restrict
	 * server ...".
	 * However, if the specific entry found is a fleeting one
	 * added by pool_xmit() before soliciting, replace it
	 * immediately regardless of the expire value to make way
	 * for the more persistent entry.
	 */
	if (IS_IPV4(addr)) {
		res = match_restrict4_addr(SRCADR(addr), SRCPORT(addr));
		INSIST(res != NULL);
		found_specific = (SRCADR(&onesmask) == res->u.v4.mask);
	} else {
		res = match_restrict6_addr(&SOCK_ADDR6(addr),
					   SRCPORT(addr));
		INSIST(res != NULL);
		found_specific = ADDR6_EQ(&res->u.v6.mask,
					  &SOCK_ADDR6(&onesmask));
	}
	if (!expire && found_specific && res->expire) {
		found_specific = 0;
		free_res(res, IS_IPV6(addr));
	}
	if (found_specific)
		return;

	hack_restrict(RESTRICT_FLAGS, addr, &onesmask,
		      restrict_source_mflags, restrict_source_flags,
		      expire);
	DPRINTF(1, ("restrict_source: %s host restriction added\n", 
		    stoa(addr)));
}
开发者ID:cemeyer,项目名称:freebsd-base-graphics,代码行数:62,代码来源:ntp_restrict.c


示例3: create_socket

/* Creates a socket and returns. */
void 
create_socket (
		SOCKET *rsock,
		sockaddr_u *dest
		)
{
	*rsock = socket(AF(dest), SOCK_DGRAM, 0);

	if (-1 == *rsock && ENABLED_OPT(NORMALVERBOSE))
		printf("Failed to create UDP socket with family %d\n", AF(dest));
}
开发者ID:gosudream,项目名称:netbsd-src,代码行数:12,代码来源:networking.c


示例4: test_IPv6AddressWithPort

void 
test_IPv6AddressWithPort(void) {

#ifdef ISC_PLATFORM_WANTIPV6

	const struct in6_addr address = {
		0x20, 0x01, 0x0d, 0xb8,
		0x85, 0xa3, 0x08, 0xd3, 
		0x13, 0x19, 0x8a, 0x2e,
		0x03, 0x70, 0x73, 0x34
	};

	const char* expected =
		"2001:db8:85a3:8d3:1319:8a2e:370:7334";
	const char* expected_port = 
		"[2001:db8:85a3:8d3:1319:8a2e:370:7334]:123";

	sockaddr_u input;
	memset(&input, 0, sizeof(input));
	AF(&input) = AF_INET6;
	SET_ADDR6N(&input, address);
	SET_PORT(&input, 123);

	TEST_ASSERT_EQUAL_STRING(expected, socktoa(&input));
	TEST_ASSERT_EQUAL_STRING(expected_port, sockporttoa(&input));

#else
	TEST_IGNORE_MESSAGE("IPV6 disabled in build, skipping.");

#endif /* ISC_PLATFORM_HAVEIPV6 */

}
开发者ID:qicny,项目名称:freebsd,代码行数:32,代码来源:socktoa.c


示例5: test_AddrMatch_anull

void test_AddrMatch_anull(void)
{
	/* Check the not-an-address logic with a prefix/check length of
	 * zero bits. Any compare with a NULL or AF_UNSPEC address
	 * returns inequality (aka FALSE).
	 */
	sockaddr_u   ip4, ip6, ipn;

	memset(&ipn, 0, sizeof(ipn));
	AF(&ipn) = AF_UNSPEC;

	TEST_ASSERT_TRUE(getaddr(AF_INET , "192.128.1.1", &ip4));
	TEST_ASSERT_TRUE(getaddr(AF_INET6, "::1"        , &ip6));

	TEST_ASSERT_FALSE(keyacc_amatch(NULL, NULL, 0));
	TEST_ASSERT_FALSE(keyacc_amatch(NULL, &ipn, 0));
	TEST_ASSERT_FALSE(keyacc_amatch(NULL, &ip4, 0));
	TEST_ASSERT_FALSE(keyacc_amatch(NULL, &ip6, 0));

	TEST_ASSERT_FALSE(keyacc_amatch(&ipn, NULL, 0));
	TEST_ASSERT_FALSE(keyacc_amatch(&ipn, &ipn, 0));
	TEST_ASSERT_FALSE(keyacc_amatch(&ipn, &ip4, 0));
	TEST_ASSERT_FALSE(keyacc_amatch(&ipn, &ip6, 0));

	TEST_ASSERT_FALSE(keyacc_amatch(&ip4, NULL, 0));
	TEST_ASSERT_FALSE(keyacc_amatch(&ip4, &ipn, 0));
	TEST_ASSERT_FALSE(keyacc_amatch(&ip6, NULL, 0));
	TEST_ASSERT_FALSE(keyacc_amatch(&ip6, &ipn, 0));
}
开发者ID:jaredmcneill,项目名称:netbsd-src,代码行数:29,代码来源:authkeys.c


示例6: _inet_ntop

string CAddress::ToString() const
{
	char Dest[65] = {'\0'};
	if(m_eAF != None)
		_inet_ntop(AF(), m_IP, Dest, 65);
	return Dest;
}
开发者ID:0vermind,项目名称:NeoLoader,代码行数:7,代码来源:Address.cpp


示例7: test_ScopedIPv6AddressWithPort

void 
test_ScopedIPv6AddressWithPort(void) {
#ifdef ISC_PLATFORM_HAVESCOPEID
	const struct in6_addr address = { { {
		0xfe, 0x80, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00,
		0x02, 0x12, 0x3f, 0xff, 
		0xfe, 0x29, 0xff, 0xfa
	} } };

	const char* expected =
		"fe80::212:3fff:fe29:fffa%5";
	const char* expected_port = 
		"[fe80::212:3fff:fe29:fffa%5]:123";

	sockaddr_u input;
	memset(&input, 0, sizeof(input));
	AF(&input) = AF_INET6;
	SET_ADDR6N(&input, address);
	SET_PORT(&input, 123);
	SCOPE_VAR(&input) = 5;

	TEST_ASSERT_EQUAL_STRING(expected, socktoa(&input));
	TEST_ASSERT_EQUAL_STRING(expected_port, sockporttoa(&input));
#else
	TEST_IGNORE_MESSAGE("Skipping because ISC_PLATFORM does not have Scope ID");
#endif
}
开发者ID:qicny,项目名称:freebsd,代码行数:28,代码来源:socktoa.c


示例8: AF

int Coincide_C0308::GetMaskAND(u8_t* mask, COI_ch_t ch)
{
	u16_t tmp;
	int rc = AF(afGetAND[ch], &tmp);
	*mask = tmp & maxAndMask;
	return rc;
}
开发者ID:basilevs,项目名称:libcamac,代码行数:7,代码来源:Coincide_C0308.cpp


示例9: decodeaddrtype

static char
decodeaddrtype(
	sockaddr_u *sock
	)
{
	char ch = '-';
	u_int32 dummy;

	switch(AF(sock)) {
	case AF_INET:
		dummy = SRCADR(sock);
		ch = (char)(((dummy&0xf0000000)==0xe0000000) ? 'm' :
			((dummy&0x000000ff)==0x000000ff) ? 'b' :
			((dummy&0xffffffff)==0x7f000001) ? 'l' :
			((dummy&0xffffffe0)==0x00000000) ? '-' :
			'u');
		break;
	case AF_INET6:
		if (IN6_IS_ADDR_MULTICAST(PSOCK_ADDR6(sock)))
			ch = 'm';
		else
			ch = 'u';
		break;
	default:
		ch = '-';
		break;
	}
	return ch;
}
开发者ID:Distrotech,项目名称:ntp,代码行数:29,代码来源:ntpq-subs.c


示例10: socktoa

/*
 * socktoa - return a numeric host name from a sockaddr_storage structure
 */
const char *
socktoa(
	const sockaddr_u *sock
	)
{
	int		saved_errno;
	char *		res;
	char *		addr;
	u_long		scope;

	saved_errno = errno;
	LIB_GETBUF(res);

	if (NULL == sock) {
		strlcpy(res, "(null)", LIB_BUFLENGTH);
	} else {
		switch(AF(sock)) {

		case AF_INET:
		case AF_UNSPEC:
			inet_ntop(AF_INET, PSOCK_ADDR4(sock), res,
				  LIB_BUFLENGTH);
			break;

		case AF_INET6:
			inet_ntop(AF_INET6, PSOCK_ADDR6(sock), res,
				  LIB_BUFLENGTH);
			scope = SCOPE_VAR(sock);
			if (0 != scope && !strchr(res, '%')) {
				addr = res;
				LIB_GETBUF(res);
				snprintf(res, LIB_BUFLENGTH, "%s%%%lu",
					 addr, scope);
				res[LIB_BUFLENGTH - 1] = '\0';
			}
			break;

		default:
			snprintf(res, LIB_BUFLENGTH, 
				 "(socktoa unknown family %d)", 
				 AF(sock));
		}
	}
	errno = saved_errno;

	return res;
}
开发者ID:ntpsec,项目名称:ntpsec,代码行数:50,代码来源:socktoa.c


示例11:

int HVS_B0307::ReadCode(__u16* pcode)
{
	u16_t data;
	int rc=AF(afRead, &data);
	if ( rc&CAMAC_CC_ERRORS ) return rc;
	*pcode = data;
	return rc;
}
开发者ID:basilevs,项目名称:libcamac,代码行数:8,代码来源:HVS_B0307.cpp


示例12: main

int main()
{
    FILE *input, *output;
    input=fopen("input.dat","r");
    output=fopen("output.dat","w");
    int x;
    char c[1024];

lista = (SENTINEL*) malloc(sizeof(SENTINEL));
    lista->head=0;
    lista->tail=0;
    while(fscanf(input,"%s",c)!=EOF)
    {
        if(strcmp(c,"PRINT_ALL")==0)
                PRINT_ALL(output);
        else
            if(strcmp(c,"AF")==0)
            {
                fscanf(input,"%d",&x);
                AF(x);
            }
        else
            if(strcmp(c,"AL")==0)
            {
                fscanf(input,"%d",&x);
                AL(x);
            }
        else
            if(strcmp(c,"DF")==0)
                DF();
        else
            if(strcmp(c,"DL")==0)
                DL();
        else
            if(strcmp(c,"DOOM_THE_LIST")==0)
                DOOM_THE_LIST();
        else
            if(strcmp(c,"DE")==0)
            {
                fscanf(input,"%d",&x);
                DE(x);
            }
        else
            if(strcmp(c,"PRINT_F")==0)
            {
                fscanf(input,"%d",&x);
                PRINT_F(x,output);
            }
        else
            if(strcmp(c,"PRINT_L")==0)
            {
                fscanf(input,"%d",&x);
                PRINT_L(x,output);
            }
    }
    return 0;
}
开发者ID:Alecs94,项目名称:DSA-lab,代码行数:57,代码来源:main.c


示例13: if

bool CAddress::FromString(const std::string& Str)
{
	if(Str.find(".") != string::npos)
		m_eAF = IPv4;
	else if(Str.find(":") != string::npos)
		m_eAF = IPv6;
	else
		return false;
	return _inet_pton(AF(), Str.c_str(), m_IP) == 1;
}
开发者ID:0vermind,项目名称:NeoLoader,代码行数:10,代码来源:Address.cpp


示例14: getMinARead

				int64_t getMinARead() const
				{
					libmaus2::aio::InputStreamInstance AISI(lasfn);
					libmaus2::dazzler::align::AlignmentFile AF(AISI);
					libmaus2::dazzler::align::Overlap OVL;
					if ( AF.getNextOverlap(AISI,OVL) )
						return OVL.aread;
					else
						return -1;
				}
开发者ID:gt1,项目名称:libmaus2,代码行数:10,代码来源:DalignerIndexDecoder.hpp


示例15: main

int main()
{
    FILE *g;
    l=0;
    head=NULL;
    tail=NULL;
    g=fopen("input.txt", "r");
    char cuvant[15];
    int n;
    if (g==NULL)
    {
        printf("Error in opening the file.");
        exit(1);
    }

    while(fscanf(g,"%s",cuvant)>0)
    {
        if (strcmp(cuvant,"AF")==0)
        {
            fscanf(g,"%d",&n);
            AF(n);
        }
        else if (strcmp(cuvant,"AL")==0)
        {
            fscanf(g,"%d",&n);
            AL(n);
        }
        else if (strcmp(cuvant,"DF")==0)
            DF();
        else if(strcmp(cuvant,"DL")==0)
            DL();
        else if(strcmp(cuvant,"DE")==0)
        {
            fscanf(g,"%d",&n);
            DE(n);
        }
        else if(strcmp(cuvant,"PRINT_ALL")==0)
            PRINT_ALL();
        else if(strcmp(cuvant,"PRINT_F")==0)
        {
            fscanf(g,"%d",&n);
            PRINT_F(n);
        }
        else if(strcmp(cuvant,"PRINT_L")==0)
        {
            fscanf(g,"%d",&n);
            PRINT_L(n);
        }
        else if(strcmp(cuvant,"DOOM_THE_LIST")==0)
            DOOM_THE_LIST();
    }
    fclose(g);
    printf("%d",l);
    return 0;
}
开发者ID:Alecs94,项目名称:DSA-lab,代码行数:55,代码来源:main.c


示例16: sock_hash

/*
 * sock_hash - hash a sockaddr_u structure
 */
u_short
sock_hash(
	sockaddr_u *addr
	)
{
	u_int hashVal;
	u_int j;
	size_t len;
	u_char *pch;
	hashVal = 0;
	len = 0;

	/*
	 * We can't just hash the whole thing because there are hidden
	 * fields in sockaddr_in6 that might be filled in by recvfrom(),
	 * so just use the family, port and address.
	 */
	pch = (u_char *)&AF(addr);
	hashVal = 37 * hashVal + *pch;
	if (sizeof(AF(addr)) > 1) {
		pch++;
		hashVal = 37 * hashVal + *pch;
	}
	switch(AF(addr)) {
	case AF_INET:
		pch = (u_char *)&SOCK_ADDR4(addr);
		len = sizeof(SOCK_ADDR4(addr));
		break;

	case AF_INET6:
		pch = (u_char *)&SOCK_ADDR6(addr);
		len = sizeof(SOCK_ADDR6(addr));
		break;
	}

	for (j = 0; j < len ; j++)
		hashVal = 37 * hashVal + pch[j];

	hashVal = hashVal & NTP_HASH_MASK;

	return (u_short)hashVal;
}
开发者ID:gosudream,项目名称:netbsd-src,代码行数:45,代码来源:ntp_util.c


示例17: main

int main()
{
    FILE* g=fopen("input.dat", "r");

    char t[20];
    int value;
    sent=(sentinel*)malloc(sizeof(sentinel));
    sent->head=NULL;
    sent->tail=NULL;

    while(fscanf(g, "%s", &t)==1)
    {
        if(strcmp(t, "AF")==0)
        {
            fscanf(g, "%d", &value);
            AF(value);
        }
        else if(strcmp(t, "AL")==0)
        {
            fscanf(g, "%d", &value);
            AL(value);
        }
        else if(strcmp(t, "DF")==0)
            DF();
        else if(strcmp(t, "DL")==0)
            DL();
        else if(strcmp(t, "DOOM_THE_LIST")==0)
            DOOM();
        else if(strcmp(t, "DE")==0)
        {
            fscanf(g, "%d", &value);
            DELX(value);
        }
        else if(strcmp(t, "PRINT_ALL")==0)
            PrALL();
        else if(strcmp(t, "PRINT_F")==0)
        {
            fscanf(g, "%d", &value);
            PrFx(value);
        }
        else if(strcmp(t, "PRINT_L")==0)
        {
            fscanf(g, "%d", &value);
            PrLx(value);
        }
    }

    fclose(g);
    return 0;
}
开发者ID:Alecs94,项目名称:DSA-lab,代码行数:50,代码来源:main.c


示例18: findexistingpeer_name

static struct peer *
findexistingpeer_name(
	const char *	hostname,
	u_short		hname_fam,
	struct peer *	start_peer,
	int		mode
	)
{
	struct peer *p;

	if (NULL == start_peer)
		p = peer_list;
	else
		p = start_peer->p_link;
	for (; p != NULL; p = p->p_link)
		if (p->hostname != NULL
		    && (-1 == mode || p->hmode == mode)
		    && (AF_UNSPEC == hname_fam
			|| AF_UNSPEC == AF(&p->srcadr)
			|| hname_fam == AF(&p->srcadr))
		    && !strcasecmp(p->hostname, hostname))
			break;
	return p;
}
开发者ID:VargMon,项目名称:netbsd-cvs-mirror,代码行数:24,代码来源:ntp_peer.c


示例19: pins_init

static void pins_init(void)
{
	/* Pin usage:
	 * PA0  (OUT - OD GPIO)    : Wakeup on Vnc / Threshold
	 * PA1  (ANALOG - ADC_IN1) : CC sense
	 * PA2  (ANALOG - ADC_IN2) : Current sense
	 * PA3  (ANALOG - ADC_IN3) : Voltage sense
	 * PA4  (OUT - OD GPIO)    : PD TX enable
	 * PA5  (AF0 - SPI1_SCK)   : TX clock in
	 * PA6  (AF0 - SPI1_MISO)  : PD TX
	 * PA7  (AF5 - TIM3_CH2)   : PD RX
	 * PA9  (AF1 - UART1_TX)   : [DEBUG] UART TX
	 * PA10 (AF1 - UART1_RX)   : [DEBUG] UART RX
	 * PA13 (OUT - GPIO)       : voltage select[0]
	 * PA14 (OUT - GPIO)       : voltage select[1]
	 * PB1  (AF0 - TIM14_CH1)  : TX clock out
	 * PF0  (OUT - GPIO)       : LM5050 FET driver off
	 * PF1  (OUT - GPIO)       : discharge FET
	 */
	STM32_GPIO_ODR(GPIO_A) = /* HIGH(0) | */ HIGH(4);
	STM32_GPIO_AFRL(GPIO_A) = AFx(7, 1);
	STM32_GPIO_AFRH(GPIO_A) = AFx(9, 1) | AFx(10, 1);
	STM32_GPIO_OTYPER(GPIO_A) = ODR(0) | ODR(4);
	STM32_GPIO_OSPEEDR(GPIO_A) = HISPEED(5) | HISPEED(6) | HISPEED(7);
	STM32_GPIO_MODER(GPIO_A) = OUT(0) | ANALOG(1) | ANALOG(2) | ANALOG(3)
				 | OUT(4) | AF(5) /*| AF(6)*/ | AF(7) | AF(9)
				 | AF(10) | OUT(13) | OUT(14);
	/* set PF0 / PF1 as output */
	STM32_GPIO_ODR(GPIO_F) = 0;
	STM32_GPIO_MODER(GPIO_F) = OUT(0) | OUT(1);
	STM32_GPIO_OTYPER(GPIO_F) = 0;

	/* Set PB1 as AF0 (TIM14_CH1) */
	STM32_GPIO_OSPEEDR(GPIO_B) = HISPEED(1);
	STM32_GPIO_MODER(GPIO_B) = AF(1);
}
开发者ID:gelraen,项目名称:cros-ec,代码行数:36,代码来源:hardware.c


示例20: findexistingpeer

/*
 * findexistingpeer - search by address and return a pointer to a peer.
 */
struct peer *
findexistingpeer(
	sockaddr_u *	addr,
	const char *	hostname,
	struct peer *	start_peer,
	int		mode,
	u_char		cast_flags
	)
{
	if (hostname != NULL)
		return findexistingpeer_name(hostname, AF(addr),
					     start_peer, mode);
	else
		return findexistingpeer_addr(addr, start_peer, mode,
					     cast_flags);
}
开发者ID:VargMon,项目名称:netbsd-cvs-mirror,代码行数:19,代码来源:ntp_peer.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ AFD_DbgPrint函数代码示例发布时间:2022-05-30
下一篇:
C++ AES_set_decrypt_key函数代码示例发布时间: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