• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ PSOCK_BEGIN函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: PT_THREAD

/*---------------------------------------------------------------------------*/
static
PT_THREAD(processes(struct httpd_state *s, char *ptr))
{
  PSOCK_BEGIN(&s->sout);
  for(s->u.ptr = PROCESS_LIST(); s->u.ptr != NULL; s->u.ptr = ((struct process *)s->u.ptr)->next) {
    PSOCK_GENERATOR_SEND(&s->sout, make_processes, s->u.ptr);
  }
  PSOCK_END(&s->sout);
}
开发者ID:13416795,项目名称:contiki,代码行数:10,代码来源:httpd-cgi.c


示例2: PT_THREAD

/*---------------------------------------------------------------------------*/
static
PT_THREAD(file_stats(struct httpd_state *s, char *ptr))
{
  PSOCK_BEGIN(&s->sout);

  PSOCK_GENERATOR_SEND(&s->sout, generate_file_stats, strchr(ptr, ' ') + 1);

  PSOCK_END(&s->sout);
}
开发者ID:dirk-brandewie,项目名称:freertos,代码行数:10,代码来源:httpd-cgi.c


示例3: PT_THREAD

static
PT_THREAD(send_part_of_file(struct httpd_state *s))
{
  PSOCK_BEGIN(&s->sout);

  PSOCK_GENERATOR_SEND(&s->sout, generate_len_part_of_file, s);
  
  PSOCK_END(&s->sout);
}
开发者ID:AntmanLFE,项目名称:hetnet_avr-uip,代码行数:9,代码来源:httpd.c


示例4: PT_THREAD

/*---------------------------------------------------------------------------*/
static
PT_THREAD(send_part_of_file(struct httpd_state *s))
{
  PSOCK_BEGIN(&s->sout);

  PSOCK_SEND(&s->sout, s->file.data, s->len);
  
  PSOCK_END(&s->sout);  
}
开发者ID:ZhepingYang,项目名称:contiki-1.x,代码行数:10,代码来源:httpd.c


示例5: PT_THREAD

static
PT_THREAD(sensorscall(struct httpd_state *s, char *ptr))
{
  static struct timer t;
  static int i;
  static char buf[100];
  static unsigned long last_cpu, last_lpm, last_listen, last_transmit;
  
  PSOCK_BEGIN(&s->sout);

  timer_set(&t, CLOCK_SECOND);
  i = 0;
  /*  while(1)*/ {
    /*    timer_restart(&t);
	  PSOCK_WAIT_UNTIL(&s->sout, timer_expired(&t));*/

#if CONTIKI_TARGET_SKY
    SENSORS_ACTIVATE(sht11_sensor);
    SENSORS_ACTIVATE(light_sensor);
    snprintf(buf, sizeof(buf),
	     "t(%d);h(%d);l1(%d);l2(%d);",
	     sht11_sensor.value(SHT11_SENSOR_TEMP),
	     sht11_sensor.value(SHT11_SENSOR_HUMIDITY),
             light_sensor.value(LIGHT_SENSOR_PHOTOSYNTHETIC),
             light_sensor.value(LIGHT_SENSOR_TOTAL_SOLAR));
    SENSORS_DEACTIVATE(sht11_sensor);
    SENSORS_DEACTIVATE(light_sensor);
#else /* CONTIKI_TARGET_SKY */
    snprintf(buf, sizeof(buf),
	     "t(%d);h(%d);l1(%d);l2(%d);",
	     0,
	     0,
	     0,
	     0);
#endif /* CONTIKI_TARGET_SKY */
    PSOCK_SEND_STR(&s->sout, buf);


    /*    timer_restart(&t);
	  PSOCK_WAIT_UNTIL(&s->sout, timer_expired(&t));*/
    snprintf(buf, sizeof(buf),
	     "p(%lu,%lu,%lu,%lu);i(%d);",
	     energest_type_time(ENERGEST_TYPE_CPU) - last_cpu,
	     energest_type_time(ENERGEST_TYPE_LPM) - last_lpm,
	     energest_type_time(ENERGEST_TYPE_TRANSMIT) - last_transmit,
	     energest_type_time(ENERGEST_TYPE_LISTEN) - last_listen,
	     i++);
    last_cpu = energest_type_time(ENERGEST_TYPE_CPU);
    last_lpm = energest_type_time(ENERGEST_TYPE_LPM);
    last_transmit = energest_type_time(ENERGEST_TYPE_TRANSMIT);
    last_listen = energest_type_time(ENERGEST_TYPE_LISTEN);
    PSOCK_SEND_STR(&s->sout, buf);

}
  PSOCK_END(&s->sout);
}
开发者ID:13416795,项目名称:contiki,代码行数:56,代码来源:ajax-cgi.c


