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


C++ CVAL函数代码示例

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


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

示例1: filter_reply

static void filter_reply(char *buf)
{
	int msg_type = CVAL(buf,0);
	int type = CVAL(buf,smb_com);
	unsigned x;

	if (msg_type) return;

	switch (type) {

	case SMBnegprot:
		/* force the security bits */
		x = CVAL(buf, smb_vwv1);
		x = (x | SECURITY_SET) & ~SECURITY_MASK;
		SCVAL(buf, smb_vwv1, x);

		/* force the capabilities */
		x = IVAL(buf,smb_vwv9+1);
		x = (x | CAPABILITY_SET) & ~CAPABILITY_MASK;
		SIVAL(buf, smb_vwv9+1, x);
		break;

	}
}
开发者ID:dmitry-shavyrin,项目名称:samba4_embedded_build,代码行数:24,代码来源:smbfilter.c

示例2: srv_calculate_sign_mac

void srv_calculate_sign_mac(struct smbd_server_connection *conn,
                            char *outbuf, uint32_t seqnum)
{
    uint8_t *outhdr;
    size_t len;

    /* Check if it's a non-session message. */
    if(CVAL(outbuf,0)) {
        return;
    }

    len = smb_len(outbuf);
    outhdr = (uint8_t *)outbuf + NBT_HDR_SIZE;

    smb_signing_sign_pdu(conn->smb1.signing_state, outhdr, len, seqnum);
}
开发者ID:rchicoli,项目名称:samba,代码行数:16,代码来源:signing.c

示例3: reply_lockingX_error

static void reply_lockingX_error(struct blocking_lock_record *blr, NTSTATUS status)
{
	files_struct *fsp = blr->fsp;
	uint16 num_ulocks = SVAL(blr->req->vwv+6, 0);
	uint64_t count = (uint64_t)0, offset = (uint64_t) 0;
	uint32 lock_pid;
	unsigned char locktype = CVAL(blr->req->vwv+3, 0);
	bool large_file_format = (locktype & LOCKING_ANDX_LARGE_FILES);
	uint8_t *data;
	int i;

	data = (uint8_t *)blr->req->buf
		+ ((large_file_format ? 20 : 10)*num_ulocks);

	/* 
	 * Data now points at the beginning of the list
	 * of smb_lkrng structs.
	 */

	/*
	 * Ensure we don't do a remove on the lock that just failed,
	 * as under POSIX rules, if we have a lock already there, we
	 * will delete it (and we shouldn't) .....
	 */

	for(i = blr->lock_num - 1; i >= 0; i--) {
		bool err;

		lock_pid = get_lock_pid( data, i, large_file_format);
		count = get_lock_count( data, i, large_file_format);
		offset = get_lock_offset( data, i, large_file_format, &err);

		/*
		 * We know err cannot be set as if it was the lock
		 * request would never have been queued. JRA.
		 */

		do_unlock(smbd_messaging_context(),
			fsp,
			lock_pid,
			count,
			offset,
			WINDOWS_LOCK);
	}

	generic_blocking_lock_error(blr, status);
}
开发者ID:gojdic,项目名称:samba,代码行数:47,代码来源:blocking.c

示例4: prs_uint8

BOOL prs_uint8(const char *name, prs_struct *ps, int depth, uint8 *data8)
{
	char *q = prs_mem_get(ps, 1);
	if (q == NULL)
		return False;

    if (UNMARSHALLING(ps))
		*data8 = CVAL(q,0);
	else
		SCVAL(q,0,*data8);

    DEBUG(5,("%s%04x %s: %02x\n", tab_depth(depth), ps->data_offset, name, *data8));

	ps->data_offset += 1;

	return True;
}
开发者ID:jophxy,项目名称:samba,代码行数:17,代码来源:parse_prs.c

示例5: undo_locks_obtained

