本文整理汇总了C++中OS_MEMCPY函数的典型用法代码示例。如果您正苦于以下问题:C++ OS_MEMCPY函数的具体用法?C++ OS_MEMCPY怎么用?C++ OS_MEMCPY使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OS_MEMCPY函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ieee80211_aow_send_to_host
int32_t ieee80211_aow_send_to_host(struct ieee80211com* ic, u_int8_t* data,
u_int32_t len, u_int16_t type, u_int16_t subtype, u_int8_t* addr)
{
u_int8_t buf[AOW_MAX_HOST_PKT_SIZE];
aow_host_pkt_t *p;
u_int32_t plen = 0;
if (len > (AOW_MAX_HOST_PKT_SIZE - AOW_HOST_PKT_SIZE)) {
return -EINVAL;
}
if (!is_aow_usb_calls_registered()) {
return -EINVAL;
}
p = (aow_host_pkt_t*)buf;
p->signature = ATH_AOW_SIGNATURE;
p->type = type;
p->subtype = subtype;
p->length = len;
p->data = buf + AOW_HOST_PKT_SIZE;
if (addr) {
OS_MEMCPY(p->addr, addr, IEEE80211_ADDR_LEN);
}
plen = len + AOW_HOST_PKT_SIZE;
OS_MEMCPY(p->data, data, len);
wlan_aow_dev.rx.recv_ctrl((u_int8_t*)p, plen);
return 0;
}
示例2: ar5416AniAttach
/*
* Setup ANI handling. Sets all thresholds and reset the
* channel statistics. Note that ar5416AniReset should be
* called by ar5416Reset before anything else happens and
* that's where we force initial settings.
*/
void
ar5416AniAttach(struct ath_hal *ah, const struct ar5212AniParams *params24,
const struct ar5212AniParams *params5, HAL_BOOL enable)
{
struct ath_hal_5212 *ahp = AH5212(ah);
if (params24 != AH_NULL) {
OS_MEMCPY(&ahp->ah_aniParams24, params24, sizeof(*params24));
setPhyErrBase(ah, &ahp->ah_aniParams24);
}
if (params5 != AH_NULL) {
OS_MEMCPY(&ahp->ah_aniParams5, params5, sizeof(*params5));
setPhyErrBase(ah, &ahp->ah_aniParams5);
}
OS_MEMZERO(ahp->ah_ani, sizeof(ahp->ah_ani));
/* Enable MIB Counters */
enableAniMIBCounters(ah, &ahp->ah_aniParams24 /*XXX*/);
if (enable) { /* Enable ani now */
HALASSERT(params24 != AH_NULL && params5 != AH_NULL);
ahp->ah_procPhyErr |= HAL_ANI_ENA;
} else {
ahp->ah_procPhyErr &= ~HAL_ANI_ENA;
}
}
示例3: mi_tbl_add
mi_node_t *
mi_tbl_add(EXTAP_DBG_PARM mi_node_t **root, u_int8_t *ip, u_int8_t *mac, int ipver)
{
int i, len = mi_ip_len(ipver);
mi_node_t *a;
/*
* Non unicast addresses should not be added. Since the
* addresses being added come from ARP request/response
* (for IPv4), or Neighbor Discovery/Advertisement
* (for IPv6) packets, the input need not be validated.
*/
if ((a = mi_tbl_lkup2(*root, ip, ipver)) != NULL) {
eadbg3("%s(%d): ignore dup " eamstr " for " eaistr "\n",
f, l, eamac(mac), eaip(ip));
return a;
}
for (i = 0; i < NUM_MITBL_ENTRIES; i++) {
if (mi_node_is_free(&mi_tbl[i])) {
OS_MEMCPY(mi_tbl[i].h_dest, mac, ETH_ALEN);
OS_MEMCPY(mi_tbl[i].ip, ip, len);
mi_tbl[i].ip_ver = ipver;
mi_tbl[i].len = len;
eadbg3("%s(%d): saving " eamstr " for " eaistr "\n",
f, l, eamac(mac), eaip(ip));
return &mi_tbl[i];
}
}
eadbg3("%s(%d): cant save " eamstr " for " eaistr "\n",
f, l, eamac(mac), eaip(ip));
return NULL;
}
示例4: visSwap64
/**
* visSwap64
*
* The function domSwap64 executes a byte swap on the given 64 bit value if it
* is necessary. (The big/little endian configuration of this libraries host and
* the attached remote RTS is different.)
*
* Note: This function only works if this library is connected to a remote
* ATCMControl Run Time System. (If it is not connected, this function
* returns always the input value untouched!)
*
* I uVal 64 bit input value to be converted if necessary.
*
* return Swapped/Original 64 bit value - see above.
*
*/
void visSwap64(VIS_DATA *pVaL)
{
IEC_ULINT ullSrc;
IEC_ULINT ullDest;
OS_MEMCPY(&ullSrc, pVaL, sizeof(IEC_ULINT));
ullDest = domSwap64(&g_VI, ullSrc);
OS_MEMCPY(pVaL, &ullDest, sizeof(IEC_ULINT));
}
示例5: test_pop_pbb
void
test_pop_pbb(void) {
static const uint8_t odhost[] = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab };
static const uint8_t oshost[] = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54 };
static const uint8_t idhost[] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55 };
static const uint8_t ishost[] = { 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb };
struct port port;
struct action_list action_list;
struct action *action;
struct ofp_action_pop_mpls *action_pop;
struct lagopus_packet pkt;
OS_MBUF *m;
TAILQ_INIT(&action_list);
action = calloc(1, sizeof(*action));
action_pop = (struct ofp_action_pop_mpls *)&action->ofpat;
action_pop->type = OFPAT_POP_PBB;
lagopus_set_action_function(action);
TAILQ_INSERT_TAIL(&action_list, action, entry);
m = calloc(1, sizeof(*m));
TEST_ASSERT_NOT_EQUAL_MESSAGE(m, NULL, "calloc error.");
m->data = &m->dat[128];
OS_M_PKTLEN(m) = 64 + 18;
OS_MEMCPY(&m->data[0], odhost, ETH_ALEN);
OS_MEMCPY(&m->data[6], oshost, ETH_ALEN);
m->data[12] = 0x88;
m->data[13] = 0xe7;
m->data[14] = 0x00;
m->data[15] = 0x11;
m->data[16] = 0x22;
m->data[17] = 0x33;
/* dhost and shost */
OS_MEMCPY(&m->data[18], idhost, ETH_ALEN);
OS_MEMCPY(&m->data[24], ishost, ETH_ALEN);
m->data[30] = 0x08;
m->data[31] = 0x00;
m->data[32] = 0x45;
lagopus_set_in_port(&pkt, &port);
lagopus_packet_init(&pkt, m);
execute_action(&pkt, &action_list);
TEST_ASSERT_EQUAL_MESSAGE(OS_M_PKTLEN(m), 64,
"POP_PBB length error.");
TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(&m->data[0], idhost, ETH_ALEN,
"POP_PBB ether_dhost error.");
TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(&m->data[6], ishost, ETH_ALEN,
"POP_PBB ether_shost error.");
TEST_ASSERT_EQUAL_MESSAGE(m->data[12], 0x08,
"POP_PBB ethertype[0] error.");
TEST_ASSERT_EQUAL_MESSAGE(m->data[13], 0x00,
"POP_PBB ethertype[1] error.");
}
示例6: setUp
void
setUp(void) {
size_t s;
lagopus_ip_address_t *addr;
struct sockaddr_in *sin;
uint8_t *p;
/* Make the root flowinfo. */
TEST_ASSERT_NULL(flowinfo);
flowinfo = new_flowinfo_vlan_vid();
TEST_ASSERT_NOT_NULL(flowinfo);
TEST_ASSERT_FLOWINFO_FLOW_NUM(flowinfo, 0, __func__);
/*
* Make the test flows.
*
* ARP matches have the prerequisite.
*/
for (s = 0; s < ARRAY_LEN(test_flow); s++) {
TEST_ASSERT_NULL(test_flow[s]);
test_flow[s] = allocate_test_flow(10 * sizeof(struct match));
TEST_ASSERT_NOT_NULL(test_flow[s]);
test_flow[s]->priority = (int)s;
FLOW_ADD_ARP_PREREQUISITE(test_flow[s]);
}
/* Make the test addresses. */
for (s = 0; s < ARRAY_LEN(test_flow); s++) {
lagopus_ip_address_create(ipv4srcstr, true, &addr);
sin = NULL;
lagopus_ip_address_sockaddr_get(addr, &sin);
lagopus_ip_address_destroy(addr);
p = (uint8_t *)&sin->sin_addr.s_addr;
p[sizeof(sin->sin_addr.s_addr) - 1] = (uint8_t)(TEST_IPV4_ADDR_LSB(s) & 0xff);
OS_MEMCPY(&ipv4src[s], &sin->sin_addr, sizeof(ipv4src[s]));
lagopus_ip_address_create(ipv4tgtstr, true, &addr);
sin = NULL;
lagopus_ip_address_sockaddr_get(addr, &sin);
lagopus_ip_address_destroy(addr);
p = (uint8_t *)&sin->sin_addr.s_addr;
p[sizeof(sin->sin_addr.s_addr) - 1] = (uint8_t)(TEST_IPV4_ADDR_LSB(s) & 0xff);
OS_MEMCPY(&ipv4tgt[s], &sin->sin_addr, sizeof(ipv4tgt[s]));
lagopus_ip_address_create(ipv4maskstr, true, &addr);
sin = NULL;
lagopus_ip_address_sockaddr_get(addr, &sin);
lagopus_ip_address_destroy(addr);
OS_MEMCPY(&ipv4mask[s], &sin->sin_addr, sizeof(ipv4mask[s]));
}
}
示例7: visLogin
/**
* visLogin
*
* Login to a connected remote ATCMControl Run Time System and retrieve the actual
* project ID from the attached RTS.
*
* This function will fail, if no project is loaded on the attached RTS.
*
* return OK if successful, else error number.
*/
VIS_UINT visLogin(void)
{
SVisInfo *pVI = &g_VI;
IEC_UINT uRes = OK;
IEC_DATA *pData = NULL;
if (pVI->bInitialized == FALSE)
{
RETURN(ERR_INIT);
}
if (pVI->bLogin == TRUE)
{
visLogout();
}
uRes = domGetProjVersion(pVI, &pData);
if (uRes != OK)
{
RETURN(uRes);
}
OS_MEMCPY(pVI->pProjectID, pData, VMM_GUID);
osFree(&pData);
uRes = domLogin(pVI, pVI->pProjectID);
if (uRes == OK)
{
pVI->bLogin = TRUE;
}
RETURN(uRes);
}
示例8: pktlog_text
int
pktlog_text(struct ath_softc *sc, const char *tbuf, u_int32_t iflags)
{
size_t len;
struct ath_pktlog_info *pl_info;
u_int8_t *data;
u_int32_t flags = iflags;
if (!tbuf)
return 0;
if (g_pktlog_mode == PKTLOG_MODE_ADAPTER)
pl_info = sc->pl_info;
else
pl_info = g_pktlog_info;
if (!pl_info || ((pl_info->log_state & ATH_PKTLOG_TEXT) == 0)) {
return 0;
}
flags |= (((sc->ah_mac_rev << PHFLAGS_MACREV_SFT) & PHFLAGS_MACREV_MASK) |
((sc->ah_mac_version << PHFLAGS_MACVERSION_SFT) & PHFLAGS_MACVERSION_MASK));
len = strlen(tbuf);
data = (u_int8_t *)pktlog_getbuf(sc, pl_info, PKTLOG_TYPE_TEXT, len, flags);
OS_MEMCPY(data, tbuf, len);
return 1;
}
示例9: ieee80211_create_infra_bss
/*
* Create a HOSTAP node on current channel based on ssid.
*/
int
ieee80211_create_infra_bss(struct ieee80211vap *vap,
const u_int8_t *essid,
const u_int16_t esslen)
{
struct ieee80211com *ic = vap->iv_ic;
struct ieee80211_node *ni;
ni = ieee80211_alloc_node(&ic->ic_sta, vap, vap->iv_myaddr);
if (ni == NULL)
return -ENOMEM;
IEEE80211_ADDR_COPY(ni->ni_bssid, vap->iv_myaddr);
ni->ni_esslen = esslen;
OS_MEMCPY(ni->ni_essid, essid, ni->ni_esslen);
ni->ni_intval = ic->ic_intval;
if (IEEE80211_VAP_IS_PRIVACY_ENABLED(vap)) {
ni->ni_capinfo |= IEEE80211_CAPINFO_PRIVACY;
ni->ni_rsn = vap->iv_rsn; /* use local RSN settings as the BSS setting */
}
/* Set the node htcap to be same as ic htcap */
ni->ni_htcap = ic->ic_htcap;
IEEE80211_ADD_NODE_TARGET(ni, ni->ni_vap, 1);
/* copy the original bssinfo into the new ni BugID: Ev# 73905 */
ieee80211_copy_bss(ni, vap->iv_bss);
return ieee80211_sta_join_bss(ni);
}
示例10: wlan_mlme_get_appie
/* Get application defined IEs */
int wlan_mlme_get_appie(wlan_if_t vaphandle, ieee80211_frame_type ftype, u_int8_t *buf, u_int32_t *ielen, u_int32_t buflen)
{
struct ieee80211vap *vap = vaphandle;
int error = 0;
IEEE80211_DPRINTF(vap, IEEE80211_MSG_MLME, "%s\n", __func__);
ASSERT(ftype < IEEE80211_FRAME_TYPE_MAX);
if (ftype >= IEEE80211_FRAME_TYPE_MAX) {
error = -EINVAL;
goto exit;
}
*ielen = vap->iv_app_ie[ftype].length;
/* verify output buffer is large enough */
if (buflen < vap->iv_app_ie[ftype].length) {
error = -EOVERFLOW;
goto exit;
}
IEEE80211_VAP_LOCK(vap);
/* copy app ie contents to output buffer */
if (*ielen) {
OS_MEMCPY(buf, vap->iv_app_ie[ftype].ie, vap->iv_app_ie[ftype].length);
}
IEEE80211_VAP_UNLOCK(vap);
exit:
return error;
}
示例11: OS_MEMCPY
/**
* utilIecToAnsi
*
* Converts an IEC string to a null terminated ANSI string. The ANSI
* string is truncated if necessary.
*
* Note: szAnsi must be sized at least (MAX_IEC_STRLEN + 1)!
*/
IEC_CHAR *utilIecToAnsi(IEC_STRING OS_LPTR *strIEC, IEC_CHAR *szAnsi)
{
OS_MEMCPY(szAnsi, strIEC->Contents, strIEC->CurLen);
szAnsi[strIEC->CurLen] = 0;
return szAnsi;
}
示例12: ieee80211_power_alloc_tim_bitmap
int ieee80211_power_alloc_tim_bitmap(struct ieee80211vap *vap)
{
u_int8_t *tim_bitmap = NULL;
u_int32_t old_len = vap->iv_tim_len;
//printk("[%s] entry\n",__func__);
vap->iv_tim_len = howmany(vap->iv_max_aid, 8) * sizeof(u_int8_t);
tim_bitmap = OS_MALLOC(vap->iv_ic->ic_osdev, vap->iv_tim_len, 0);
if(!tim_bitmap) {
vap->iv_tim_len = old_len;
return -1;
}
OS_MEMZERO(tim_bitmap, vap->iv_tim_len);
if (vap->iv_tim_bitmap) {
OS_MEMCPY(tim_bitmap, vap->iv_tim_bitmap,
vap->iv_tim_len > old_len ? old_len : vap->iv_tim_len);
OS_FREE(vap->iv_tim_bitmap);
}
vap->iv_tim_bitmap = tim_bitmap;
//printk("[%s] exits\n",__func__);
return 0;
}
示例13: wlan_mlme_get_optie
/* Get optional application defined IEs */
int wlan_mlme_get_optie(wlan_if_t vaphandle, u_int8_t *buf, u_int32_t *ielen, u_int32_t buflen)
{
struct ieee80211vap *vap = vaphandle;
int error = 0;
IEEE80211_DPRINTF(vap, IEEE80211_MSG_MLME, "%s\n", __func__);
*ielen = vap->iv_opt_ie.length;
/* verify output buffer is large enough */
if (buflen < vap->iv_opt_ie.length) {
error = -EOVERFLOW;
goto exit;
}
IEEE80211_VAP_LOCK(vap);
/* copy opt ie contents to output buffer */
if (*ielen) {
OS_MEMCPY(buf, vap->iv_opt_ie.ie, vap->iv_opt_ie.length);
}
IEEE80211_VAP_UNLOCK(vap);
exit:
return error;
}
示例14: OS_GET_RANDOM_BYTES
/**
* @brief noise histogrm response
*
* @param rrm
* @param ie
*
* @return
*/
u_int8_t *ieee80211_rrm_send_nhist_resp(ieee80211_rrm_t rrm,u_int8_t *ie)
{
struct ieee80211_nhistrsp *rsp=NULL;
struct ieee80211_measrsp_ie *measrsp=NULL;
struct ieee80211_rrmreq_info *params=NULL;
unsigned long tsf;
#if UMAC_SUPPORT_RRM_DEBUG
wlan_if_t vap = rrm->rrm_vap;
#endif
RRM_FUNCTION_ENTER;
params = (struct ieee80211_rrmreq_info *)(rrm->rrmcb);
measrsp = (struct ieee80211_measrsp_ie *)ie;
measrsp->id = IEEE80211_ELEMID_MEASREP;
measrsp->token=params->rep_dialogtoken;
measrsp->rspmode = 0x00; /* Need to validate */
measrsp->rsptype = IEEE80211_MEASRSP_NOISE_HISTOGRAM_REPORT;
rsp = (struct ieee80211_nhistrsp *)(&measrsp->rsp[0]);
rsp->mduration = params->duration;
rsp->regclass = params->regclass;
rsp->chnum = params->chnum;
rsp->anpi = (u_int8_t)rrm->rrm_noisefloor[rsp->chnum];
OS_GET_RANDOM_BYTES(&rsp->antid,sizeof(rsp->antid));
OS_GET_RANDOM_BYTES(rsp->ipi,sizeof(rsp->ipi));
tsf = OS_GET_TIMESTAMP();
OS_MEMCPY(rsp->tsf,&tsf,4);
ie = &rsp->rsp[0];
measrsp->len = (ie - &measrsp->token);
RRM_FUNCTION_EXIT;
return ie;
}
示例15: utilFormatIECString
/**
* utilFormatIECString
*
* Formats an IEC string like sprintf. szBuffer is used as a temporary
* buffer and must be sized at least (MAX_IEC_STRLEN + 1)!
*/
IEC_UINT utilFormatIECString(IEC_STRING OS_LPTR *strIEC, IEC_CHAR *szBuffer, IEC_CHAR *szFormat, ...)
{
IEC_INT iCount;
va_list va;
if(strIEC == 0 || strIEC->MaxLen == 0)
{
RETURN(EXCEPT_NULL_PTR);
}
va_start(va, szFormat);
iCount = (IEC_INT)OS_VSPRINTF(szBuffer, szFormat, va);
va_end(va);
if (iCount < 0)
{
strIEC->CurLen = 0;
RETURN(ERR_ERROR);
}
strIEC->CurLen = (IEC_STRLEN)((IEC_STRLEN)iCount > strIEC->MaxLen ? strIEC->MaxLen : (IEC_STRLEN)iCount);
OS_MEMCPY (strIEC->Contents, szBuffer, strIEC->CurLen);
RETURN(OK);
}