当前位置: 首页>>代码示例>>C++>>正文


C++ send_pkt函数代码示例

本文整理汇总了C++中send_pkt函数的典型用法代码示例。如果您正苦于以下问题:C++ send_pkt函数的具体用法?C++ send_pkt怎么用?C++ send_pkt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了send_pkt函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: sane_start

SANE_Status
sane_start (SANE_Handle h)
{
  struct device_s *dev = (struct device_s *) h;
  int status;
  size_t size;

  dev->read_offset = 0;
  dev->write_offset_r = 0;
  dev->write_offset_g = 1;
  dev->write_offset_b = 2;

  free (dev->buffer);
  dev->buffer = NULL;


  send_pkt (PKT_RESET, 0, dev);
  send_pkt (PKT_READ_STATUS, 0, dev);
  wait_ack (dev, &status);
  if (status)
    return SANE_STATUS_IO_ERROR;

  send_pkt (PKT_READCONF, 0, dev);

  if ((size = wait_ack (dev, NULL)))
    {
      sanei_usb_read_bulk (dev->dn, (unsigned char *) dev->conf_data, &size);
    }
  send_pkt (PKT_SETCONF, 100, dev);
  send_conf (dev);
  wait_ack (dev, NULL);

  send_pkt (PKT_START_SCAN, 0, dev);
  wait_ack (dev, NULL);
  if ((size = wait_ack (dev, NULL)))
    {
      sanei_usb_read_bulk (dev->dn, (unsigned char *) dev->conf_data, &size);
    }
  if ((size = wait_ack (dev, NULL)))
    {
      sanei_usb_read_bulk (dev->dn, (unsigned char *) dev->conf_data, &size);
    }
  if ((size = wait_ack (dev, NULL)))
    {
      sanei_usb_read_bulk (dev->dn, (unsigned char *) dev->conf_data, &size);
    }

  dev->status = STATUS_SCANNING;
  /* Get the first data */
  return get_data (dev);
}
开发者ID:kkaempf,项目名称:sane-backends,代码行数:51,代码来源:hpljm1005.c

示例2: network_send_pkt

int 
network_send_pkt(network_address_t dest_address, int hdr_len, 
                 char* hdr, int data_len, char* data) {

  if (synthetic_network) {
    if(genrand() < loss_rate)
      return (hdr_len+data_len);

    if(genrand() < duplication_rate)
      send_pkt(dest_address, hdr_len, hdr, data_len, data);
  }

  return send_pkt(dest_address, hdr_len, hdr, data_len, data);
}
开发者ID:kentalabur,项目名称:egs,代码行数:14,代码来源:network.c

示例3: A_input

/* called from layer 3, when a packet arrives for layer 4 */
void A_input(struct pkt packet)
{
    printf("CCH> A_input> Got packet\n");

    // isChecksumValid
    if(pkt_checksum_valid(&packet)) {
        printf("CCH> A_input> Valid checksum\n");

        // isACK
        if(strncmp(packet.payload, ACK, strlen(ACK)) == 0) {
            if(packet.acknum == last_pkt->seqnum) {
                printf("CCH> A_input> Received valid ACK\n");
                last_ack = &packet;
                stoptimer(A);
            } else {
                // We received an ACK we don't care about
                printf("CCH> A_input> Received invalid ACK (ignoring)\n");
            }
        // isNACK
        } else if (strncmp(packet.payload, NACK, strlen(ACK)) == 0) {
            printf("CCH> A_input> Received NACK\n");
            send_pkt(A, last_pkt);
        } else {
            // Message
            stoptimer(A);
            tolayer5(A, packet.payload);
        }
    } else {
        printf("CCH> A_input> Invalid checksum\n");
        send_nack(A, &packet);
        stoptimer(A);
        starttimer(A, TIMEOUT);
        return;
    }
}
开发者ID:chooper,项目名称:csc-251,代码行数:36,代码来源:altbit.cpp

示例4: do_cmd_1_arg

