本文整理汇总了C++中DPRINT_ERR函数的典型用法代码示例。如果您正苦于以下问题:C++ DPRINT_ERR函数的具体用法?C++ DPRINT_ERR怎么用?C++ DPRINT_ERR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DPRINT_ERR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: libvlc_load
int libvlc_load(const char *path)
{
int nameId = lastElem;
if (g_file_test(path, G_FILE_TEST_EXISTS) == 0) {
DPRINT_ERR("%s doesn't exist", path);
goto error;
}
soundInst[nameId] = libvlc_new(0, NULL);
soundMedia[nameId] = libvlc_media_new_path(soundInst[nameId], path);
soundPlay[nameId] = libvlc_media_player_new_from_media(soundMedia[nameId]);
if (soundInst[nameId] == NULL || soundMedia[nameId] == NULL ||
soundPlay[nameId] == NULL) {
DPRINT_ERR("fail to load %s", path);
goto error;
}
/* if (loop != 0) { */
/* libvlc_media_add_option(media, "input-repeat=-1"); */
/* } */
is_used[nameId] = 1;
++lastElem;
return nameId;
error:
libvlc_stop(nameId);
return -1;
}
示例2: validate_server_address
/* to validate hostname/ip given by the client */
int validate_server_address()
{
struct hostent *he;
struct ipv4_addr temp;
if (!wl_atoip(g_rwl_servIP, &temp)) {
/* Wrong IP address format check for hostname */
if ((he = gethostbyname(g_rwl_servIP)) != NULL) {
if (!wl_atoip(*he->h_addr_list, &temp)) {
g_rwl_servIP =
inet_ntoa(*(struct in_addr *)*he->h_addr_list);
if (g_rwl_servIP == NULL) {
DPRINT_ERR(ERR, "Error at inet_ntoa \n");
return FAIL;
}
} else {
DPRINT_ERR(ERR, "Error in IP address \n");
return FAIL;
}
} else {
DPRINT_ERR(ERR, "Enter correct IP address/hostname format\n");
return FAIL;
}
}
return SUCCESS;
}
示例3: rwl_close_transport
int
rwl_close_transport(int remote_type, void* handle)
{
switch (remote_type) {
#ifdef RWL_SOCKET
case REMOTE_SOCKET:
shutdown(*((int*)handle), 1);
if (rwl_closesocket(*((int*)handle)) != 1) {
DPRINT_ERR(ERR, "Can't Close socket \n");
return FAIL;
}
break;
#endif /* RWL_SOCKET */
#if defined (RWL_SERIAL) || defined (RWL_DONGLE)
case REMOTE_SERIAL:
case REMOTE_DONGLE:
if (handle != NULL) {
if (PurgeComm(handle, PURGE_TXABORT | PURGE_TXCLEAR |
PURGE_RXABORT | PURGE_RXCLEAR) == 0) {
DPRINT_ERR(ERR, "rwl_close_transport: PurgeComm failed.\n");
}
Sleep(10);
if (CloseHandle(handle) == 0) {
DPRINT_ERR(ERR, "Can't Close serial port.\n");
return FAIL;
}
}
break;
#endif /* RWL_SERIAL || RWL_DONGLE */
default:
DPRINT_ERR(ERR, "close_pipe: Unknown remote_type %d\n", remote_type);
break;
}
return SUCCESS;
}
示例4: wfaStaGetStats
/*
* wfaStaGetStats():
* The function is to retrieve the statistics of the I/F's layer 2 txFrames,
* rxFrames, txMulticast, rxMulticast, fcsErrors/crc, and txRetries.
* Currently there is not definition how to use these info.
*/
int wfaStaGetStats(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
{
int ret = 0;
caStaGetStatsResp_t statsResp;
FILE *fd;
char cmdStr[256];
DPRINT_INFO(WFA_OUT, "Entering wfaStaGetStats ...\n");
if ((fd = popen("/tmp/ASD/wl dump stats | grep txframe | awk '{print $2,\"\\n\",$10}'", "r")) == NULL){
DPRINT_ERR(WFA_ERR, "Couldn't get txframe stats\n");
goto wfaStaGetStats_error;
} else {
fgets(cmdStr, sizeof(cmdStr), fd); /* line 1: tx frame */
statsResp.txFrames = atoi(cmdStr);
fgets(cmdStr, sizeof(cmdStr), fd); /* line 2: rx frame */
statsResp.rxFrames = atoi(cmdStr);
pclose(fd);
}
if ((fd = popen("/tmp/ASD/wl dump stats | grep txmulti | awk '{print $4, \"\\n\", $6 + $8}'", "r")) == NULL){
DPRINT_ERR(WFA_ERR, "Couldn't get d11_txmulti stats\n");
goto wfaStaGetStats_error;
} else {
fgets(cmdStr, sizeof(cmdStr), fd); /* line 1: txmulti */
statsResp.txMulticast = atoi(cmdStr);
fgets(cmdStr, sizeof(cmdStr), fd); /* line 2: d11_txretry + d11_txretrie */
statsResp.txRetries = atoi(cmdStr);
pclose(fd);
}
if ((fd = popen("/tmp/ASD/wl dump stats | grep rxdfrmmcast | awk '{print $6 + $8}'", "r")) == NULL){
DPRINT_ERR(WFA_ERR, "Couldn't get rxdfrmmcast stats\n");
goto wfaStaGetStats_error;
} else {
fgets(cmdStr, sizeof(cmdStr), fd); /* data + mngment mcast frames */
statsResp.rxMulticast = atoi(cmdStr);
pclose(fd);
}
if ((fd = popen("/tmp/ASD/wl dump stats | grep rxbadfcs | awk '{print $8}'", "r")) == NULL){
DPRINT_ERR(WFA_ERR, "Couldn't get rxbadfcs stats\n");
goto wfaStaGetStats_error;
} else {
fgets(cmdStr, sizeof(cmdStr), fd);
statsResp.fcsErrors = atoi(cmdStr);
pclose(fd);
}
statsResp.status = STATUS_COMPLETE;
wfaEncodeTLV(WFA_STA_GET_STATS_RESP_TLV, sizeof(statsResp), (BYTE *)&statsResp, respBuf);
*respLen = WFA_TLV_HDR_LEN + sizeof(statsResp);
return TRUE;
wfaStaGetStats_error:
ret = STATUS_ERROR;
wfaEncodeTLV(WFA_STA_GET_STATS_RESP_TLV, 4, (BYTE *)&ret, respBuf);
*respLen = WFA_TLV_HDR_LEN + 4;
return FALSE;
}
示例5: wfaCreateUDPSock
/**
* Create a UDP socket
* @param ipaddr Local UDP ip address to bind.
* @param port UDP port to receive and send packet.
* @return socket id.
*/
int wfaCreateUDPSock(char *ipaddr, unsigned short port)
{
int udpsock; /* socket to create */
struct sockaddr_in servAddr; /* Local address */
WSADATA wsadata;
int wsaret=WSAStartup(MAKEWORD(2,2),&wsadata);
if(wsaret!=0)
{
int errsv = WSAGetLastError();
DPRINT_ERR(WFA_ERR, "createUDPSock socket() falled with error %d",errsv);
return WFA_FAILURE;
}
if((udpsock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
{
int errsv = WSAGetLastError();
DPRINT_ERR(WFA_ERR, "createUDPSock socket() failed with error %d for port %d",errsv,port);
return WFA_FAILURE;
}
servAddr.sin_family = AF_INET;
servAddr.sin_addr.s_addr = htonl(INADDR_ANY);
servAddr.sin_port = htons(port);
bind(udpsock, (struct sockaddr *) &servAddr, sizeof(servAddr));
return udpsock;
}
示例6: netvsc_open
static int netvsc_open(struct net_device *net)
{
struct net_device_context *net_device_ctx = netdev_priv(net);
struct driver_context *driver_ctx =
driver_to_driver_context(net_device_ctx->device_ctx->device.driver);
struct netvsc_driver_context *net_drv_ctx =
(struct netvsc_driver_context *)driver_ctx;
struct netvsc_driver *net_drv_obj = &net_drv_ctx->drv_obj;
struct hv_device *device_obj = &net_device_ctx->device_ctx->device_obj;
int ret = 0;
DPRINT_ENTER(NETVSC_DRV);
if (netif_carrier_ok(net)) {
memset(&net_device_ctx->stats, 0,
sizeof(struct net_device_stats));
/* Open up the device */
ret = net_drv_obj->OnOpen(device_obj);
if (ret != 0) {
DPRINT_ERR(NETVSC_DRV,
"unable to open device (ret %d).", ret);
return ret;
}
netif_start_queue(net);
} else {
DPRINT_ERR(NETVSC_DRV, "unable to open device...link is down.");
}
DPRINT_EXIT(NETVSC_DRV);
return ret;
}
示例7: rwl_read_serial_port
int
rwl_read_serial_port(void* hndle, char* read_buf, uint data_size, uint *numread)
{
uint total_numread = 0;
int c = 0;
while (total_numread < data_size) {
if (ReadFile(hndle, read_buf, data_size - total_numread, numread, NULL) == 0) {
DPRINT_ERR(ERR, "rwl_read_serial_port failed with:%d", WSAGetLastError());
return FAIL;
}
if (*numread != data_size - total_numread) {
c++;
DPRINT_DBG(OUTPUT, "asked %d bytes got %d bytes\n",
data_size - total_numread, *numread);
if (c > MAX_SERIAL_READ_RETRY) {
DPRINT_ERR(ERR, "rwl_read_serial_port failed: "
"reached max retry limit.\n");
return FAIL;
}
Sleep(10);
}
total_numread += *numread;
read_buf += *numread;
}
return SUCCESS;
}
示例8: wl_do_cmd
/*
* find command in argv and execute it
* Won't handle changing ifname yet, expects that to happen with the --interactive
* Return an error if unable to find/execute command
*/
static int
wl_do_cmd(struct ifreq *ifr, char **argv)
{
cmd_t *cmd = NULL;
int err = 0;
int help = 0;
char *ifname = NULL;
int status = CMD_WL;
/* skip over 'wl' if it's there */
if (*argv && strcmp (*argv, "wl") == 0) {
argv++;
}
/* handle help or interface name changes */
if (*argv && (status = wl_option (&argv, &ifname, &help)) == CMD_OPT) {
if (ifname) {
fprintf(stderr,
"Interface name change not allowed within --interactive\n");
}
}
/* in case wl_option eats all the args */
if (!*argv) {
return err;
}
if (status != CMD_ERR) {
/* search for command */
cmd = wl_find_cmd(*argv);
/* defaults to using the set_var and get_var commands */
if (!cmd) {
cmd = &wl_varcmd;
}
/* do command */
err = (*cmd->func)((void *)ifr, cmd, argv);
}
/* provide for help on a particular command */
if (help && *argv) {
cmd = wl_find_cmd(*argv);
if (cmd) {
wl_cmd_usage(stdout, cmd);
} else {
DPRINT_ERR(ERR, "%s: Unrecognized command \"%s\", type -h for help\n",
wlu_av0, *argv);
}
} else if (!cmd)
wl_usage(stdout, NULL);
else if (err == USAGE_ERROR)
wl_cmd_usage(stderr, cmd);
else if (err == IOCTL_ERROR)
wl_printlasterror((void *)ifr);
else if (err == BCME_NODEVICE)
DPRINT_ERR(ERR, "%s : wl driver adapter not found\n", g_rem_ifname);
return err;
}
示例9: wfaStaSetPSK
/*
* The function is to set
* 1. ssid
* 2. passPhrase
* 3. keyMangementType - wpa/wpa2
* 4. encrypType - tkip or aes-ccmp
*/
int wfaStaSetPSK(int len, BYTE *caCmdBuf, int *respLen, BYTE *respBuf)
{
int ret = 0;
int retVal = TRUE;
caStaSetPSK_t *setPSK = (caStaSetPSK_t *)caCmdBuf;
bcmSsidObj_t *bso;
char *ssidStr;
DPRINT_INFO(WFA_OUT, "wfaStaSetPSK()");
ssidStr = setPSK->ssid;
if (!(bso = bcmWfaSsidTblSsidFind(ssidStr))) {
if (!(bso = bcmWfaSsidObjTblAdd(ssidStr))) {
DPRINT_ERR(WFA_OUT, "bcmWfaSsidObjTblAdd(%s) failed.\n", ssidStr);
retVal = FALSE;
goto exit;
}
}
if (!strcmp(setPSK->keyMgmtType, "wpa")) {
bso->wpa_auth = BCM_WPA_AUTH_PSK; /* WPA-PSK/WPA-Personal */
} else if (!strcmp(setPSK->keyMgmtType, "wpa2")) {
bso->wpa_auth = BCM_WPA2_AUTH_PSK; /* WPA2-PSK/WPA2-Personal */
} else {
DPRINT_ERR(WFA_OUT, "invalid key_mgmt %s", setPSK->keyMgmtType);
retVal = FALSE;
goto exit;
}
DPRINT_INFO(WFA_OUT, "wpa_auth %d\n", bso->wpa_auth);
if (setPSK->encpType == ENCRYPT_TKIP) {
bso->wsec = 3;
} else if (setPSK->encpType == ENCRYPT_AESCCMP) {
bso->wsec = 7;
} else {
DPRINT_ERR(WFA_OUT, "invalid encpType %d", setPSK->encpType);
goto exit;
}
DPRINT_INFO(WFA_OUT, "encpType %d wsec %d\n", setPSK->encpType, bso->wsec);
strcpy((char *)bso->passphrase, (char *)setPSK->passphrase);
bso->auth = 0;
if (wfa_defined_debug & (WFA_DEBUG_ERR | WFA_DEBUG_INFO)) {
bcmWfaSsidObjPrint(bso);
}
retVal = TRUE;
exit:
ret = STATUS_COMPLETE;
wfaEncodeTLV(WFA_STA_SET_PSK_RESP_TLV, 4, (BYTE *)&ret, respBuf);
*respLen = WFA_TLV_HDR_LEN + 4;
return retVal;
}
示例10: remote_CDC_rx_hdr
rem_ioctl_t *
remote_CDC_rx_hdr(void *remote, int debug)
{
#ifdef RWL_SOCKET
int ret;
#endif /* RWL_SOCKET */
uint numread = 0;
rem_ioctl_t *rem_ptr = &rem_cdc;
memset(rem_ptr, 0, sizeof(rem_ioctl_t));
#ifdef RWL_WIFI
UNUSED_PARAMETER(remote);
UNUSED_PARAMETER(numread);
#endif /* RWL_WIFI */
UNUSED_PARAMETER(debug);
switch (remote_type) {
#if defined(RWL_SERIAL) || defined(RWL_DONGLE)
case REMOTE_SERIAL:
case REMOTE_DONGLE:
if (rwl_read_serial_port(remote, (char *)rem_ptr, sizeof(rem_ioctl_t),
&numread) < 0) {
DPRINT_ERR(ERR, "remote_CDC_rx_hdr: Header Read failed \n");
return (NULL);
}
break;
#endif /* RWL_SERIAL | RWL_DONGLE */
#ifdef RWL_SOCKET
case REMOTE_SOCKET:
ret = rwl_receive_from_streamsocket(*(int*)remote, (char *)rem_ptr,
sizeof(rem_ioctl_t), 0);
numread = ret;
if (ret == -1) {
DPRINT_ERR(ERR, "remote_CDC_rx_hdr: numread:%d", numread);
return (NULL);
}
if (numread == 0) {
DPRINT_DBG(OUTPUT, "\n remote_CDC_rx_hdr:No data to receive\n");
return NULL;
}
break;
#endif
default:
DPRINT_ERR(ERR, "\n Unknown Transport Type\n");
break;
}
return (rem_ptr);
}
示例11: rwl_socket_shellresp
/* Note in case of error ( returned value == FAIL) it is assumed that wl is closed by caller,
* no treatment in this function
*/
static int
rwl_socket_shellresp(void *wl, rem_ioctl_t *rem_ptr, uchar *input_buf)
{
uchar* resp_buf = NULL;
int pid, msg_len, error;
g_sig_ctrlc = 1;
// only for linux
//g_child_pid = pid = rwl_shell_createproc(wl);
g_child_pid = pid = 1;
if (pid == 0) {
while (g_sig_ctrlc);
remote_CDC_tx(wl, 0, input_buf, 0, 0, CTRLC_FLAG, 0);
exit(0);
}
do {
if ((rem_ptr = remote_CDC_rx_hdr(wl, 0)) == NULL) {
DPRINT_ERR(ERR, "rwl_socket_shellresp: Receiving CDC"
"header failed\n");
return FAIL;
}
msg_len = rem_ptr->msg.len;
if ((resp_buf = malloc(rem_ptr->msg.len + 1)) == NULL) {
DPRINT_ERR(ERR, "rwl_socket_shellresp: Mem alloc fails\n");
return FAIL;
}
if (msg_len > 0) {
if (remote_CDC_rx(wl, rem_ptr, resp_buf,
rem_ptr->msg.len, 0) == FAIL) {
DPRINT_ERR(ERR, "rwl_socket_shellresp: No results!\n");
free(resp_buf);
return FAIL;
}
}
/* print the shell result */
resp_buf[rem_ptr->msg.len] = '\0';
/* The return value of the shell command
* will be stored in rem_ptr->msg.cmd
* Return that value to the client process
*/
if (rem_ptr->msg.flags & REMOTE_REPLY)
error = rem_ptr->msg.cmd;
#ifdef LINUX
write(1, resp_buf, msg_len);
#else
fputs((char*)resp_buf, stdout);
#endif
} while (msg_len);
//rwl_shell_killproc(pid);
return error;
}
示例12: rwl_dongle_shellresp
static int
rwl_dongle_shellresp(void *wl, rem_ioctl_t *rem_ptr, uchar *input_buf, int cmd)
{
int pid, msg_len, error;
uchar *resp_buf;
g_sig_ctrlc = 1;
g_child_pid = pid = rwl_shell_createproc(wl);
if (pid == 0) {
while (g_sig_ctrlc);
remote_CDC_tx(wl, cmd, input_buf, 0, 0, CTRLC_FLAG, 0);
exit(0);
}
do {
if ((rem_ptr = remote_CDC_rx_hdr(wl, 0)) == NULL) {
DPRINT_ERR(ERR, "shell_info_fe: Receiving CDC header failed\n");
return BCME_SERIAL_PORT_ERR;
}
/* In case of shell or ASD commands the response size is not known in advance
* Hence based on response from the server memory is allocated
*/
msg_len = rem_ptr->msg.len;
if ((resp_buf = malloc(rem_ptr->msg.len + 1)) == NULL) {
DPRINT_ERR(ERR, "Mem alloc fails for shell response buffer\n");
return FAIL;
}
/* Response comes in one shot not in fragments */
if (remote_CDC_rx(wl, rem_ptr, resp_buf,
rem_ptr->msg.len, 0) == FAIL) {
DPRINT_ERR(ERR, "shell_info_fe: No results!\n");
free(resp_buf);
return FAIL;
}
/* print the shell result */
resp_buf[rem_ptr->msg.len] = '\0';
/* The return value of the shell command will be stored in rem_ptr->msg.cmd
* Return that value to the client process
*/
if (rem_ptr->msg.flags & REMOTE_REPLY)
error = rem_ptr->msg.cmd;
#ifdef LINUX
write(1, resp_buf, msg_len);
#else
fputs((char*)resp_buf, stdout);
#endif
} while (msg_len);
rwl_shell_killproc(pid);
return error;
}
示例13: rwl_open_transport
void*
rwl_open_transport(int remote_type, char *port, int ReadTotalTimeout, int debug)
{
void* hndle;
UNUSED_PARAMETER(port);
UNUSED_PARAMETER(ReadTotalTimeout);
UNUSED_PARAMETER(debug);
switch (remote_type) {
#if defined(RWL_DONGLE) || defined(RWL_SERIAL)
case REMOTE_SERIAL:
#ifdef RWL_SERIAL
g_rwl_device_name_serial = port;
#endif
case REMOTE_DONGLE:
if ((g_irh = rwl_open_serial(remote_type, g_rwl_device_name_serial))
== FAIL) {
/* Initial port opening settings failed in reboot.
* So retry opening the serial port
*/
if ((g_irh = rwl_open_serial(remote_type, g_rwl_device_name_serial))
== FAIL) {
DPRINT_ERR(ERR, "Can't open serial port\n");
return NULL;
}
}
break;
#endif /* RWL_DONGLE || RWL_SERIAL */
#ifdef RWL_SOCKET
case REMOTE_SOCKET:
if ((g_irh = rwl_opensocket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == FAIL) {
DPRINT_ERR(ERR, "\nCan't open socket \n");
return NULL;
}
break;
#endif /* RWL_SOCKET */
default:
DPRINT_ERR(ERR, "rwl_open_transport: Unknown remote_type %d\n", remote_type);
return NULL;
break;
} /* end - switch case */
hndle = (void*) &g_irh;
return hndle;
}
示例14: rwl_information_socket
/* This routine is used for both Get and Set Ioctls for the socket */
static int
rwl_information_socket(void *wl, int cmd, void* input_buf, unsigned long *input_len,
unsigned long *tx_len, uint flags)
{
int error, Sockfd;
rem_ioctl_t *rem_ptr = NULL;
if ((Sockfd = rwl_connect_socket_server()) < 0) {
DPRINT_ERR(ERR, "Error in getting the Socket Descriptor\n");
return FAIL;
}
wl = (void *)(&Sockfd);
if (remote_CDC_tx(wl, cmd, input_buf, *input_len,
*tx_len, flags, 0) < 0) {
DPRINT_ERR(ERR, "query_info_fe: Send command failed\n");
rwl_close_pipe(remote_type, wl);
return FAIL;
}
if ((rem_ptr = remote_CDC_rx_hdr(wl, 0)) == NULL) {
DPRINT_ERR(ERR, "query_info_fe: Reading CDC header failed\n");
rwl_close_pipe(remote_type, wl);
return FAIL;
}
rwl_swap_header(rem_ptr, NETWORK_TO_HOST);
if (rem_ptr->msg.len > *input_len) {
DPRINT_ERR(ERR, "query_info_fe: needed size(%d) > "
"actual size(%ld)\n", rem_ptr->msg.len, *input_len);
rwl_close_pipe(remote_type, wl);
return FAIL;
}
if (remote_CDC_rx(wl, rem_ptr, input_buf, *input_len, 0) == FAIL) {
DPRINT_ERR(ERR, "query_info_fe: No results!\n");
rwl_close_pipe(remote_type, wl);
return FAIL;
}
if (rem_ptr->msg.flags & REMOTE_REPLY)
error = rem_ptr->msg.cmd;
else
error = 0;
rwl_close_pipe(remote_type, wl);
return error;
}
示例15: rwl_read_serial_port
int
rwl_read_serial_port(void* hndle, char* read_buf, uint data_size, uint *numread)
{
uint total_numread = 0;
int c = 0;
while (total_numread < data_size) {
if (ReadFile(hndle, read_buf, data_size - total_numread, (LPDWORD) numread, NULL) == 0) {
DPRINT_ERR(ERR, "rwl_read_serial_port failed with:%d", GetLastError());
return FAIL;
}
if (*numread != data_size - total_numread) {
c++;
DPRINT_DBG(OUTPUT, "asked %d bytes got %d bytes\n",
data_size - total_numread, *numread);
if (c > MAX_SERIAL_READ_RETRY) {
DPRINT_ERR(ERR, "rwl_read_serial_port failed: "
"reached max retry limit.\n");
return FAIL;
}
Sleep(10);
}
total_numread += *numread;
read_buf += *numread;
}
#ifdef DEBUG_SERIAL
printf( "\nr %04d < ", total_numread);
int i;
for( i = 0; i < total_numread; i++ )
{
#ifdef READABLE_SERIAL_DUMP
if ( ( orig_read_buf[i] >= 0x20 ) && ( orig_read_buf[i] <= 0x7E ) )
{
printf( "%c",orig_read_buf[i]);
}
else
{
printf( "\\x%02X",(unsigned char)orig_read_buf[i]);
}
#else /* ifdef READABLE_SERIAL_DUMP */
printf( " %02X",(unsigned char)orig_read_buf[i]);
#endif /* ifdef READABLE_SERIAL_DUMP */
}
printf("\n");
#endif /* ifdef DEBUG_SERIAL */
return SUCCESS;
}