示例6: PT_THREAD

/*---------------------------------------------------------------------------*/
static
PT_THREAD(send_headers(struct httpd_state *s, const char *statushdr))
{
  PSOCK_BEGIN(&s->sout);

  SEND_STRING(&s->sout, statushdr);
  SEND_STRING(&s->sout, get_content_type(s->filename));

  PSOCK_END(&s->sout);
}
开发者ID:13416795,项目名称:contiki,代码行数:11,代码来源:httpd-cfs.c


示例7: PT_THREAD

/*---------------------------------------------------------------------------*/
static
PT_THREAD(header(struct httpd_state *s, char *ptr))
{

  PSOCK_BEGIN(&s->sout);

  PSOCK_GENERATOR_SEND(&s->sout, generate_header, (void *) ptr);
  
  PSOCK_END(&s->sout);
}
开发者ID:chanhemow,项目名称:contiki-fork,代码行数:11,代码来源:httpd-cgi.c


示例8: PT_THREAD

static PT_THREAD(handle_output(contiki_data_t *s))
{
	PSOCK_BEGIN(&s->p);
	if (s->state == WRITTING) {
		PSOCK_SEND(&s->p, s->out_buf, s->out_len);
		s->state = WRITE_END;
		process_post_synch(s->process, xively_event, s);
	}
	PSOCK_END(&s->p);
}
开发者ID:foss-for-synopsys-dwc-arc-processors,项目名称:libxively,代码行数:10,代码来源:contiki_io_layer.c


示例9: PT_THREAD

/*
 =======================================================================================================================
 =======================================================================================================================
 */
static PT_THREAD(handle_input (struct httpd_state *s))
{
	PSOCK_BEGIN(&s->sin);

	PSOCK_READTO(&s->sin, ISO_space);

	if(strncmp(s->inputbuf, http_get, 4) != 0)
	{
		PSOCK_CLOSE_EXIT(&s->sin);
	}

	PSOCK_READTO(&s->sin, ISO_space);

	if(s->inputbuf[0] != ISO_slash)
	{
		PSOCK_CLOSE_EXIT(&s->sin);
	}

	if(s->inputbuf[1] == ISO_space)
	{
		strncpy(s->filename, http_index_html, sizeof(s->filename));
	}
	else
	{
		s->inputbuf[PSOCK_DATALEN(&s->sin) - 1] = 0;

		/* Process any form input being sent to the server. */
		{
			/*
			 * extern void vApplicationProcessFormInput( char *pcInputString, long
			 * xInputLength ); £
			 * vApplicationProcessFormInput( s->inputbuf, PSOCK_DATALEN(&s->sin) );
			 */
		}

		strncpy(s->filename, &s->inputbuf[0], sizeof(s->filename));
	}

	/* httpd_log_file(uip_conn->ripaddr, s->filename); */
	s->state = STATE_OUTPUT;

	while(1)
	{
		PSOCK_READTO(&s->sin, ISO_nl);

		if(strncmp(s->inputbuf, http_referer, 8) == 0)
		{
			s->inputbuf[PSOCK_DATALEN(&s->sin) - 2] = 0;

			/* httpd_log(&s->inputbuf[9]); */
		}
	}

	PSOCK_END(&s->sin);
}
开发者ID:Hermis,项目名称:FreeRTOS_OR1200,代码行数:59,代码来源:httpd.c


示例10: PT_THREAD

static PT_THREAD(send_file(struct httpd_state *s)) {
	PSOCK_BEGIN(&s->sout);
	
	do {
		PSOCK_GENERATOR_SEND(&s->sout, generate_part_of_file, s);
		s->file.len -= s->len;
		s->file.data += s->len;
	} while(s->file.len > 0);
	
	PSOCK_END(&s->sout);
}
开发者ID:Madswinther,项目名称:31370,代码行数:11,代码来源:httpd.c


示例11: PT_THREAD

/*---------------------------------------------------------------------------*/
static
PT_THREAD(file_stats(struct httpd_state *s, char *ptr))
{

  PSOCK_BEGIN(&s->sout);

  //while (pgm_read_byte(ptr++)!=' ') {};	//skip to "/filename" after the script invokation
  PSOCK_GENERATOR_SEND(&s->sout, generate_file_stats, (void *) (strchr_P(ptr, ' ') + 1));
  
  PSOCK_END(&s->sout);
}
开发者ID:vickyviolin,项目名称:contiki-arduino-2.2,代码行数:12,代码来源:httpd-cgi.c


示例12: PT_THREAD