static void undo_locks_obtained(struct blocking_lock_record *blr)
{
	files_struct *fsp = blr->fsp;
	uint16 num_ulocks = SVAL(blr->req->vwv+6, 0);
	uint64_t count = (uint64_t)0, offset = (uint64_t) 0;
	uint64_t smblctx;
	unsigned char locktype = CVAL(blr->req->vwv+3, 0);
	bool large_file_format = (locktype & LOCKING_ANDX_LARGE_FILES);
	uint8_t *data;
	int i;

	data = discard_const_p(uint8_t, blr->req->buf)
		+ ((large_file_format ? 20 : 10)*num_ulocks);

	/*
	 * Data now points at the beginning of the list
	 * of smb_lkrng structs.
	 */

	/*
	 * Ensure we don't do a remove on the lock that just failed,
	 * as under POSIX rules, if we have a lock already there, we
	 * will delete it (and we shouldn't) .....
	 */

	for(i = blr->lock_num - 1; i >= 0; i--) {
		bool err;

		smblctx = get_lock_pid( data, i, large_file_format);
		count = get_lock_count( data, i, large_file_format);
		offset = get_lock_offset( data, i, large_file_format, &err);

		/*
		 * We know err cannot be set as if it was the lock
		 * request would never have been queued. JRA.
		 */

		do_unlock(fsp->conn->sconn->msg_ctx,
			fsp,
			smblctx,
			count,
			offset,
			WINDOWS_LOCK);
	}
}
开发者ID:AIdrifter,项目名称:samba,代码行数:45,代码来源:blocking.c

示例6: reply_lockingX_error

static void reply_lockingX_error(blocking_lock_record *blr, NTSTATUS status)
{
	char *inbuf = blr->inbuf;
	files_struct *fsp = blr->fsp;
	connection_struct *conn = conn_find(SVAL(inbuf,smb_tid));
	uint16 num_ulocks = SVAL(inbuf,smb_vwv6);
	SMB_BIG_UINT count = (SMB_BIG_UINT)0, offset = (SMB_BIG_UINT) 0;
	uint16 lock_pid;
	unsigned char locktype = CVAL(inbuf,smb_vwv3);
	BOOL large_file_format = (locktype & LOCKING_ANDX_LARGE_FILES);
	char *data;
	int i;

	data = smb_buf(inbuf) + ((large_file_format ? 20 : 10)*num_ulocks);
	
	/* 
	 * Data now points at the beginning of the list
	 * of smb_lkrng structs.
	 */

	/*
	 * Ensure we don't do a remove on the lock that just failed,
	 * as under POSIX rules, if we have a lock already there, we
	 * will delete it (and we shouldn't) .....
	 */
	
	for(i = blr->lock_num - 1; i >= 0; i--) {
		BOOL err;
		
		lock_pid = get_lock_pid( data, i, large_file_format);
		count = get_lock_count( data, i, large_file_format);
		offset = get_lock_offset( data, i, large_file_format, &err);
		
		/*
		 * We know err cannot be set as if it was the lock
		 * request would never have been queued. JRA.
		 */
		
		do_unlock(fsp,conn,lock_pid,count,offset);
	}
	
	generic_blocking_lock_error(blr, status);
}
开发者ID:hajuuk,项目名称:R7000,代码行数:43,代码来源:blocking.c

示例7: cancel_pending_lock_requests_by_fid

void cancel_pending_lock_requests_by_fid(files_struct *fsp, struct byte_range_lock *br_lck)
{
	struct blocking_lock_record *blr, *blr_cancelled, *next = NULL;

	for(blr = blocking_lock_queue; blr; blr = next) {
		unsigned char locktype = 0;

		next = blr->next;
		if (blr->fsp->fnum != fsp->fnum) {
			continue;
		}

		if (blr->req->cmd == SMBlockingX) {
			locktype = CVAL(blr->req->vwv+3, 0);
		}

		DEBUG(10, ("remove_pending_lock_requests_by_fid - removing "
			   "request type %d for file %s fnum = %d\n",
			   blr->req->cmd, fsp->fsp_name, fsp->fnum));

		blr_cancelled = blocking_lock_cancel(fsp,
				     blr->lock_pid,
				     blr->offset,
				     blr->count,
				     blr->lock_flav,
				     locktype,
				     NT_STATUS_RANGE_NOT_LOCKED);

		SMB_ASSERT(blr_cancelled == blr);

		brl_lock_cancel(br_lck,
				blr->lock_pid,
				procid_self(),
				blr->offset,
				blr->count,
				blr->lock_flav,
				blr);

		/* We're closing the file fsp here, so ensure
		 * we don't have a dangling pointer. */
		blr->fsp = NULL;
	}
}
开发者ID:gojdic,项目名称:samba,代码行数:43,代码来源:blocking.c

示例8: switch

