本文整理汇总了C++中BCOPY函数的典型用法代码示例。如果您正苦于以下问题:C++ BCOPY函数的具体用法?C++ BCOPY怎么用?C++ BCOPY使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BCOPY函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: upap_sauthreq
/*
* upap_sauthreq - Send an Authenticate-Request.
*/
static void
upap_sauthreq(upap_state *u)
{
u_char *outp;
int outlen;
outlen = UPAP_HEADERLEN + 2 * sizeof (u_char)
+ u->us_userlen + u->us_passwdlen;
outp = outpacket_buf[u->us_unit];
MAKEHEADER(outp, PPP_PAP);
PUTCHAR(UPAP_AUTHREQ, outp);
PUTCHAR(++u->us_id, outp);
PUTSHORT(outlen, outp);
PUTCHAR(u->us_userlen, outp);
BCOPY(u->us_user, outp, u->us_userlen);
INCPTR(u->us_userlen, outp);
PUTCHAR(u->us_passwdlen, outp);
BCOPY(u->us_passwd, outp, u->us_passwdlen);
pppWrite(u->us_unit, outpacket_buf[u->us_unit], outlen + PPP_HDRLEN);
UPAPDEBUG((LOG_INFO, "pap_sauth: Sent id %d\n", u->us_id));
TIMEOUT(upap_timeout, u, u->us_timeouttime);
++u->us_transmits;
u->us_clientstate = UPAPCS_AUTHREQ;
}
开发者ID:krzint,项目名称:Szyfrator_NET,代码行数:32,代码来源:pap.c
示例2: ChapSendResponse
/* ARGSUSED */
static void
ChapSendResponse(
chap_state *cstate)
{
u_char *outp;
int outlen, md_len, name_len;
md_len = cstate->resp_length;
name_len = strlen(cstate->resp_name);
outlen = CHAP_HEADERLEN + sizeof (u_char) + md_len + name_len;
outp = outpacket_buf;
MAKEHEADER(outp, PPP_CHAP);
PUTCHAR(CHAP_RESPONSE, outp); /* we are a response */
PUTCHAR(cstate->resp_id, outp); /* copy id from challenge packet */
PUTSHORT(outlen, outp); /* packet length */
PUTCHAR(md_len, outp); /* length of MD */
BCOPY(cstate->response, outp, md_len); /* copy MD to buffer */
INCPTR(md_len, outp);
BCOPY(cstate->resp_name, outp, name_len); /* append our name */
/* send the packet */
output(cstate->unit, outpacket_buf, outlen + PPP_HDRLEN);
cstate->clientstate = CHAPCS_RESPONSE;
TIMEOUT(ChapResponseTimeout, cstate, cstate->timeouttime);
++cstate->resp_transmits;
}
开发者ID:AoLaD,项目名称:rtems,代码行数:32,代码来源:chap.c
示例3: ChapSendChallenge
/*
* ChapSendChallenge - Send an Authenticate challenge.
*/
static void
ChapSendChallenge(
chap_state *cstate)
{
u_char *outp;
int chal_len, name_len;
int outlen;
chal_len = cstate->chal_len;
name_len = strlen(cstate->chal_name);
outlen = CHAP_HEADERLEN + sizeof (u_char) + chal_len + name_len;
outp = outpacket_buf;
MAKEHEADER(outp, PPP_CHAP); /* paste in a CHAP header */
PUTCHAR(CHAP_CHALLENGE, outp);
PUTCHAR(cstate->chal_id, outp);
PUTSHORT(outlen, outp);
PUTCHAR(chal_len, outp); /* put length of challenge */
BCOPY(cstate->challenge, outp, chal_len);
INCPTR(chal_len, outp);
BCOPY(cstate->chal_name, outp, name_len); /* append hostname */
output(cstate->unit, outpacket_buf, outlen + PPP_HDRLEN);
TIMEOUT(ChapChallengeTimeout, cstate, cstate->timeouttime);
++cstate->chal_transmits;
}
开发者ID:AoLaD,项目名称:rtems,代码行数:33,代码来源:chap.c
示例4: get_secret
/*
* get_secret - open the CHAP secret file and return the secret
* for authenticating the given client on the given server.
* (We could be either client or server).
*/
int
get_secret(int unit, char *client, char *server, char *secret, int *secret_len, int save_addrs)
{
#if 1
int len;
struct wordlist *addrs;
LWIP_UNUSED_ARG(unit);
LWIP_UNUSED_ARG(server);
LWIP_UNUSED_ARG(save_addrs);
addrs = NULL;
if(!client || !client[0] || strcmp(client, ppp_settings.user)) {
return 0;
}
len = (int)strlen(ppp_settings.passwd);
if (len > MAXSECRETLEN) {
AUTHDEBUG(LOG_ERR, ("Secret for %s on %s is too long\n", client, server));
len = MAXSECRETLEN;
}
BCOPY(ppp_settings.passwd, secret, len);
*secret_len = len;
return 1;
#else
int ret = 0, len;
struct wordlist *addrs;
char secbuf[MAXWORDLEN];
addrs = NULL;
secbuf[0] = 0;
/* XXX Find secret. */
if (ret < 0) {
return 0;
}
if (save_addrs) {
set_allowed_addrs(unit, addrs);
}
len = strlen(secbuf);
if (len > MAXSECRETLEN) {
AUTHDEBUG(LOG_ERR, ("Secret for %s on %s is too long\n", client, server));
len = MAXSECRETLEN;
}
BCOPY(secbuf, secret, len);
BZERO(secbuf, sizeof(secbuf));
*secret_len = len;
return 1;
#endif
}
开发者ID:10code,项目名称:lwip,代码行数:62,代码来源:auth.c
示例5: ChapSendStatus
/*
* ChapSendStatus - Send a status response (ack or nak).
*/
static void
ChapSendStatus(
chap_state *cstate,
int code)
{
u_char *outp;
int outlen, msglen;
char msg[256];
if (code == CHAP_SUCCESS)
slprintf(msg, sizeof(msg), "Welcome to %s.", hostname);
else
slprintf(msg, sizeof(msg), "I don't like you. Go 'way.");
msglen = strlen(msg);
outlen = CHAP_HEADERLEN + msglen;
outp = outpacket_buf;
MAKEHEADER(outp, PPP_CHAP); /* paste in a header */
PUTCHAR(code, outp);
PUTCHAR(cstate->chal_id, outp);
PUTSHORT(outlen, outp);
BCOPY(msg, outp, msglen);
output(cstate->unit, outpacket_buf, outlen + PPP_HDRLEN);
}
开发者ID:AoLaD,项目名称:rtems,代码行数:29,代码来源:chap.c
示例6: push_in_progress
static void push_in_progress(ptr_t p)
{
if (n_in_progress >= in_progress_size) {
ptr_t * new_in_progress_space;
if (NULL == in_progress_space) {
in_progress_size = ROUNDUP_PAGESIZE_IF_MMAP(INITIAL_IN_PROGRESS
* sizeof(ptr_t))
/ sizeof(ptr_t);
new_in_progress_space =
(ptr_t *)GET_MEM(in_progress_size * sizeof(ptr_t));
} else {
in_progress_size *= 2;
new_in_progress_space = (ptr_t *)
GET_MEM(in_progress_size * sizeof(ptr_t));
if (new_in_progress_space != NULL)
BCOPY(in_progress_space, new_in_progress_space,
n_in_progress * sizeof(ptr_t));
}
GC_add_to_our_memory((ptr_t)new_in_progress_space,
in_progress_size * sizeof(ptr_t));
# ifndef GWW_VDB
GC_scratch_recycle_no_gww(in_progress_space,
n_in_progress * sizeof(ptr_t));
# elif defined(LINT2)
/* TODO: implement GWW-aware recycling as in alloc_mark_stack */
GC_noop1((word)in_progress_space);
# endif
in_progress_space = new_in_progress_space;
}
if (in_progress_space == 0)
ABORT("MAKE_BACK_GRAPH: Out of in-progress space: "
"Huge linear data structure?");
in_progress_space[n_in_progress++] = p;
}
开发者ID:GWRon,项目名称:brl.mod-NG,代码行数:35,代码来源:backgraph.c
示例7: rawDataPuts
size_t rawDataPuts(RawData *raw_data, const offset_t offset, const char *src)
{
size_t len;
if(raw_data->max_size <= offset)
{
dbg_log(SEC_0132_RAW, 0)(LOGSTDOUT, "error:rawDataPuts: max_size %d, but access offset %d overflow\n", raw_data->max_size, offset);
return 0;
}
if(raw_data->max_size <= offset + strlen(src))
{
dbg_log(SEC_0132_RAW, 0)(LOGSTDOUT, "error:rawDataPuts: max_size %d, but access offset(%d) + strlen(%d) = %d overflow\n",
raw_data->max_size, offset, strlen(src), offset + strlen(src));
}
len = DMIN(strlen(src), raw_data->max_size - offset);
BCOPY(src, raw_data->buffer + offset, len);
if(offset + len > raw_data->cur_size)
{
raw_data->cur_size = offset + len;
}
RAWDATA_SET_DIRTY(raw_data);
return len;
}
开发者ID:petercloud,项目名称:RFS,代码行数:26,代码来源:raw_data.c
示例8: formatGetString
const char * formatGetString (BUFFER_PTR buffer)
{
#define CBUF_LEN 100
static int bufLen = CBUF_LEN;
static char *charBuffer = NULL;
if (charBuffer == NULL) charBuffer = (char *)malloc(bufLen);
int length = formatGetInt(buffer);
if (length == 0) {
charBuffer[0] = '\0';
formatGetChar(buffer); // The 'Z'
} else {
if (length >= bufLen) {
/* Need to re-allocate this array, with room for a null termination */
free(charBuffer);
bufLen = length+1;
charBuffer = (char *)malloc(bufLen);
}
BCOPY(buffer->buffer+buffer->bstart, charBuffer, length);
buffer->bstart += length;
charBuffer[length] = '\0';
}
return charBuffer;
}
开发者ID:StoneAerospace,项目名称:ipc,代码行数:25,代码来源:ipcFFI.c
示例9: push_in_progress
static void push_in_progress(ptr_t p)
{
if (n_in_progress >= in_progress_size) {
if (in_progress_size == 0) {
in_progress_size = INITIAL_IN_PROGRESS;
in_progress_space = (ptr_t *)GET_MEM(in_progress_size * sizeof(ptr_t));
GC_add_to_our_memory((ptr_t)in_progress_space,
in_progress_size * sizeof(ptr_t));
} else {
ptr_t * new_in_progress_space;
in_progress_size *= 2;
new_in_progress_space = (ptr_t *)
GET_MEM(in_progress_size * sizeof(ptr_t));
GC_add_to_our_memory((ptr_t)new_in_progress_space,
in_progress_size * sizeof(ptr_t));
BCOPY(in_progress_space, new_in_progress_space,
n_in_progress * sizeof(ptr_t));
in_progress_space = new_in_progress_space;
/* FIXME: This just drops the old space. */
}
}
if (in_progress_space == 0)
ABORT("MAKE_BACK_GRAPH: Out of in-progress space: "
"Huge linear data structure?");
in_progress_space[n_in_progress++] = p;
}
开发者ID:bsmr-common-lisp,项目名称:xcl,代码行数:26,代码来源:backgraph.c
示例10: map_cpus_to_prstatus_kdump_cmprs
void
map_cpus_to_prstatus_kdump_cmprs(void)
{
void **nt_ptr;
int online, i, j, nrcpus;
size_t size;
if (!(online = get_cpus_online()) || (online == kt->cpus))
return;
if (CRASHDEBUG(1))
error(INFO,
"cpus: %d online: %d NT_PRSTATUS notes: %d (remapping)\n",
kt->cpus, online, dd->num_prstatus_notes);
size = NR_CPUS * sizeof(void *);
nt_ptr = (void **)GETBUF(size);
BCOPY(dd->nt_prstatus_percpu, nt_ptr, size);
BZERO(dd->nt_prstatus_percpu, size);
/*
* Re-populate the array with the notes mapping to online cpus
*/
nrcpus = (kt->kernel_NR_CPUS ? kt->kernel_NR_CPUS : NR_CPUS);
for (i = 0, j = 0; i < nrcpus; i++) {
if (in_cpu_map(ONLINE, i))
dd->nt_prstatus_percpu[i] = nt_ptr[j++];
}
FREEBUF(nt_ptr);
}
开发者ID:Meticulus,项目名称:vendor_st-ericsson_u8500,代码行数:33,代码来源:diskdump.c
示例11: ChapMS
void
ChapMS( chap_state *cstate, char *rchallenge, int rchallenge_len, char *secret, int secret_len)
{
MS_ChapResponse response;
#ifdef MSLANMAN
extern int ms_lanman;
#endif
#if 0
CHAPDEBUG(LOG_INFO, ("ChapMS: secret is '%.*s'\n", secret_len, secret));
#endif
BZERO(&response, sizeof(response));
/* Calculate both always */
ChapMS_NT(rchallenge, rchallenge_len, secret, secret_len, &response);
#ifdef MSLANMAN
ChapMS_LANMan(rchallenge, rchallenge_len, secret, secret_len, &response);
/* prefered method is set by option */
response.UseNT = !ms_lanman;
#else
response.UseNT = 1;
#endif
BCOPY(&response, cstate->response, MS_CHAP_RESPONSE_LEN);
cstate->resp_length = MS_CHAP_RESPONSE_LEN;
}
开发者ID:KonstantinVoip,项目名称:mSdk,代码行数:28,代码来源:chpms.c
示例12: Java_ipc_java_primFmttrs_formatGetString
JNIEXPORT jstring JNICALL Java_ipc_java_primFmttrs_formatGetString (JNIEnv *env,
jclass c, jlong buf)
{
BUFFER_PTR buffer = (BUFFER_PTR)(size_t)buf;
int length = formatGetInt(buffer);
#define CBUF_LEN 100
char charBuffer[CBUF_LEN], *tmp;
jstring theString;
tmp = charBuffer;
if (length == 0) {
charBuffer[0] = '\0';
formatGetChar(buffer);
} else {
if (length >= CBUF_LEN) {
/* Need to allocate this array because NewStringUTF needs a
null-terminated string. Sigh... */
tmp = (char *)malloc(length+1);
}
BCOPY(buffer->buffer+buffer->bstart, tmp, length);
buffer->bstart += length;
tmp[length] = '\0';
}
theString = (*env)->NewStringUTF(env, tmp);
if (length >= CBUF_LEN) free(tmp);
return theString;
}
开发者ID:abhigoudar,项目名称:Coaxial-Copter,代码行数:27,代码来源:ipcjava.c
示例13: auth_peer_success
/*
* The peer has been successfully authenticated using `protocol'.
*/
void
auth_peer_success(int unit, u16_t protocol, char *name, int namelen)
{
int pbit;
AUTHDEBUG((LOG_INFO, "auth_peer_success: %d proto=%X\n", unit, protocol));
switch (protocol) {
case PPP_CHAP:
pbit = CHAP_PEER;
break;
case PPP_PAP:
pbit = PAP_PEER;
break;
default:
AUTHDEBUG((LOG_WARNING, "auth_peer_success: unknown protocol %x\n", protocol));
return;
}
/*
* Save the authenticated name of the peer for later.
*/
if (namelen > sizeof(peer_authname) - 1) {
namelen = sizeof(peer_authname) - 1;
}
BCOPY(name, peer_authname, namelen);
peer_authname[namelen] = 0;
/*
* If there is no more authentication still to be done,
* proceed to the network (or callback) phase.
*/
if ((auth_pending[unit] &= ~pbit) == 0) {
network_phase(unit);
}
}
开发者ID:ThucVD2704,项目名称:femto-usb-blink-example,代码行数:38,代码来源:auth.c
示例14: ChallengeResponse
static void
ChallengeResponse(u_char *challenge,
u_char PasswordHash[MD4_SIGNATURE_SIZE],
u_char response[24])
{
u_char ZPasswordHash[21];
BZERO(ZPasswordHash, sizeof(ZPasswordHash));
BCOPY(PasswordHash, ZPasswordHash, MD4_SIGNATURE_SIZE);
#if 0
dbglog("ChallengeResponse - ZPasswordHash %.*B",
sizeof(ZPasswordHash), ZPasswordHash);
#endif
(void) DesSetkey(ZPasswordHash + 0);
DesEncrypt(challenge, response + 0);
(void) DesSetkey(ZPasswordHash + 7);
DesEncrypt(challenge, response + 8);
(void) DesSetkey(ZPasswordHash + 14);
DesEncrypt(challenge, response + 16);
#if 0
dbglog("ChallengeResponse - response %.24B", response);
#endif
}
开发者ID:jhbsz,项目名称:DIR-850L_A1,代码行数:26,代码来源:chap_ms.c
示例15: rawDataWrite
size_t rawDataWrite(RawData *raw_data, const offset_t offset, const void *src, size_t size, size_t nmemb)
{
size_t count;
size_t len;
if(raw_data->max_size <= offset)
{
dbg_log(SEC_0132_RAW, 0)(LOGSTDOUT, "error:rawDataWrite: max_size %d, but access offset %d overflow\n", raw_data->max_size, offset);
return 0;
}
if(0 == size || 0 == nmemb)
{
return 0;
}
if(raw_data->max_size <= offset + size * nmemb)
{
dbg_log(SEC_0132_RAW, 0)(LOGSTDOUT, "error:rawDataWrite: max_size %d, but access offset(%d) + size(%d) * nmemb(%d) = %d overflow\n",
raw_data->max_size, offset, size, nmemb, offset + size * nmemb);
}
count = DMIN(nmemb, (raw_data->max_size - offset)/size);
len = size * count;
BCOPY(src, raw_data->buffer + offset, len);
if(offset + len > raw_data->cur_size)
{
raw_data->cur_size = offset + len;
}
RAWDATA_SET_DIRTY(raw_data);
return count;
}
开发者ID:petercloud,项目名称:RFS,代码行数:33,代码来源:raw_data.c
示例16: x_ipc_findElement
const void *x_ipc_hashTableInsert(const void *key, int32 keySize,
const void *item, HASH_TABLE_PTR table)
{
const char *oldData;
int32 hash, location;
HASH_ELEM_PTR tmp, element;
char *keyPtr=NULL;
hash = (*table->hashFunc)(key);
location = hash % table->size;
tmp = table->table[location];
if (tmp) {
tmp = x_ipc_findElement(table->eqFunc, tmp, key);
if (tmp) {
/* replace item with new information */
oldData = tmp->data;
tmp->data = (const char *)item;
return oldData;
}
}
element = NEW(HASH_ELEM_TYPE);
keyPtr = (char *)x_ipcMalloc((unsigned)keySize);
BCOPY(key, keyPtr, keySize);
element->key = (const char *) keyPtr;
element->data = (const char *)item;
element->next = table->table[location];
table->table[location] = element;
return NULL;
}
开发者ID:huang-qiao,项目名称:carmen,代码行数:32,代码来源:hash.c
示例17: mfs_auditview_to_mfs_auditview_32
void
mfs_auditview_to_mfs_auditview_32(struct mfs_auditview *vbl, struct mfs_auditview_32 *vbl_32)
{
vbl_32->namlen = vbl->namlen;
tbs_uuid_s_to_tbs_uuid_s_32(&vbl->viewuuid, &vbl_32->viewuuid);
BCOPY(&vbl->name[0], &vbl_32->name[0], vbl->namlen+1);
}
开发者ID:msteinert,项目名称:mvfs,代码行数:7,代码来源:mvfs_transtype.c
示例18: ensure_toggleref_capacity
static GC_bool ensure_toggleref_capacity(int capacity_inc)
{
GC_ASSERT(capacity_inc >= 0);
if (NULL == GC_toggleref_arr) {
GC_toggleref_array_capacity = 32; /* initial capacity */
GC_toggleref_arr = GC_INTERNAL_MALLOC_IGNORE_OFF_PAGE(
GC_toggleref_array_capacity * sizeof(GCToggleRef),
NORMAL);
if (NULL == GC_toggleref_arr)
return FALSE;
}
if ((unsigned)GC_toggleref_array_size + (unsigned)capacity_inc
>= (unsigned)GC_toggleref_array_capacity) {
GCToggleRef *new_array;
while ((unsigned)GC_toggleref_array_capacity
< (unsigned)GC_toggleref_array_size + (unsigned)capacity_inc) {
GC_toggleref_array_capacity *= 2;
if (GC_toggleref_array_capacity < 0) /* overflow */
return FALSE;
}
new_array = GC_INTERNAL_MALLOC_IGNORE_OFF_PAGE(
GC_toggleref_array_capacity * sizeof(GCToggleRef),
NORMAL);
if (NULL == new_array)
return FALSE;
BCOPY(GC_toggleref_arr, new_array,
GC_toggleref_array_size * sizeof(GCToggleRef));
GC_INTERNAL_FREE(GC_toggleref_arr);
GC_toggleref_arr = new_array;
}
return TRUE;
}
开发者ID:Mercury-Language,项目名称:bdwgc,代码行数:33,代码来源:finalize.c
示例19: mppe_set_keys
/*
* Set mppe_xxxx_key from the NTPasswordHashHash.
* RFC 2548 (RADIUS support) requires us to export this function (ugh).
*/
void
mppe_set_keys(u_char *rchallenge, u_char PasswordHashHash[MD4_SIGNATURE_SIZE])
{
SHA1_CTX sha1Context;
u_char Digest[SHA1_SIGNATURE_SIZE]; /* >= MPPE_MAX_KEY_LEN */
SHA1_Init(&sha1Context);
SHA1_Update(&sha1Context, PasswordHashHash, MD4_SIGNATURE_SIZE);
SHA1_Update(&sha1Context, PasswordHashHash, MD4_SIGNATURE_SIZE);
SHA1_Update(&sha1Context, rchallenge, 8);
SHA1_Final(Digest, &sha1Context);
/* Same key in both directions. */
BCOPY(Digest, mppe_send_key, sizeof(mppe_send_key));
BCOPY(Digest, mppe_recv_key, sizeof(mppe_recv_key));
}
开发者ID:jhbsz,项目名称:DIR-850L_A1,代码行数:20,代码来源:chap_ms.c
示例20: GC_debug_realloc
void * GC_debug_realloc(void * p, size_t lb, GC_EXTRA_PARAMS)
{
void * base = GC_base(p);
ptr_t clobbered;
void * result;
size_t copy_sz = lb;
size_t old_sz;
hdr * hhdr;
if (p == 0) return(GC_debug_malloc(lb, OPT_RA s, i));
if (base == 0) {
GC_err_printf("Attempt to reallocate invalid pointer %p\n", p);
ABORT("realloc(invalid pointer)");
}
if ((ptr_t)p - (ptr_t)base != sizeof(oh)) {
GC_err_printf(
"GC_debug_realloc called on pointer %p wo debugging info\n", p);
return(GC_realloc(p, lb));
}
hhdr = HDR(base);
switch (hhdr -> hb_obj_kind) {
# ifdef STUBBORN_ALLOC
case STUBBORN:
result = GC_debug_malloc_stubborn(lb, OPT_RA s, i);
break;
# endif
case NORMAL:
result = GC_debug_malloc(lb, OPT_RA s, i);
break;
case PTRFREE:
result = GC_debug_malloc_atomic(lb, OPT_RA s, i);
break;
case UNCOLLECTABLE:
result = GC_debug_malloc_uncollectable(lb, OPT_RA s, i);
break;
# ifdef ATOMIC_UNCOLLECTABLE
case AUNCOLLECTABLE:
result = GC_debug_malloc_atomic_uncollectable(lb, OPT_RA s, i);
break;
# endif
default:
GC_err_printf("GC_debug_realloc: encountered bad kind\n");
ABORT("bad kind");
}
# ifdef SHORT_DBG_HDRS
old_sz = GC_size(base) - sizeof(oh);
# else
clobbered = GC_check_annotated_obj((oh *)base);
if (clobbered != 0) {
GC_err_printf("GC_debug_realloc: found smashed location at ");
GC_print_smashed_obj(p, clobbered);
}
old_sz = ((oh *)base) -> oh_sz;
# endif
if (old_sz < copy_sz) copy_sz = old_sz;
if (result == 0) return(0);
BCOPY(p, result, copy_sz);
GC_debug_free(p);
return(result);
}
开发者ID:0xDEC0DE8,项目名称:mcsema,代码行数:60,代码来源:dbg_mlc.c
注:本文中的BCOPY函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论