/*---------------------------------------------------------------------------*/
static PT_THREAD( handle_input ( struct httpd_state *s ) )
{
	PSOCK_BEGIN( &s->sin );
	( void ) PT_YIELD_FLAG;
	PSOCK_READTO( &s->sin, ISO_space );

	if( strncmp(s->inputbuf, http_get, 4) != 0 )
	{
		PSOCK_CLOSE_EXIT( &s->sin );
	}

	PSOCK_READTO( &s->sin, ISO_space );

	if( s->inputbuf[0] != ISO_slash )
	{
		PSOCK_CLOSE_EXIT( &s->sin );
	}

	if( s->inputbuf[1] == ISO_space )
	{
		strncpy( s->filename, http_index_html, sizeof(s->filename) );
	}
	else
	{
		s->inputbuf[PSOCK_DATALEN( &s->sin ) - 1] = 0;
		
		/* Process any form input being sent to the server. */
		#if UIP_CONF_PROCESS_HTTPD_FORMS == 1
		{
			extern void vApplicationProcessFormInput( char *pcInputString );
			vApplicationProcessFormInput( s->inputbuf );
		}
		#endif
		
		strncpy( s->filename, &s->inputbuf[0], sizeof(s->filename) );
	}

	/*  httpd_log_file(uip_conn->ripaddr, s->filename);*/
	s->state = STATE_OUTPUT;

	while( 1 )
	{
		PSOCK_READTO( &s->sin, ISO_nl );

		if( strncmp(s->inputbuf, http_referer, 8) == 0 )
		{
			s->inputbuf[PSOCK_DATALEN( &s->sin ) - 2] = 0;

			/*      httpd_log(&s->inputbuf[9]);*/
		}
	}

	PSOCK_END( &s->sin );
}
开发者ID:AldenHiggins,项目名称:ELEC424-Lab06-Scheduling-with-FreeRTOS,代码行数:55,代码来源:httpd.c


示例13: PT_THREAD

static PT_THREAD(lights_list(struct httpd_state *s, char *))
{

  PSOCK_BEGIN(&s->sout);

  for(s->count = 0; lights[s->count].is_valid_P(); ++s->count) {
    PSOCK_GENERATOR_SEND(&s->sout, generate_lights_list, s);
  }

  PSOCK_END(&s->sout);
}
开发者ID:MD4N1,项目名称:NanoUIP,代码行数:11,代码来源:httpd_cgi.cpp


示例14: PT_THREAD

//const char http_content_type_json[] = "Content-type:application/json\n\n";
static
PT_THREAD(send_headers(struct httpd_state *s, const char *statushdr))
{
  PSOCK_BEGIN(&s->sout);

  SEND_STRING(&s->sout, statushdr);

  //SEND_STRING(&s->sout, http_content_type_json);

  PSOCK_END(&s->sout);
}
开发者ID:kicco73,项目名称:SmartLiving,代码行数:12,代码来源:httpd-simple.c


示例15: PT_THREAD

/*---------------------------------------------------------------------------*/
static
PT_THREAD(rplreset(struct httpd_state *s, char *ptr))
{
  PSOCK_BEGIN(&s->sout);
  if(rpl_repair_root(RPL_DEFAULT_INSTANCE)) {
    PSOCK_SEND_STR(&s->sout, "Initiating global repair of RPL network...");
  } else {
    PSOCK_SEND_STR(&s->sout, "Could not start global network repair");
  }
  PSOCK_END(&s->sout);
}
开发者ID:ADVANSEE,项目名称:mist,代码行数:12,代码来源:httpd-cgi.c


示例16: PT_THREAD

/*---------------------------------------------------------------------------*/
static PT_THREAD( tcp_stats ( struct httpd_state *s, char *ptr ) )
{
    PSOCK_BEGIN( &s->sout );

    for( s->count = 0; s->count < UIP_CONNS; ++s->count ) {
        if( (uip_conns[s->count].tcpstateflags & UIP_TS_MASK) != UIP_CLOSED ) {
            PSOCK_GENERATOR_SEND( &s->sout, generate_tcp_stats, s );
        }
    }

    PSOCK_END( &s->sout );
}
开发者ID:peterliu2,项目名称:FreeRTOS,代码行数:13,代码来源:httpd-cgi.c


示例17: PT_THREAD

/*---------------------------------------------------------------------------*/
static
PT_THREAD(file_stats(struct httpd_state *s, char *ptr))
{

  PSOCK_BEGIN(&s->sout);

  thisfilename=&s->filename[0]; //temporary way to pass filename to generate_file_stats
  
  PSOCK_GENERATOR_SEND(&s->sout, generate_file_stats, (void *) ptr);
  
  PSOCK_END(&s->sout);
}
开发者ID:AWRyder,项目名称:contiki,代码行数:13,代码来源:httpd-cgi.c


示例18: PT_THREAD