char *va_to_string(Value value)
{
    switch (value.type) {
        case VAL_TYPE_STR:
            return strdup(SVAL(value));
        case VAL_TYPE_BOOL:
            return strdup(IVAL(value) ? "true" : "false");
        case VAL_TYPE_INT:
            {
                char *num_str = malloc(VALUE_STR_CONVERT_SIZE);

                if (num_str == NULL) {
                    return NULL;
                }

                snprintf(num_str, VALUE_STR_CONVERT_SIZE, "%ld", IVAL(value));

                return num_str;
            }
        case VAL_TYPE_FLOAT:
            {
                char *num_str = malloc(VALUE_STR_CONVERT_SIZE);

                if (num_str == NULL) {
                    return NULL;
                }

                snprintf(num_str, VALUE_STR_CONVERT_SIZE, "%f", FVAL(value));

                return num_str;
            }
        case VAL_TYPE_REGEX:
            return strdup(RVAL(value).regex_pattern);
        case VAL_TYPE_SHELL_COMMAND:
            return strdup(CVAL(value));
        default:
            assert(!"Invalid value type");
            break;
    }

    return NULL;
}
开发者ID:rgburke,项目名称:wed,代码行数:42,代码来源:value.c

示例9: assert

const char *sum_as_hex(const char *sum)
{
	static char buf[MAX_DIGEST_LEN*2+1];
	int i, x1, x2;
	char *c = buf + checksum_len*2;

	assert(c - buf < (int)sizeof buf);

	*c = '\0';

	for (i = checksum_len; --i >= 0; ) {
		x1 = CVAL(sum, i);
		x2 = x1 >> 4;
		x1 &= 0xF;
		*--c = x1 <= 9 ? x1 + '0' : x1 + 'a' - 10;
		*--c = x2 <= 9 ? x2 + '0' : x2 + 'a' - 10;
	}

	return buf;
}
开发者ID:JevonQ,项目名称:rsync,代码行数:20,代码来源:util2.c

示例10: read_smb_length

ssize_t read_smb_length(int fd,char *inbuf,unsigned int timeout)
{
  ssize_t len;

  for(;;)
  {
    len = read_smb_length_return_keepalive(fd, inbuf, timeout);

    if(len < 0)
      return len;

    /* Ignore session keepalives. */
    if(CVAL(inbuf,0) != 0x85)
      break;
  }

  DEBUG(10,("read_smb_length: got smb length of %d\n",len));

  return len;
}
开发者ID:BackupTheBerlios,项目名称:wl530g-svn,代码行数:20,代码来源:util_sock.c

示例11: srv_check_sign_mac

bool srv_check_sign_mac(struct smbd_server_connection *conn,
                        const char *inbuf, uint32_t *seqnum,
                        bool trusted_channel)
{
    const uint8_t *inhdr;
    size_t len;

    /* Check if it's a non-session message. */
    if(CVAL(inbuf,0)) {
        return true;
    }

    len = smb_len(inbuf);
    inhdr = (const uint8_t *)inbuf + NBT_HDR_SIZE;

    if (trusted_channel) {
        NTSTATUS status;

        if (len < (HDR_SS_FIELD + 8)) {
            DEBUG(1,("smb_signing_check_pdu: Can't check signature "
                     "on short packet! smb_len = %u\n",
                     (unsigned)len));
            return false;
        }

        status = NT_STATUS(IVAL(inhdr, HDR_SS_FIELD + 4));
        if (!NT_STATUS_IS_OK(status)) {
            DEBUG(1,("smb_signing_check_pdu: trusted channel passed %s\n",
                     nt_errstr(status)));
            return false;
        }

        *seqnum = IVAL(inhdr, HDR_SS_FIELD);
        return true;
    }

    *seqnum = smb_signing_next_seqnum(conn->smb1.signing_state, false);
    return smb_signing_check_pdu(conn->smb1.signing_state,
                                 inhdr, len,
                                 *seqnum);
}
开发者ID:rchicoli,项目名称:samba,代码行数:41,代码来源:signing.c

示例12: client_receive_smb

BOOL client_receive_smb(int fd,char *buffer, unsigned int timeout)
{
  BOOL ret;

  for(;;)
  {
    ret = receive_smb(fd, buffer, timeout);

    if (!ret)
    {
      DEBUG(10,("client_receive_smb failed\n"));
      show_msg(buffer);
      return ret;
    }

    /* Ignore session keepalive packets. */
    if(CVAL(buffer,0) != 0x85)
      break;
  }
  show_msg(buffer);
  return ret;
}
开发者ID:BackupTheBerlios,项目名称:wl530g-svn,代码行数:22,代码来源:util_sock.c

