您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ typemask函数代码示例

51自学网 2021-06-03 09:02:41
  C++
这篇教程C++ typemask函数代码示例写得很实用,希望能帮到您。

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

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

示例1: EncryptDisable

intEncryptDisable(char *type, char *mode){	Encryptions *ep;	int ret = 0;	if (isprefix(type, "help") || isprefix(type, "?")) {		printf("Usage: encrypt disable <type> [input|output]/n");		encrypt_list_types();	} else if ((ep = (Encryptions *)genget(type, (char **)encryptions,						sizeof(Encryptions))) == 0) {		printf("%s: invalid encryption type/n", type);	} else if (Ambiguous((char **)ep)) {		printf("Ambiguous type '%s'/n", type);	} else {		if ((mode == 0) || (isprefix(mode, "input") ? 1 : 0)) {			if (decrypt_mode == ep->type)				EncryptStopInput();			i_wont_support_decrypt |= typemask(ep->type);			ret = 1;		}		if ((mode == 0) || (isprefix(mode, "output"))) {			if (encrypt_mode == ep->type)				EncryptStopOutput();			i_wont_support_encrypt |= typemask(ep->type);			ret = 1;		}		if (ret == 0)			printf("%s: invalid encryption mode/n", mode);	}	return(ret);}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:32,


示例2: encrypt_init

voidencrypt_init(const char *name, int server){	Encryptions *ep = encryptions;	Name = name;	Server = server;	i_support_encrypt = i_support_decrypt = 0;	remote_supports_encrypt = remote_supports_decrypt = 0;	encrypt_mode = 0;	decrypt_mode = 0;	encrypt_output = 0;	decrypt_input = 0;	str_suplen = 4;	while (ep->type) {		if (encrypt_debug_mode)			printf(">>>%s: I will support %s/r/n",				Name, ENCTYPE_NAME(ep->type));		i_support_encrypt |= typemask(ep->type);		i_support_decrypt |= typemask(ep->type);		if ((i_wont_support_decrypt & typemask(ep->type)) == 0)			if ((str_send[str_suplen++] = ep->type) == IAC)				str_send[str_suplen++] = IAC;		if (ep->init)			(*ep->init)(Server);		++ep;	}	str_send[str_suplen++] = IAC;	str_send[str_suplen++] = SE;}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:32,


示例3: auth_request

/* * This routine is called by the server to start authentication * negotiation. */voidauth_request(void){	static unsigned char str_request[64] = { IAC, SB,						 TELOPT_AUTHENTICATION,						 TELQUAL_SEND, };	Authenticator *ap = authenticators;	unsigned char *e = str_request + 4;	if (!authenticating) {		authenticating = 1;		while (ap->type) {			if (i_support & ~i_wont_support & typemask(ap->type)) {				if (auth_debug_mode) {					printf(">>>%s: Sending type %d %d/r/n",						Name, ap->type, ap->way);				}				*e++ = ap->type;				*e++ = ap->way;			}			++ap;		}		*e++ = IAC;		*e++ = SE;		net_write(str_request, e - str_request);		printsub('>', &str_request[2], e - str_request - 2);	}}
开发者ID:seco,项目名称:freebsd-pi,代码行数:32,


示例4: auth_onoff

intauth_onoff(char *type, int on){	int i, mask = -1;	Authenticator *ap;	if (!strcasecmp(type, "?") || !strcasecmp(type, "help")) {		printf("auth %s 'type'/n", on ? "enable" : "disable");		printf("Where 'type' is one of:/n");		printf("/t%s/n", AUTHTYPE_NAME(0));		mask = 0;		for (ap = authenticators; ap->type; ap++) {			if ((mask & (i = typemask(ap->type))) != 0)				continue;			mask |= i;			printf("/t%s/n", AUTHTYPE_NAME(ap->type));		}		return(0);	}	if (!getauthmask(type, &mask)) {		printf("%s: invalid authentication type/n", type);		return(0);	}	if (on)		i_wont_support &= ~mask;	else		i_wont_support |= mask;	return(1);}
开发者ID:seco,项目名称:freebsd-pi,代码行数:30,


示例5: auth_init

voidauth_init(const char *name, int server){	Authenticator *ap = authenticators;	Server = server;	Name = name;	i_support = 0;	authenticated = 0;	authenticating = 0;	while (ap->type) {		if (!ap->init || (*ap->init)(ap, server)) {			i_support |= typemask(ap->type);			if (auth_debug_mode)				printf(">>>%s: I support auth type %d %d/r/n",					Name,					ap->type, ap->way);		}		else if (auth_debug_mode)			printf(">>>%s: Init failed: auth type %d %d/r/n",				Name, ap->type, ap->way);		++ap;	}}
开发者ID:seco,项目名称:freebsd-pi,代码行数:25,