/*---------------------------------------------------------------------------*/
static
PT_THREAD(handle_input(struct httpd_state *s))
{
  char *LEDptr;

  PSOCK_BEGIN(&s->sin);

  PSOCK_READTO(&s->sin, ISO_space);

  
  if(strncmp(s->inputbuf, http_get, 4) == 0) {

  PSOCK_READTO(&s->sin, ISO_space);

  if(s->inputbuf[0] != ISO_slash) {
    PSOCK_CLOSE_EXIT(&s->sin);
  }

  if(s->inputbuf[1] == ISO_space) {
    strncpy(s->filename, http_index_html, sizeof(s->filename));
  } else {
    s->inputbuf[PSOCK_DATALEN(&s->sin) - 1] = 0;
    strncpy(s->filename, &s->inputbuf[0], sizeof(s->filename));
  }

  // Renesas ++
  LEDptr = strstr(s->inputbuf, "LEDA");

  if (LEDptr !=NULL)
  {
      strncpy(LEDbuf, (const char *)(LEDptr), sizeof(LEDbuf));
      LEDflag = 1;
  }
  // End of Renesas ++

  /*  httpd_log_file(uip_conn->ripaddr, s->filename);*/

  s->state = STATE_OUTPUT;

  while(1) {
	PSOCK_READTO(&s->sin, ISO_nl);

    if(strncmp(s->inputbuf, http_referer, 8) == 0) {
	  s->inputbuf[PSOCK_DATALEN(&s->sin) - 2] = 0;
	  /*      httpd_log(&s->inputbuf[9]);*/
	}
    }
  }else {
  PSOCK_CLOSE_EXIT(&s->sin);
  }
  
  PSOCK_END(&s->sin);
}
开发者ID:exosite-garage,项目名称:rx62n_pmod_cloud,代码行数:54,代码来源:httpd.c


示例19: handle_tcp_connection

static int handle_tcp_connection(struct psock *p, enum tcp_event_type type,
				 struct net_buf *buf)
{
	PSOCK_BEGIN(p);

	if (type == TCP_WRITE_EVENT) {
		NET_DBG("Trying to send %d bytes data\n", uip_appdatalen(buf));
		PSOCK_SEND(p, buf);
	}

	PSOCK_END(p);
}
开发者ID:32bitmicro,项目名称:zephyr,代码行数:12,代码来源:net_context.c


示例20: PT_THREAD

static
PT_THREAD(handle_input(struct httpd_state *s))
{
  PSOCK_BEGIN(&s->sin);

  PSOCK_READTO(&s->sin, ISO_space);

  if(strncmp(s->inputbuf, http_get, 4) == 0) {
    s->request_type = REQUEST_TYPE_GET;
  } else if(strncmp(s->inputbuf, http_put, 4) == 0) {
    s->request_type = REQUEST_TYPE_PUT;
  } else if(strncmp(s->inputbuf, http_post, 5) == 0) {
    s->request_type = REQUEST_TYPE_POST;
  } else if(strncmp(s->inputbuf, http_delete, 7) == 0) {
    s->request_type = REQUEST_TYPE_DELETE;
  } else {
    PSOCK_CLOSE_EXIT(&s->sin);
  }
  PSOCK_READTO(&s->sin, ISO_space);

  if(s->inputbuf[0] != ISO_slash) {
    PSOCK_CLOSE_EXIT(&s->sin);
  }
  s->query = NULL;
#if URLCONV
  s->inputbuf[PSOCK_DATALEN(&s->sin) - 1] = 0;
  urlconv_tofilename(s->filename, &s->query, s->inputbuf, sizeof(s->filename));
  if(s->filename[1] == 0) {
    strncpy(s->filename, http_index_html, sizeof(s->filename));
  }
#else /* URLCONV */
  if(s->inputbuf[1] == ISO_space) {
    strncpy(s->filename, http_index_html, sizeof(s->filename));
  } else {
    s->inputbuf[PSOCK_DATALEN(&s->sin) - 1] = 0;
    strncpy(s->filename, s->inputbuf, sizeof(s->filename));
  }
#endif /* URLCONV */
  if(s->query) {
    LOG6LBR_6ADDR(DEBUG, &uip_conn->ripaddr, "Request for '%s?%s' from ", s->filename, s->query);
  } else {
    LOG6LBR_6ADDR(DEBUG, &uip_conn->ripaddr, "Request for '%s' from ", s->filename);
  }

  s->state = STATE_OUTPUT;

  while(1) {
    PSOCK_READTO(&s->sin, ISO_nl);
  }

  PSOCK_END(&s->sin);
}
开发者ID:Ayesha-N,项目名称:6lbr,代码行数:52,代码来源:httpd.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ PSOCK_END函数代码示例发布时间:2022-05-30
下一篇:
C++ PSIZE函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap