这篇教程C++ BCOPY函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中BCOPY函数的典型用法代码示例。如果您正苦于以下问题:C++ BCOPY函数的具体用法?C++ BCOPY怎么用?C++ BCOPY使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了BCOPY函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: upap_sauthreq/* * upap_sauthreq - Send an Authenticate-Request. */static voidupap_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,
示例2: ChapSendResponse/* ARGSUSED */static voidChapSendResponse( 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,
示例3: ChapSendChallenge/* * ChapSendChallenge - Send an Authenticate challenge. */static voidChapSendChallenge( 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,
示例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). */intget_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,
示例5: ChapSendStatus/* * ChapSendStatus - Send a status response (ack or nak). */static voidChapSendStatus( 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,
示例6: push_in_progressstatic 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,
示例7: rawDataPutssize_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,
示例8: formatGetStringconst 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,
示例9: push_in_progressstatic 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,
示例10: map_cpus_to_prstatus_kdump_cmprsvoidmap_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,
示例11: ChapMSvoidChapMS( 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,
示例12: Java_ipc_java_primFmttrs_formatGetStringJNIEXPORT 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,
示例13: auth_peer_success/* * The peer has been successfully authenticated using `protocol'. */voidauth_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,
示例14: ChallengeResponsestatic voidChallengeResponse(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,
示例15: rawDataWritesize_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,
示例16: x_ipc_findElementconst 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,
示例17: mfs_auditview_to_mfs_auditview_32void 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,
示例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,
示例19: mppe_set_keys/* * Set mppe_xxxx_key from the NTPasswordHashHash. * RFC 2548 (RADIUS support) requires us to export this function (ugh). */voidmppe_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,
示例20: GC_debug_reallocvoid * 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,
示例21: DecodeDoublefloat DecodeDouble(GENERIC_DATA_PTR DataArray, int32 Start){ double Double; DataArray += Start; BCOPY(DataArray, (char *)&Double, sizeof(double)); return Double;}
开发者ID:StoneAerospace,项目名称:ipc,代码行数:8,
示例22: EncodeFloat/* LISP floating point numbers are equivalent to C "double" format */void EncodeFloat(double Float, GENERIC_DATA_PTR DataArray, int32 Start){ float RealFloat; DataArray += Start; RealFloat = (float)Float; BCOPY((char *)&RealFloat, DataArray, sizeof(float));}
开发者ID:StoneAerospace,项目名称:ipc,代码行数:9,
示例23: DecodeFloat/* LISP floating point numbers are equivalent to C "double" format */double DecodeFloat(GENERIC_DATA_PTR DataArray, int32 Start){ float Float; DataArray += Start; BCOPY(DataArray, (char *)&Float, sizeof(float)); return (double)Float;}
开发者ID:StoneAerospace,项目名称:ipc,代码行数:9,
示例24: BCOPYint hapsLocalLocus::typeSpecificCopy(localLocus *s){ hapsLocalLocus *src=(hapsLocalLocus *)s; if (localLocus::typeSpecificCopy(src)==0) return 0; BCOPY(rsName,src->rsName); return 1;}
开发者ID:davenomiddlenamecurtis,项目名称:geneVarAssoc,代码行数:8,
示例25: vnlayer_unpack_fhSTATIC intvnlayer_unpack_fh( __u32 *fh, int len, /* counted in units of 4-bytes */ int fhtype, int fidlen, MDKI_FID_T *lfidp, MDKI_FID_T *plfidp){ if (len * sizeof(*fh) < fhtype) { /* * we put the size in the type on the way out; * make sure we have enough data returning now */ MDKI_VFS_LOG(VFS_LOG_ESTALE, "%s: FH doesn't have enough data for type:" " has %d need %d/n", __func__, (int)(len * sizeof(*fh)), fhtype); return -EINVAL; } if ((fhtype & 1) != 0) { /* * The type/length must be even (there are two equal-sized * halves in the payload). Somebody might be fabricating file * handles? */ MDKI_VFS_LOG(VFS_LOG_ESTALE, "%s: FH type (%d) not even/n", __func__, fhtype); return -EINVAL; } if (lfidp != NULL) { /* object */ lfidp->fid_len = fidlen; BCOPY(fh, lfidp->fid_data, fidlen); } if (plfidp != NULL) { /* parent */ plfidp->fid_len = fidlen; BCOPY(((caddr_t)fh) + fidlen, plfidp->fid_data, fidlen); } return 0;}
开发者ID:dagwieers,项目名称:mvfs80,代码行数:45,
示例26: mvfs_credutl_sid_s_to_credutl_sid_s_32voidmvfs_credutl_sid_s_to_credutl_sid_s_32(struct credutl_sid_s *vbl, struct credutl_sid_s *vbl_32){ vbl_32->length = vbl->length; vbl_32->type = vbl->type; BCOPY((caddr_t)&vbl->sid[0], (caddr_t)&vbl_32->sid[0], sizeof(vbl->sid));}
开发者ID:msteinert,项目名称:mvfs,代码行数:9,
示例27: GC_debug_reallocGC_API void * GC_CALL GC_debug_realloc(void * p, size_t lb, GC_EXTRA_PARAMS){ void * base; void * result; hdr * hhdr; if (p == 0) return(GC_debug_malloc(lb, OPT_RA s, i)); base = GC_base(p); if (base == 0) { GC_err_printf("Attempt to reallocate invalid pointer %p/n", p); ABORT("Invalid pointer passed to realloc()"); } if ((ptr_t)p - (ptr_t)base != sizeof(oh)) { GC_err_printf( "GC_debug_realloc called on pointer %p w/o 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: result = NULL; /* initialized to prevent warning. */ GC_err_printf("GC_debug_realloc: encountered bad kind/n"); ABORT("Bad kind"); } if (result != NULL) { size_t old_sz;# ifdef SHORT_DBG_HDRS old_sz = GC_size(base) - sizeof(oh);# else old_sz = ((oh *)base) -> oh_sz;# endif BCOPY(p, result, old_sz < lb ? old_sz : lb); GC_debug_free(p); } return(result);}
开发者ID:dariaphoebe,项目名称:bdwgc,代码行数:57,
示例28: process_fddivoidprocess_fddi(register u_char *u, register const struct pcap_pkthdr *h, register const u_char *p){ register struct fddi_header *fh; register struct ether_arp *ea; register u_char *sea, *sha; register time_t t; u_int32_t sia; fh = (struct fddi_header *)p; ea = (struct ether_arp *)(fh + 1); if (!swapped) { bit_reverse(fh->src, 6); bit_reverse(fh->dst, 6); } if (!sanity_fddi(fh, ea, h->caplen)) return; /* Source MAC hardware ethernet address */ sea = (u_char *)fh->src; /* Source ARP ethernet address */ sha = (u_char *)SHA(ea); /* Source ARP ip address */ BCOPY(SPA(ea), &sia, 4); /* Watch for bogons */ if (isbogon(sia)) { dosyslog(LOG_INFO, "bogon", sia, sea, sha); return; } /* Watch for ethernet broadcast */ if (MEMCMP(sea, zero, 6) == 0 || MEMCMP(sea, allones, 6) == 0 || MEMCMP(sha, zero, 6) == 0 || MEMCMP(sha, allones, 6) == 0) { dosyslog(LOG_INFO, "ethernet broadcast", sia, sea, sha); return; } /* Double check ethernet addresses */ if (MEMCMP(sea, sha, 6) != 0) { dosyslog(LOG_INFO, "ethernet mismatch", sia, sea, sha); return; } /* Got a live one */ t = h->ts.tv_sec; can_checkpoint = 0; if (!ent_add(sia, sea, t, NULL)) syslog(LOG_ERR, "ent_add(%s, %s, %ld) failed", intoa(sia), e2str(sea), t); can_checkpoint = 1;}
开发者ID:einyx,项目名称:arpwatch,代码行数:56,
示例29: x_ipc_dataMsgReplaceClassDataDATA_MSG_PTR x_ipc_dataMsgReplaceClassData(CONST_FORMAT_PTR classFormat, void *data, DATA_MSG_PTR dataMsg, CONST_FORMAT_PTR msgFormat){#ifdef UNUSED_PRAGMA#pragma unused(msgFormat)#endif DATA_MSG_PTR newDataMsg; int32 classTotal=0; if (data && classFormat) classTotal = x_ipc_bufferSize(classFormat, data); newDataMsg = x_ipc_dataMsgAlloc(sizeof(DATA_MSG_TYPE)+classTotal); /* 3-Sep-90: fedor: this should work because class info is in the dataMsg struture as the last item. */ BCOPY((char *)dataMsg, (char *)newDataMsg, sizeof(DATA_MSG_TYPE)); if (classTotal) { newDataMsg->classData = ((char *)newDataMsg + sizeof(DATA_MSG_TYPE)); x_ipc_encodeData(classFormat, data, newDataMsg->classData, 0, classTotal); newDataMsg->classByteOrder = BYTE_ORDER; } else newDataMsg->classData = NULL; /* reset msgData pointer */ newDataMsg->msgData = dataMsg->msgData; newDataMsg->dataStruct = dataMsg->dataStruct; dataMsg->msgData = NULL; /* Need to copy the vector data. */ if (dataMsg->vec != NULL) newDataMsg->vec = x_ipc_copyVectorization(dataMsg->vec,0); else { X_IPC_MOD_ERROR("Internal Error: Missing data Vector/n"); return NULL; } /* set refCount */ newDataMsg->dataRefCountPtr = dataMsg->dataRefCountPtr; if ( newDataMsg->dataRefCountPtr != NULL) (*(newDataMsg->dataRefCountPtr))++; newDataMsg->refCount = 0; newDataMsg->classTotal = classTotal; if (x_ipc_dataMsgFree(dataMsg) != NULL) dataMsg->msgData = newDataMsg->msgData; return newDataMsg;}
开发者ID:acekiller,项目名称:MasterThesis,代码行数:55,
示例30: the/* Find string with the given enumerated value, and copy the string into the (already allocated) LISP vector */char *enumValNameString (CONST_FORMAT_PTR format, int32 enumVal){ char *name; if (format->formatter.a[0].i > 2 && 0 <= enumVal && enumVal <= ENUM_MAX_VAL(format)) { name = format->formatter.a[enumVal+2].f->formatter.name; BCOPY(name, (char *)Vecdata(SymbolValue(lisp_value(0))), strlen(name)); } return (char *)SymbolValue(lisp_value(0));}
开发者ID:StoneAerospace,项目名称:ipc,代码行数:13,
注:本文中的BCOPY函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ BC_ASSERT_PTR_NOT_NULL函数代码示例 C++ BCON_NEW函数代码示例 |