示例6: auth_init

voidauth_init (char *name, int server){  TN_Authenticator *ap = authenticators;  Server = server;  Name = name;  i_support = 0;  authenticated = 0;  authenticating = 0;  while (ap->type)    {      if (!ap->init || (*ap->init) (ap, server))	{	  i_support |= typemask (ap->type);	  if (auth_debug_mode)	    printf (">>>%s: I support auth type %s (%d) %s (%d)/r/n",		    Name,		    AUTHTYPE_NAME_OK (ap->type) ?		    AUTHTYPE_NAME (ap->type) :		    "unknown",		    ap->type,		    ap->way &		    AUTH_HOW_MASK &		    AUTH_HOW_MUTUAL ? "MUTUAL" : "ONEWAY", ap->way);	}      else if (auth_debug_mode)	printf (">>>%s: Init failed: auth type %d %d/r/n",		Name, ap->type, ap->way);      ++ap;    }}
开发者ID:millken,项目名称:zhuxianB30,代码行数:33,


示例7: auth_disable_name

voidauth_disable_name(char *name){	int x;	for (x = 0; x < AUTHTYPE_CNT; ++x) {		if (AUTHTYPE_NAME(x) && !strcasecmp(name, AUTHTYPE_NAME(x))) {			i_wont_support |= typemask(x);			break;		}	}}
开发者ID:seco,项目名称:freebsd-pi,代码行数:11,


示例8: finddecryption

static Encryptions *finddecryption(int type){	Encryptions *ep = encryptions;	if (!(I_SUPPORT_DECRYPT & remote_supports_encrypt & (unsigned)typemask(type)))		return(0);	while (ep->type && ep->type != type)		++ep;	return(ep->type ? ep : 0);}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:11,


示例9: auth_status

intauth_status(void){	Authenticator *ap;	int i, mask;	if (i_wont_support == -1)		printf("Authentication disabled/n");	else		printf("Authentication enabled/n");	mask = 0;	for (ap = authenticators; ap->type; ap++) {		if ((mask & (i = typemask(ap->type))) != 0)			continue;		mask |= i;		printf("%s: %s/n", AUTHTYPE_NAME(ap->type),			(i_wont_support & typemask(ap->type)) ?					"disabled" : "enabled");	}	return(1);}
开发者ID:seco,项目名称:freebsd-pi,代码行数:22,


示例10: encrypt_support

/* * Called when ENCRYPT SUPPORT is received. */voidencrypt_support(unsigned char *typelist, int cnt){	int type, use_type = 0;	Encryptions *ep;	/*	 * Forget anything the other side has previously told us.	 */	remote_supports_decrypt = 0;	while (cnt-- > 0) {		type = *typelist++;		if (encrypt_debug_mode)			printf(">>>%s: He is supporting %s (%d)/r/n",				Name,				ENCTYPE_NAME(type), type);		if ((type < ENCTYPE_CNT) &&		    (I_SUPPORT_ENCRYPT & typemask(type))) {			remote_supports_decrypt |= typemask(type);			if (use_type == 0)				use_type = type;		}	}	if (use_type) {		ep = findencryption(use_type);		if (!ep)			return;		type = ep->start ? (*ep->start)(DIR_ENCRYPT, Server) : 0;		if (encrypt_debug_mode)			printf(">>>%s: (*ep->start)() returned %d/r/n",					Name, type);		if (type < 0)			return;		encrypt_mode = use_type;		if (type == 0)			encrypt_start_output(use_type);	}}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:42,


示例11: getauthmask

intgetauthmask(char *type, int *maskp){	int x;	if (AUTHTYPE_NAME(0) && !strcasecmp(type, AUTHTYPE_NAME(0))) {		*maskp = -1;		return(1);	}	for (x = 1; x < AUTHTYPE_CNT; ++x) {		if (AUTHTYPE_NAME(x) && !strcasecmp(type, AUTHTYPE_NAME(x))) {			*maskp = typemask(x);			return(1);		}	}	return(0);}
开发者ID:seco,项目名称:freebsd-pi,代码行数:18,


示例12: encrypt_is