示例13: interpret_short_filename

static int interpret_short_filename(struct cli_state *cli, char *p,file_info *finfo)
{

	*finfo = def_finfo;

	finfo->cli = cli;
	finfo->mode = CVAL(p,21);
	
	/* this date is converted to GMT by make_unix_date */
	finfo->ctime_ts.tv_sec = cli_make_unix_date(cli, p+22);
	finfo->ctime_ts.tv_nsec = 0;
	finfo->mtime_ts.tv_sec = finfo->atime_ts.tv_sec = finfo->ctime_ts.tv_sec;
	finfo->mtime_ts.tv_nsec = finfo->atime_ts.tv_nsec = 0;
	finfo->size = IVAL(p,26);
	clistr_pull(cli, finfo->name, p+30, sizeof(finfo->name), 12, STR_ASCII);
	if (strcmp(finfo->name, "..") && strcmp(finfo->name, ".")) {
		strncpy(finfo->short_name,finfo->name, sizeof(finfo->short_name)-1);
		finfo->short_name[sizeof(finfo->short_name)-1] = '\0';
	}

	return(DIR_STRUCT_SIZE);
}
开发者ID:AllardJ,项目名称:Tomato,代码行数:22,代码来源:clilist.c

示例14: announce_local_master_browser_to_domain_master_browser

static void announce_local_master_browser_to_domain_master_browser( struct work_record *work)
{
  pstring outbuf;
  char *p;

  if(ismyip(work->dmb_addr))
  {
    if( DEBUGLVL( 2 ) )
    {
      dbgtext( "announce_local_master_browser_to_domain_master_browser:\n" );
      dbgtext( "We are both a domain and a local master browser for " );
      dbgtext( "workgroup %s.  ", work->work_group );
      dbgtext( "Do not announce to ourselves.\n" );
    }
    return;
  }

  memset(outbuf,'\0',sizeof(outbuf));
  p = outbuf;
  CVAL(p,0) = ANN_MasterAnnouncement;
  p++;

  StrnCpy(p,global_myname,15);
  strupper(p);
  p = skip_string(p,1);

  if( DEBUGLVL( 4 ) )
  {
    dbgtext( "announce_local_master_browser_to_domain_master_browser:\n" );
    dbgtext( "Sending local master announce to " );
    dbgtext( "%s for workgroup %s.\n", nmb_namestr(&work->dmb_name),
                                       work->work_group );
  }

  send_mailslot(True, BROWSE_MAILSLOT, outbuf,PTR_DIFF(p,outbuf),
		global_myname, 0x0, work->dmb_name.name, 0x0, 
		work->dmb_addr, FIRST_SUBNET->myip, DGRAM_PORT);

}
开发者ID:AllardJ,项目名称:Tomato,代码行数:39,代码来源:nmbd_browsesync.c

示例15: cli_message_start

/****************************************************************************
start a message sequence
****************************************************************************/
BOOL cli_message_start(struct cli_state *cli, char *host, char *username, 
			      int *grp)
{
	return False;
#if 0
	char *p;

	/* send a SMBsendstrt command */
	memset(cli->outbuf,'\0',smb_size);
	set_message(cli->outbuf,0,0,True);
	CVAL(cli->outbuf,smb_com) = SMBsendstrt;
	SSVAL(cli->outbuf,smb_tid,cli->cnum);
	cli_setup_packet(cli);
	
	p = smb_buf(cli->outbuf);
	*p++ = 4;
	pstrcpy(p,username);
	unix_to_dos(p,True);
	p = skip_string(p,1);
	*p++ = 4;
	pstrcpy(p,host);
	unix_to_dos(p,True);
	p = skip_string(p,1);
	
	set_message(cli->outbuf,0,PTR_DIFF(p,smb_buf(cli->outbuf)),False);
	
	cli_send_smb(cli);	
	
	if (!cli_receive_smb(cli)) {
		return False;
	}

	if (cli_error(cli, NULL, NULL, NULL)) return False;

	*grp = SVAL(cli->inbuf,smb_vwv0);

	return True;
#endif
}
开发者ID:pombredanne,项目名称:cliffs,代码行数:42,代码来源:climessage.c


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