本文整理汇总了C++中send_frame函数的典型用法代码示例。如果您正苦于以下问题:C++ send_frame函数的具体用法?C++ send_frame怎么用?C++ send_frame使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了send_frame函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: answer_magic
static void answer_magic(int serialfd,
const char *kernel_image, unsigned int kernel_address,
const char *cmdline, unsigned int cmdline_address,
const char *initrd_image, unsigned int initrd_address)
{
int kernelfd, initrdfd;
struct sfl_frame frame;
printf("[FLTERM] Received firmware download request from the device.\n");
kernelfd = open(kernel_image, O_RDONLY);
if(kernelfd == -1) {
perror("[FLTERM] Unable to open kernel image (request ignored).");
return;
}
initrdfd = -1;
if(initrd_image != NULL) {
initrdfd = open(initrd_image, O_RDONLY);
if(initrdfd == -1) {
perror("[FLTERM] Unable to open initrd image (request ignored).");
close(kernelfd);
return;
}
}
write_exact(serialfd, sfl_magic_ack, SFL_MAGIC_LEN);
upload_fd(serialfd, "kernel", kernelfd, kernel_address);
if(cmdline != NULL) {
int len;
printf("[FLTERM] Setting kernel command line: '%s'.\n", cmdline);
len = strlen(cmdline)+1;
if(len > (254-4)) {
fprintf(stderr, "[FLTERM] Kernel command line too long, load aborted.\n");
close(initrdfd);
close(kernelfd);
return;
}
frame.length = len+4;
frame.cmd = SFL_CMD_LOAD;
frame.payload[0] = (cmdline_address & 0xff000000) >> 24;
frame.payload[1] = (cmdline_address & 0x00ff0000) >> 16;
frame.payload[2] = (cmdline_address & 0x0000ff00) >> 8;
frame.payload[3] = (cmdline_address & 0x000000ff);
strcpy((char *)&frame.payload[4], cmdline);
send_frame(serialfd, &frame);
frame.length = 4;
frame.cmd = SFL_CMD_CMDLINE;
frame.payload[0] = (cmdline_address & 0xff000000) >> 24;
frame.payload[1] = (cmdline_address & 0x00ff0000) >> 16;
frame.payload[2] = (cmdline_address & 0x0000ff00) >> 8;
frame.payload[3] = (cmdline_address & 0x000000ff);
send_frame(serialfd, &frame);
}
开发者ID:gbraad,项目名称:milkymist,代码行数:57,代码来源:flterm.c
示例2: eventbus_register
void eventbus_register(String address,void (*func)(String *)){
handler_t handler;
handler.address=address;
handler.function=func;
if(find(address)==false){
jsonMessage_t js;
js.address=address;
js.type="register";
js.replyAddress=NULL;
JSON_Value *body = json_parse_string(NULL);
JSON_Value *headers = json_parse_string(NULL);
js.body=body;
js.headers=headers;
String message=NULL;
getMessage(js,&message);
send_frame(&message);
free(message);
}
insertFirst(node_index,handler);
node_index++;
}
开发者ID:jaymine,项目名称:TCP-eventbus-client-C,代码行数:25,代码来源:vertx.c
示例3: portTASK_FUNCTION
static portTASK_FUNCTION(TimeTask,pvParameters)
{
unsigned char frame[MAX_FRAME_SIZE];
int num_datos;
int tiempoSim;
uint32_t hora;
while(1)
{
vTaskDelay(configTICK_RATE_HZ); //cada segundo
tiempoSim=getTiempoSim(); //Obtenemos la equivalencia de 1 segundo Real son tiempoSim minutos en el simulado
hora = getHora(); //Obtenemos la hora
hora+=tiempoSim; //aumentamos hora tiempoSim (Minutos)
if(hora>1440){ //si llegamos a las 24:00 (1440 minutos) ponemos las 00:00
hora=0;
}
//Modificamos y enviamos la hora
setHora(hora);
num_datos=create_frame(frame, COMANDO_TIME, &hora, sizeof(hora), MAX_FRAME_SIZE);
if (num_datos>=0){
send_frame(frame, num_datos);
}else{
logError(num_datos);
}
}
}
开发者ID:joseayebenes,项目名称:TivaFly,代码行数:33,代码来源:main.c
示例4: send_broadcast
/**
* Envoi d'une trame a tous les joueurs encore connectes (broadcast)
* S'il y'a un probleme d'envoi, le joueur concerne est deconnecte et desinscrit
*
* @param the_players Liste des joueurs
* @param frame Trame a envoyer
*/
void send_broadcast(Players the_players, Frame frame) {
size_t i = 0;
Player current_player;
/*debug*/
print_frame(frame);
for(i=0; i < the_players->size; i++) {
current_player = the_players->player[i];
/* Envoi de la trame a tous les joueurs inscrits
* Desinscription et deconnexion du joueur en cas de deconnexion brutale
*/
if(current_player->is_registered) {
if(send_frame(current_player->sock, frame) == ERROR) {
/*debug*/
printf("Suppression d'un joueurs");
remove_player_by_sock(current_player->sock, the_players, 1);
}
}
}
free_frame(frame);
}
开发者ID:mehdi-drici,项目名称:PC2RON,代码行数:32,代码来源:protocole.c
示例5: mySendFrame
void mySendFrame(unsigned char* databuff, int size) {//add crc and cooperate with physical layer. databuff should be ready to send. size shoule be without crc
if (databuff[0] != FRAME_NAK) {
//piggyback ack
short i = (receiverLeft - 1) % windowSize;//log the last ack arrived
if (i < 0)
i += windowSize;
for (short j = 0; j < bufferSize; j++) {
if (receiver[(receiverLeft + j) % bufferSize].frameArrived)
i = (receiverLeft + j) % windowSize;
else break;
}
databuff[0] == FRAME_DATA ? databuff[2] = i : databuff[1] = i;
}
//append crc
*(unsigned int*)(databuff + size) = crc32(databuff, size);
size += 4;//add length
if (databuff[0] == FRAME_DATA)
//add timer
start_timer(databuff[1], retimer);
//piggyback ack timer
if (databuff[0] != FRAME_NAK) {
stop_ack_timer();
start_ack_timer(acktimer);
}
send_frame(databuff, size);
}
开发者ID:mkyybx,项目名称:network,代码行数:32,代码来源:formatted.cpp
示例6: handle_ready_query
/* Handle incoming READY_QUERY frames.
*/
static void handle_ready_query(Conn_t *conn, struct ready_frame *f)
{
f->opcode = htons(READY_IND);
send_frame(conn, f, sizeof(struct ready_frame));
return;
}
开发者ID:FelipeFernandes1988,项目名称:Alice-1121-Modem,代码行数:9,代码来源:frames.c
示例7: send_auth
void send_auth(struct params* p, char *mac)
{
char buf[4096];
struct ieee80211_frame *wh;
unsigned short *ptr;
int len;
wh = (struct ieee80211_frame*) buf;
memset(buf, 0, sizeof(buf));
fill_basic(wh, p);
memcpy(wh->i_addr1, mac, 6);
memcpy(wh->i_addr3, p->mac, 6);
wh->i_fc[0] |= IEEE80211_FC0_TYPE_MGT;
wh->i_fc[0] |= IEEE80211_FC0_SUBTYPE_AUTH;
ptr = (unsigned short*) (wh+1);
*ptr++ = htole16(0);
*ptr++ = htole16(2);
*ptr++ = htole16(0);
len = ((char*)ptr) - ((char*) wh);
printf("sending auth\n");
send_frame(p, wh, len);
}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:26,代码来源:ap.c
示例8: pcnet_send
uint64 pcnet_send(struct eth_dev *e, uint8 *d, uint64 len, uint8 dst[6])
{
struct pcnet_private *p = (struct pcnet_private *)e->phys;
int i;
/*
printf("pcnet_send: len=%x dst=", len);
print_mac(dst);
printf("\n");
*/
for(i = 0 ; i < DRE_COUNT ; i++) {
if(!p->tx[i].TBADR) {
p->tx[i].ones = 0xf;
p->tx[i].TBADR = (uint32)(uint64)kmalloc_align(1544,
"pcnet_tx_32", NULL);
}
if(!p->tx[i].OWN) {
send_frame(&p->tx[i], e->addr, dst, d, len);
p->tx[i].ADD_NO_FCS = 1;
p->tx[i].ENP = 1;
p->tx[i].STP = 1;
p->tx[i].OWN = 1;
}
}
return 0;
}
开发者ID:juur,项目名称:FailOS,代码行数:27,代码来源:pcnet.c
示例9: send_proxy_arp_rsp
/* Send a LE_ARP_RESPONSE for a LAN destination (MAC address) when
* the LAN destination is present in kernel bridging table and we
* are acting as a proxy lane client
*/
static void send_proxy_arp_rsp(unsigned char *target_mac, uint32_t tran_id,
uint16_t lec_id, unsigned char *src_atm_addr)
{
struct ctrl_frame *frame;
int frame_size;
frame_size = sizeof(struct ctrl_frame) + lec_params.sizeoftlvs;
frame = malloc(frame_size);
if (frame == NULL) return;
memset(frame, 0, frame_size);
prefill_frame(frame, LE_ARP_RSP);
frame->header.tran_id = tran_id;
frame->header.lec_id = lec_id;
frame->header.flags = htons(REMOTE_ADDRESS);
memcpy(frame->target_atm_addr, lec_params.c1n_my_atm_addr, ATM_ESA_LEN);
frame->target_lan_dst.tag = htons(LAN_DST_MAC_ADDR);
memcpy(frame->target_lan_dst.mac, target_mac, ETH_ALEN);
memcpy(frame->src_atm_addr, src_atm_addr, ATM_ESA_LEN);
frame->num_tlvs = lec_params.num_tlvs;
if (lec_params.num_tlvs > 0)
memcpy(frame + 1, lec_params.tlvs, lec_params.sizeoftlvs);
if (send_frame(lec_params.ctrl_direct, frame, frame_size) < 0)
diag(COMPONENT, DIAG_ERROR, "send_proxy_arp_rsp: send_frame() failed");
free(frame);
return;
}
开发者ID:Claruarius,项目名称:stblinux-2.6.37,代码行数:32,代码来源:kernel.c
示例10: send_auth
void send_auth(struct params *p)
{
char buf[2048];
struct ieee80211_frame *wh;
char *data;
int len;
memset(buf, 0, sizeof(buf));
wh = (struct ieee80211_frame*) buf;
fill_basic(wh, p);
wh->i_fc[0] |= IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_AUTH;
data = (char*) (wh + 1);
/* algo */
*data++ = 0;
*data++ = 0;
/* transaction no. */
*data++ = 1;
*data++ = 0;
/* status code */
*data++ = 0;
*data++ = 0;
len = data - (char*)wh;
send_frame(p, buf, len);
}
开发者ID:coyizumi,项目名称:cs111,代码行数:31,代码来源:assoc.c
示例11: send_assoc
void send_assoc(struct params *p, char *mac)
{
char buf[4096];
struct ieee80211_frame *wh;
char *ptr;
int len;
wh = (struct ieee80211_frame*) buf;
memset(buf, 0, sizeof(buf));
fill_basic(wh, p);
memcpy(wh->i_addr1, mac, 6);
memcpy(wh->i_addr3, p->mac, 6);
wh->i_fc[0] |= IEEE80211_FC0_TYPE_MGT;
wh->i_fc[0] |= IEEE80211_FC0_SUBTYPE_ASSOC_RESP;
ptr = (char*) (wh+1);
*ptr |= IEEE80211_CAPINFO_ESS;
ptr += 2; /* cap */
ptr += 2; /* status */
ptr += 2; /* aid */
/* rates */
*ptr++ = 1;
*ptr++ = 4;
*ptr++ = 2 | 0x80;
*ptr++ = 4 | 0x80;
*ptr++ = 11;
*ptr++ = 22;
len = ptr - ((char*) wh);
printf("sending assoc response\n");
send_frame(p, wh, len);
}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:35,代码来源:ap.c
示例12: main
int main(int argc, char *argv[])
{
#ifdef IMX
int retuid;
retuid = setuid(0); // root me!
if (retuid == -1) {
exit(-10);
}
#endif
// Open the pipe, write the data, close the pipe.
pipe_fd = open("/run/pipelights.3.fifo", O_WRONLY);
if (pipe_fd == -1) {
printf("Failed to open pipe!\n");
exit(-120);
}
since_start(); // initialize the count of when we started execution
// Ok, we're ready to start, so call the setup
setup();
synchronize(1); // And setup the sync function
while (1) {
loop(since_start());
synchronize(20000000); // 50 fps or 20 msec/frame
send_frame(pipe_fd, 0L); // Try to transmit the frame
}
close(pipe_fd); // And close the fifo
return 0;
}
开发者ID:Froosh,项目名称:compositor,代码行数:33,代码来源:singbowcomp.c
示例13: relay_data
void relay_data(struct params *p, struct ieee80211_frame *wh, int len)
{
char seq[2];
char fc[2];
unsigned short *ps;
/* copy crap */
memcpy(fc, wh->i_fc, 2);
memcpy(seq, wh->i_seq, 2);
/* relay frame */
wh->i_fc[1] &= ~(IEEE80211_FC1_DIR_TODS | IEEE80211_FC1_RETRY);
wh->i_fc[1] |= IEEE80211_FC1_DIR_FROMDS;
memcpy(wh->i_addr1, wh->i_addr3, sizeof(wh->i_addr1));
memcpy(wh->i_addr3, wh->i_addr2, sizeof(wh->i_addr3));
memcpy(wh->i_addr2, p->mac, sizeof(wh->i_addr2));
ps = (unsigned short*)wh->i_seq;
*ps = seqfn(p->seq, 0);
send_frame(p, wh, len);
enque(p, wh, len);
/* restore */
memcpy(wh->i_fc, fc, sizeof(fc));
memcpy(wh->i_addr2, wh->i_addr3, sizeof(wh->i_addr2));
memcpy(wh->i_addr3, wh->i_addr1, sizeof(wh->i_addr2));
memcpy(wh->i_addr1, p->mac, sizeof(wh->i_addr1));
memcpy(wh->i_seq, seq, sizeof(seq));
}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:29,代码来源:ap.c
示例14: send_beacon
void send_beacon(struct params *p)
{
char buf[4096];
struct ieee80211_frame *wh;
int len;
char *ptr;
wh = (struct ieee80211_frame*) buf;
memset(buf, 0, sizeof(buf));
fill_basic(wh, p);
memset(wh->i_addr1, 0xff, 6);
memcpy(wh->i_addr3, p->mac, 6);
wh->i_fc[0] |= IEEE80211_FC0_TYPE_MGT;
wh->i_fc[0] |= IEEE80211_FC0_SUBTYPE_BEACON;
len = fill_beacon(p, wh);
/* TIM */
ptr = (char*)wh + len;
*ptr++ = 5;
*ptr++ = 4;
len += 2+4;
#if 0
printf("sending beacon\n");
#endif
send_frame(p, wh, len);
if (gettimeofday(&p->blast, NULL) == -1)
err(1, "gettimeofday()");
}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:32,代码来源:ap.c
示例15: can_echo_gen
static int can_echo_gen(void)
{
struct can_frame tx_frames[CAN_MSG_COUNT];
struct can_frame rx_frame;
unsigned char counter = 0;
int send_pos = 0, recv_pos = 0, unprocessed = 0, loops = 0;
int i;
while (running) {
if (unprocessed < CAN_MSG_COUNT) {
/* still send messages */
tx_frames[send_pos].can_dlc = CAN_MSG_LEN;
tx_frames[send_pos].can_id = CAN_MSG_ID;
for (i = 0; i < CAN_MSG_LEN; i++)
tx_frames[send_pos].data[i] = counter + i;
if (send_frame(&tx_frames[send_pos]))
return -1;
/* increment to be equal to expected */
tx_frames[send_pos].can_id++;
for (i = 0; i < CAN_MSG_LEN; i++)
tx_frames[send_pos].data[i]++;
send_pos++;
if (send_pos == CAN_MSG_COUNT)
send_pos = 0;
unprocessed++;
if (verbose == 1)
echo_progress(counter);
counter++;
if ((counter % 33) == 0)
millisleep(3);
else
millisleep(1);
} else {
if (recv_frame(&rx_frame))
return -1;
if (verbose > 1)
print_frame(&rx_frame);
/* compare with expected */
compare_frame(&tx_frames[recv_pos], &rx_frame);
loops++;
if (test_loops && loops >= test_loops)
break;
recv_pos++;
if (recv_pos == CAN_MSG_COUNT)
recv_pos = 0;
unprocessed--;
}
}
printf("\nTest messages sent and received: %d\n", loops);
return 0;
}
开发者ID:AshwanthSelvam,项目名称:eval-sdk-imx6,代码行数:60,代码来源:canfdtest.c
示例16: send_probe_request
void send_probe_request(struct params *p)
{
char buf[2048];
struct ieee80211_frame *wh;
char *data;
int len;
memset(buf, 0, sizeof(buf));
wh = (struct ieee80211_frame*) buf;
fill_basic(wh, p);
wh->i_fc[0] |= IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_PROBE_REQ;
memset(wh->i_addr1, 0xFF, 6);
memset(wh->i_addr3, 0xFF, 6);
data = (char*) (wh + 1);
*data++ = 0; /* SSID */
*data++ = strlen(p->ssid);
strcpy(data, p->ssid);
data += strlen(p->ssid);
*data++ = 1; /* rates */
*data++ = 4;
*data++ = 2 | 0x80;
*data++ = 4 | 0x80;
*data++ = 11;
*data++ = 22;
len = data - (char*)wh;
send_frame(p, buf, len);
}
开发者ID:coyizumi,项目名称:cs111,代码行数:33,代码来源:assoc.c
示例17: send_fragment
static void send_fragment(struct wstate *ws, struct frag_state* fs,
struct prga_info *pi)
{
unsigned char buf[4096];
struct ieee80211_frame* wh;
unsigned char* body;
int fragsize;
uLong crc;
unsigned int *pcrc;
int i;
unsigned short* seq;
unsigned short sn, fn;
wh = (struct ieee80211_frame*) buf;
memcpy(wh, &fs->fs_wh, sizeof(*wh));
body = (unsigned char*) wh + sizeof(*wh);
memcpy(body, &pi->pi_iv, 3);
body += 3;
*body++ = 0; // key index
fragsize = fs->fs_data + fs->fs_len - fs->fs_ptr;
assert(fragsize > 0);
if ( (fragsize + 4) > pi->pi_len) {
fragsize = pi->pi_len - 4;
wh->i_fc[1] |= IEEE80211_FC1_MORE_FRAG;
}
// last fragment
else {
wh->i_fc[1] &= ~IEEE80211_FC1_MORE_FRAG;
}
memcpy(body, fs->fs_ptr, fragsize);
crc = crc32(0L, Z_NULL, 0);
crc = crc32(crc, body, fragsize);
pcrc = (unsigned int*) (body+fragsize);
*pcrc = htole32(crc);
for (i = 0; i < (fragsize + 4); i++)
body[i] ^= pi->pi_prga[i];
seq = (unsigned short*) &wh->i_seq;
sn = (le16toh(*seq) & IEEE80211_SEQ_SEQ_MASK) >> IEEE80211_SEQ_SEQ_SHIFT;
fn = le16toh(*seq) & IEEE80211_SEQ_FRAG_MASK;
// printf ("Sent frag (data=%d) (seq=%d fn=%d)\n", fragsize, sn, fn);
send_frame(ws, buf, sizeof(*wh) + 4 + fragsize+4);
seq = (unsigned short*) &fs->fs_wh.i_seq;
*seq = fnseq(++fn, sn);
fs->fs_ptr += fragsize;
if (fs->fs_ptr - fs->fs_data == fs->fs_len) {
// printf("Finished sending frags...\n");
fs->fs_waiting_relay = 1;
}
}
开发者ID:0x90,项目名称:aircrack-ng,代码行数:60,代码来源:wesside-ng.c
示例18: send_tunnel_request_packet
int send_tunnel_request_packet(char *remote_host, int remote_port, int friend_number)
{
int packet_length = 0;
protocol_frame frame_i, *frame;
char *data = NULL;
log_printf(L_INFO, "Sending packet to friend #%d to forward %s:%d\n", friend_number, remote_host, remote_port);
packet_length = PROTOCOL_BUFFER_OFFSET + strlen(remote_host);
frame = &frame_i;
data = calloc(1, packet_length);
if(!data)
{
log_printf(L_ERROR, "Could not allocate memory for tunnel request packet\n");
exit(1);
}
strcpy(data+PROTOCOL_BUFFER_OFFSET, remote_host);
frame->friendnumber = friend_number;
frame->packet_type = PACKET_TYPE_REQUESTTUNNEL;
frame->connid = remote_port;
frame->data_length = strlen(remote_host);
send_frame(frame, data);
free(data);
return 0;
}
开发者ID:zeropool,项目名称:tuntox,代码行数:28,代码来源:main.c
示例19: raven_gui_loop
/*------------------------------------------------------------------*/
static u8_t
raven_gui_loop(process_event_t ev, process_data_t data)
{
if(ev == tcpip_icmp6_event) {
switch(*((uint8_t *)data)){
case ICMP6_ECHO_REQUEST:
/* We have received a ping request over the air.
Send frame back to 3290 */
send_frame(PING_REQUEST, 0, 0);
break;
case ICMP6_ECHO_REPLY:
/* We have received a ping reply over the air.
Send frame back to 3290 */
send_frame(PING_REPLY, 1, &seqno);
break;
}
} else {
switch(ev){
case SERIAL_CMD:
/* Check for command from serial port, execute it. */
if (cmd.done){
/* Execute the waiting command */
switch (cmd.cmd){
case CMD_PING:
/* Send ping request over the air */
seqno = cmd.frame[0];
raven_ping6();
break;
case CMD_TEMP:
/* Set temperature string in web server */
sprintf(udp_data, "T%s\r\n", (char *)cmd.frame);
uip_udp_packet_send(udp_conn, udp_data, data_len);
break;
default:
break;
}
/* Reset command done flag. */
cmd.done = false;
}
break;
default:
break;
}
}
return 0;
}
开发者ID:arbraham,项目名称:hummingbird,代码行数:47,代码来源:raven-ipso.c
示例20: send_frame_to_all
void send_frame_to_all(nw_cmd_t cmd) {
std::vector<int>::iterator it;
for(it = clients.begin(); it<clients.end(); ++it) {
if(!send_frame(*it, no_addr, cmd, vars)) {
clients.erase(it);
}
}
}
开发者ID:torandi,项目名称:nettest,代码行数:8,代码来源:server.cpp
注:本文中的send_frame函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论