voidencrypt_is(unsigned char *data, int cnt){	Encryptions *ep;	int type, ret;	if (--cnt < 0)		return;	type = *data++;	if (type < ENCTYPE_CNT)		remote_supports_encrypt |= typemask(type);	if (!(ep = finddecryption(type))) {		if (encrypt_debug_mode)			printf(">>>%s: Can't find type %s (%d) for initial negotiation/r/n",				Name,				ENCTYPE_NAME_OK(type)					? ENCTYPE_NAME(type) : "(unknown)",				type);		return;	}	if (!ep->is) {		if (encrypt_debug_mode)			printf(">>>%s: No initial negotiation needed for type %s (%d)/r/n",				Name,				ENCTYPE_NAME_OK(type)					? ENCTYPE_NAME(type) : "(unknown)",				type);		ret = 0;	} else {		ret = (*ep->is)(data, cnt);		if (encrypt_debug_mode)			printf("(*ep->is)(%p, %d) returned %s(%d)/n", data, cnt,				(ret < 0) ? "FAIL " :				(ret == 0) ? "SUCCESS " : "MORE_TO_DO ", ret);	}	if (ret < 0) {		autodecrypt = 0;	} else {		decrypt_mode = type;		if (ret == 0 && autodecrypt)			encrypt_send_request_start();	}}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:43,


示例13: P

void	(*encrypt_output) P((unsigned char *, int));int	(*decrypt_input) P((int));int encrypt_debug_mode = 0;static int decrypt_mode = 0;static int encrypt_mode = 0;static int encrypt_verbose = 0;static int autoencrypt = 0;static int autodecrypt = 0;static int havesessionkey = 0;static int Server = 0;static char *Name = "Noname";#define	typemask(x)	((x) > 0 ? 1 << ((x)-1) : 0)static long i_support_encrypt = typemask(ENCTYPE_DES_CFB64)				| typemask(ENCTYPE_DES_OFB64);static long i_support_decrypt = typemask(ENCTYPE_DES_CFB64)				| typemask(ENCTYPE_DES_OFB64);static long i_wont_support_encrypt = 0;static long i_wont_support_decrypt = 0;#define	I_SUPPORT_ENCRYPT	(i_support_encrypt & ~i_wont_support_encrypt)#define	I_SUPPORT_DECRYPT	(i_support_decrypt & ~i_wont_support_decrypt)static long remote_supports_encrypt = 0;static long remote_supports_decrypt = 0;static Encryptions encryptions[] = {#ifdef	DES_ENCRYPTION    { "DES_CFB64",	ENCTYPE_DES_CFB64,			cfb64_encrypt,	
开发者ID:Ayvo4ka,项目名称:telnet,代码行数:31,


示例14: auth_send

/* * This is called when an AUTH SEND is received. * It should never arrive on the server side (as only the server can * send an AUTH SEND). * You should probably respond to it if you can... * * If you want to respond to the types out of order (i.e. even * if he sends  LOGIN KERBEROS and you support both, you respond * with KERBEROS instead of LOGIN (which is against what the * protocol says)) you will have to hack this code... */voidauth_send(unsigned char *data, int cnt){	Authenticator *ap;	static unsigned char str_none[] = { IAC, SB, TELOPT_AUTHENTICATION,					    TELQUAL_IS, AUTHTYPE_NULL, 0,					    IAC, SE };	if (Server) {		if (auth_debug_mode) {			printf(">>>%s: auth_send called!/r/n", Name);		}		return;	}	if (auth_debug_mode) {		printf(">>>%s: auth_send got:", Name);		printd(data, cnt); printf("/r/n");	}	/*	 * Save the data, if it is new, so that we can continue looking	 * at it if the authorization we try doesn't work	 */	if (data < _auth_send_data ||	    data > _auth_send_data + sizeof(_auth_send_data)) {		auth_send_cnt = (size_t)cnt > sizeof(_auth_send_data)					? sizeof(_auth_send_data)					: cnt;		memmove((void *)_auth_send_data, (void *)data, auth_send_cnt);		auth_send_data = _auth_send_data;	} else {		/*		 * This is probably a no-op, but we just make sure		 */		auth_send_data = data;		auth_send_cnt = cnt;	}	while ((auth_send_cnt -= 2) >= 0) {		if (auth_debug_mode)			printf(">>>%s: He supports %d/r/n",				Name, *auth_send_data);		if ((i_support & ~i_wont_support) & typemask(*auth_send_data)) {			ap = findauthenticator(auth_send_data[0],					       auth_send_data[1]);			if (ap && ap->send) {				if (auth_debug_mode)					printf(">>>%s: Trying %d %d/r/n",						Name, auth_send_data[0],							auth_send_data[1]);				if ((*ap->send)(ap)) {					/*					 * Okay, we found one we like					 * and did it.					 * we can go home now.					 */					if (auth_debug_mode)						printf(">>>%s: Using type %d/r/n",							Name, *auth_send_data);					auth_send_data += 2;					return;				}			}			/* else			 *	just continue on and look for the			 *	next one if we didn't do anything.			 */		}		auth_send_data += 2;	}	net_write(str_none, sizeof(str_none));	printsub('>', &str_none[2], sizeof(str_none) - 2);	if (auth_debug_mode)		printf(">>>%s: Sent failure message/r/n", Name);	auth_finished(0, AUTH_REJECT);}
开发者ID:seco,项目名称:freebsd-pi,代码行数:86,