int do_cmd_1_arg(QSP_ARG_DECL  Cmd_Index cmd_index, int data_word)
{
	u_short len;
	char pkt[20];
	USB2000_Cmd_Def *ucdp;

	ucdp = &usb2000_cmd_tbl[cmd_index];

	make_pkt( pkt, ucdp->ucd_cmd, data_word );

	send_pkt(QSP_ARG  pkt);

	len = strlen(pkt);

	if( get_echo(QSP_ARG  pkt) < 0 )
		return -1;

	if ( recv_a_byte(SINGLE_QSP_ARG) != ACK ) {
		WARN("ERROR: no ACK received");
		return -1;
	}

	if( get_tail(SINGLE_QSP_ARG) < 0 )
		return -1;

	return 0;
}
开发者ID:jbmulligan,项目名称:quip,代码行数:27,代码来源:usb2000.c

示例5: rom_send_DATA

int rom_send_DATA(CalcHandle* handle, uint32_t addr)
{
	ticalcs_info(" PC->TI: REQ_BLOCK at @%08x", addr);
	TRYF(send_pkt(handle, CMD_REQ_BLOCK, 4, (uint8_t *)&addr));

	return 0;
}
开发者ID:tobiasBora,项目名称:emacs_ti,代码行数:7,代码来源:romdump.c

示例6: test_ping

static int
test_ping(void)
{
	struct pkt *pkt;
	struct timeval tv;
	
	printf("ping: "); fflush(stdout);

	ping->pkt_icmp_msg->echo.icmp_id = rand_uint16(ctx.rnd);
	pkt = pkt_dup(ping);
	pkt->pkt_ip->ip_id = rand_uint16(ctx.rnd);
	ip_checksum(pkt->pkt_ip, pkt->pkt_end - pkt->pkt_eth_data);
	
	pcap_filter(ctx.pcap, "icmp[0] = 0 and src %s and dst %s",
	    addr_ntoa(&ctx.dst), addr_ntoa(&ctx.src));

	send_pkt(pkt);

	for (tv = read_tv; (pkt = recv_pkt(&tv)) != NULL; tv = read_tv) {
		if (memcmp(&pkt->pkt_icmp_msg->echo,
		    &ping->pkt_icmp_msg->echo, 8) == 0)
			break;
	}
	printf("%s\n", pkt ? timeval_ntoa(&tv) : "no reply");

	return (0);
}
开发者ID:stsi,项目名称:fragroute-ipv6,代码行数:27,代码来源:fragtest.c

示例7: network_send_pkt

int 
network_send_pkt(network_address_t dest_address, int hdr_len, 
		 char* hdr, int data_len, char* data) {
  //printf("network_send_pkt: called\n"); //DEBUG
  //printf("network_send_pkt : synthetic network - %d\n", synthetic_network);
  if (synthetic_network) {
    if(genrand() < loss_rate)
      return (hdr_len+data_len);

    if(genrand() < duplication_rate)
      send_pkt(dest_address, hdr_len, hdr, data_len, data);
  }

  //printf("call send_pkt\n");
  return send_pkt(dest_address, hdr_len, hdr, data_len, data);
}
开发者ID:barrycburton,项目名称:Minisystem-Message-Passing,代码行数:16,代码来源:old-network.c

示例8: rom_send_ERR

int rom_send_ERR(CalcHandle* handle)
{
  ticalcs_info(" PC->TI: ERROR");
  TRYF(send_pkt(handle, CMD_ERROR, 0, NULL));

  return 0;
}
开发者ID:tobiasBora,项目名称:emacs_ti,代码行数:7,代码来源:romdump.c

示例9: rom_send_RDY

int rom_send_RDY(CalcHandle* handle)
{
  ticalcs_info(" PC->TI: IS_READY");
  TRYF(send_pkt(handle, CMD_IS_READY, 0, NULL));

  return 0;
}
开发者ID:tobiasBora,项目名称:emacs_ti,代码行数:7,代码来源:romdump.c

示例10: rom_send_SIZE

int rom_send_SIZE(CalcHandle* handle)
{
	ticalcs_info(" PC->TI: REQ_SIZE");
	TRYF(send_pkt(handle, CMD_REQ_SIZE, 0, NULL));

	return 0;
}
开发者ID:tobiasBora,项目名称:emacs_ti,代码行数:7,代码来源:romdump.c

示例11: network_bcast_pkt

int
network_bcast_pkt(int hdr_len, char* hdr, int data_len, char* data)
{
    int i;
    int me;

    AbortOnCondition(!BCAST_ENABLED,
                     "Error: network broadcast not enabled.");

    if (BCAST_USE_TOPOLOGY_FILE) {

        me = topology.me;

        for (i=0; i<topology.entries[me].n_links; i++) {
            int dest = topology.entries[me].links[i];

            if (synthetic_network) {
                if(genrand() < loss_rate)
                    continue;

                if(genrand() < duplication_rate)
                    send_pkt(topology.entries[dest].addr, hdr_len, hdr, data_len, data);
            }

            if (send_pkt(topology.entries[dest].addr,
                         hdr_len, hdr, data_len, data) != hdr_len + data_len)
                return -1;
        }

        if (BCAST_LOOPBACK) {
            if (send_pkt(topology.entries[me].addr,
                         hdr_len, hdr, data_len, data) != hdr_len + data_len)
                return -1;
        }

    } else { /* real broadcast */

        /* send the packet using the private network broadcast address */
        if (send_pkt(broadcast_addr,
                     hdr_len, hdr, data_len, data) != hdr_len + data_len)
            return -1;

    }
    return hdr_len+data_len;
}
开发者ID:DolphinWilly,项目名称:PortOSnix,代码行数:45,代码来源:network.c

示例12: send_turn_signal

void send_turn_signal() {
	memset(&cf, 0, sizeof(cf));
	cf.can_id = signal_id;
	cf.len = signal_len;
	cf.data[signal_pos] = signal_state;
	if(signal_pos) randomize_pkt(0, signal_pos);
	if(signal_len != signal_pos + 1) randomize_pkt(signal_pos+1, signal_len);
	send_pkt(CAN_MTU);
}
开发者ID:jordonwu,项目名称:ICSim,代码行数:9,代码来源:controls.c

示例13: wpan_writeAttr

u8 wpan_writeAttr(u8* addr, u8 attr, u32* val)
{
    memcpy(ch.addr, addr, WPAN_ADDR_SIZE);
    wpan_pkt.header = WPAN_RW;
    wpan_pkt.reserve = 0;
    WPAN_CMD_TYPE(0) = WPAN_RW_MASK | (attr & WPAN_ATTR_MASK);
    WPAN_CMD_DAT(0) = *val;
    return send_pkt(&wpan_pkt); 
}
开发者ID:JDsolution,项目名称:ST-Node,代码行数:9,代码来源:wpan.c

示例14: A_timerinterrupt

/* called when A's timer goes off */
void A_timerinterrupt(void)
{
    printf("CCH> A_timerinterrupt> Called\n");

    if(last_ack && (last_ack->acknum < last_pkt->seqnum)) {
        printf("CCH> A_timerinterrupt> Packet timed out, resending\n");
        send_pkt(A, last_pkt);
    }
}  
开发者ID:chooper,项目名称:csc-251,代码行数:10,代码来源:altbit.cpp

示例15: send_unlock

void send_unlock(char door) {
	door_state &= ~door;
	memset(&cf, 0, sizeof(cf));
	cf.can_id = door_id;
	cf.len = door_len;
	cf.data[door_pos] = door_state;
	if (door_pos) randomize_pkt(0, door_pos);
	if (door_len != door_pos + 1) randomize_pkt(door_pos + 1, door_len);
	send_pkt(CAN_MTU);
}
开发者ID:jordonwu,项目名称:ICSim,代码行数:10,代码来源:controls.c


注:本文中的send_pkt函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。