示例15: auth_send

/* * This is called when an AUTH SEND is received. * It should never arrive on the server side (as only the server can * send an AUTH SEND). * You should probably respond to it if you can... * * If you want to respond to the types out of order (i.e. even * if he sends  LOGIN KERBEROS and you support both, you respond * with KERBEROS instead of LOGIN (which is against what the * protocol says)) you will have to hack this code... */voidauth_send (unsigned char *data, int cnt){  TN_Authenticator *ap;  static unsigned char str_none[] = { IAC, SB, TELOPT_AUTHENTICATION,    TELQUAL_IS, AUTHTYPE_NULL, 0,    IAC, SE  };  if (Server)    {      if (auth_debug_mode)	{	  printf (">>>%s: auth_send called!/r/n", Name);	}      return;    }  if (auth_debug_mode)    {      printf (">>>%s: auth_send got:", Name);      printd (data, cnt);      printf ("/r/n");    }  /*   * Save the data, if it is new, so that we can continue looking   * at it if the authorization we try doesn't work   */  if (data < _auth_send_data ||      data > _auth_send_data + sizeof (_auth_send_data))    {      auth_send_cnt = cnt > sizeof (_auth_send_data)	? sizeof (_auth_send_data) : cnt;      memmove ((void *) _auth_send_data, (void *) data, auth_send_cnt);      auth_send_data = _auth_send_data;    }  else    {      /*       * This is probably a no-op, but we just make sure       */      auth_send_data = data;      auth_send_cnt = cnt;    }  while ((auth_send_cnt -= 2) >= 0)    {      if (auth_debug_mode)	printf (">>>%s: He supports %s (%d) %s (%d)/r/n",		Name, AUTHTYPE_NAME_OK (auth_send_data[0]) ?		AUTHTYPE_NAME (auth_send_data[0]) :		"unknown",		auth_send_data[0],		auth_send_data[1] &		AUTH_HOW_MASK &		AUTH_HOW_MUTUAL ? "MUTUAL" : "ONEWAY", auth_send_data[1]);      if ((i_support & ~i_wont_support) & typemask (*auth_send_data))	{	  ap = findauthenticator (auth_send_data[0], auth_send_data[1]);	  if (ap && ap->send)	    {	      if (auth_debug_mode)		printf (">>>%s: Trying %s (%d) %s (%d)/r/n",			Name,			AUTHTYPE_NAME_OK (auth_send_data[0]) ?			AUTHTYPE_NAME (auth_send_data[0]) :			"unknown",			auth_send_data[0],			auth_send_data[1] &			AUTH_HOW_MASK &			AUTH_HOW_MUTUAL ?			"MUTUAL" : "ONEWAY", auth_send_data[1]);	      if ((*ap->send) (ap))		{		  /*		   * Okay, we found one we like		   * and did it.		   * we can go home now.		   */		  if (auth_debug_mode)		    printf (">>>%s: Using type %s (%d)/r/n",			    Name,			    AUTHTYPE_NAME_OK (*auth_send_data) ?			    AUTHTYPE_NAME (*auth_send_data) :			    "unknown", *auth_send_data);		  auth_send_data += 2;		  return;		}	    }	  /* else//.........这里部分代码省略.........
开发者ID:millken,项目名称:zhuxianB30,代码行数:101,


示例16: EncryptStopOutput

int EncryptStopOutput(void);int encrypt_debug_mode = 0;static int decrypt_mode = 0;static int encrypt_mode = 0;static int encrypt_verbose = 0;static int autoencrypt = 0;static int autodecrypt = 0;static int havesessionkey = 0;static int Server = 0;static const char *Name = "Noname";#define	typemask(x)	((x) > 0 ? 1 << ((x)-1) : 0)static u_long i_support_encrypt = 0 | typemask(ENCTYPE_DES_CFB64) | typemask(ENCTYPE_DES_OFB64) |0;static u_long i_support_decrypt = 0 | typemask(ENCTYPE_DES_CFB64) | typemask(ENCTYPE_DES_OFB64) |0;static u_long i_wont_support_encrypt = 0;static u_long i_wont_support_decrypt = 0;#define	I_SUPPORT_ENCRYPT	(i_support_encrypt & ~i_wont_support_encrypt)#define	I_SUPPORT_DECRYPT	(i_support_decrypt & ~i_wont_support_decrypt)static u_long remote_supports_encrypt = 0;static u_long remote_supports_decrypt = 0;static Encryptions encryptions[] = {    { "DES_CFB64",	ENCTYPE_DES_CFB64,
开发者ID:AmirAbrams,项目名称:haiku,代码行数:31,



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


C++ tzset函数代码示例
C++ typelib_static_mi_interface_type_init函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。