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

C++ PSOCK_GENERATOR_SEND函数代码示例

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

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



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

示例1: 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


示例2: PT_THREAD

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

  PSOCK_BEGIN(&s->sout);

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

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


示例3: 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


示例4: 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


示例5: PT_THREAD

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

  PSOCK_BEGIN(&s->sout);

  /* Pass string after cgi invocation to the generator */
  s->u.ptr = ptr;
  PSOCK_GENERATOR_SEND(&s->sout, generate_file_stats, s);
  
  PSOCK_END(&s->sout);
}
开发者ID:chanhemow,项目名称:contiki-fork,代码行数:13,代码来源:httpd-cgi.c


示例6: 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


示例7: PT_THREAD

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

  for(s->u.ptr = ip64_addrmap_list();
      s->u.ptr != NULL;
      s->u.ptr = list_item_next(s->u.ptr)) {
    PSOCK_GENERATOR_SEND(&s->sout, make_addrmap, s);
  }

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


示例8: handle_connection

static int handle_connection(struct webserver_state *s)
{
	PSOCK_BEGIN(&s->p);

	// the incoming GET request will have the following format:
	// GET / HTTP/1.1 ....
	// we have to parse this string to determine the resource being requested
	// if the requested resource is not the root webpage ('/') then,
	// GET /<resource name> HTTP/1.1 ....
	// we should parse the specific resource and react appropriately

	// read incoming data until we read a space character
	PSOCK_READTO(&s->p, ISO_space);

	// parse the data to determine if it was a GET request
	if(strncmp(s->inputbuf, http_get, 4) != 0) {
		PSOCK_CLOSE_EXIT(&s->p);
	}

	// continue reading until the next space character
	PSOCK_READTO(&s->p, ISO_space);

	// determine the requested resource
	// in this case, we check if the request was for the '/' root page
	// AKA index.html
	if(s->inputbuf[0] != ISO_slash) {
		// request for unknown webpage, close and exit
		PSOCK_CLOSE_EXIT(&s->p);
	}

	if(s->inputbuf[1] != ISO_space) {
		// request for unavailable resource
		// not supported, modify to add support for additional resources
		PSOCK_CLOSE_EXIT(&s->p);
	}

	lockstate = lockstate+1;

        PSOCK_SEND_STR(&s->p, "HTTP/1.1 200 OK\r\n");
	PSOCK_SEND_STR(&s->p, "Content-Type: text/html\r\n");
	PSOCK_SEND_STR(&s->p, "\r\n");
	PSOCK_SEND_STR(&s->p, "Hello World, I am WiShield");
	PSOCK_SEND_STR(&s->p, "<center><h1>Hello World!! I am Matt's WiShield.  Find me in webserver.c under PSOCK_SEND_STR.</h1></center>");
        PSOCK_GENERATOR_SEND(&s->p, fill_buf, 0);
	PSOCK_CLOSE(&s->p);
	PSOCK_END(&s->p);
}
开发者ID:shinsyotta,项目名称:Unlock,代码行数:47,代码来源:webserver.c


示例9: PT_THREAD

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

  announcement_listen(1);
  
  /*  printf("neighbor_num %d\n", collect_neighbor_list_num(&neighbor_list)); */
  
  for(s->u.count = 0; s->u.count < collect_neighbor_list_num(&neighbor_list); s->u.count++) {
    /*  printf("count %d\n", s->u.count); */
    if(collect_neighbor_list_get(&neighbor_list, s->u.count) != NULL) {
      /*  printf("!= NULL\n"); */
      PSOCK_GENERATOR_SEND(&s->sout, make_neighbor, s);
    }
  }

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


示例10: handle_connection

static uint16_t handle_connection(struct simple_httpd_state *s)
{
	PSOCK_BEGIN(&s->p);

	int comp;

	// the incoming GET request will have the following format:
	// GET / HTTP/1.1 ....
	// we have to parse this string to determine the resource being requested
	// if the requested resource is not the root webpage ('/') then,
	// GET /<resource name> HTTP/1.1 ....
	// we should parse the specific resource and react appropriately

	// read incoming data until we read a space character
	PSOCK_READTO(&s->p, ISO_space);

	// parse the data to determine if it was a GET request
	if((comp = strncmp_P((const char *)(s->inputbuf), (const char *)http_get, 4)) != 0)
	{
		PSOCK_CLOSE_EXIT(&s->p);
	}

	// continue reading until the next space character
	PSOCK_READTO(&s->p, ISO_space);

	// determine the requested resource
	// in this case, we check if the request was for the '/' root page
	// AKA index.html
	if(s->inputbuf[0] != ISO_slash){
		PSOCK_CLOSE_EXIT(&s->p);				// request for unknown webpage, close and exit
	}

	// not supported, modify to add support for additional resources
	if(s->inputbuf[1] != ISO_space){
		PSOCK_CLOSE_EXIT(&s->p);				// request for unavailable resource, close and exit
	}

	PSOCK_GENERATOR_SEND(&s->p, fill_buf, 0); 	// generate the web page response with fill_buf from PSTR variable

	PSOCK_CLOSE(&s->p);
	PSOCK_END(&s->p);
}
开发者ID:Faeriol,项目名称:SEG4545,代码行数:42,代码来源:simple-httpd.c


示例11: PT_THREAD

/***** VOLTAGE *****/
static
PT_THREAD(volt_stats(struct httpd_state *s, char *ptr))
{
  
  char *f = strchr(ptr, ' ') + 1; // pointer to "second" argument from xml file
  
  /* Character matching of "2nd argument" from XML file */
  #define REQ_ARGUMENT_LENGTH 4 // 4 is size of sample referencing specified in XML files!
  char sampleIndexStr[REQ_ARGUMENT_LENGTH + 1] = ""; //Remember +1 for NULL byte!
  strncat(sampleIndexStr, f+0, REQ_ARGUMENT_LENGTH);
  s->requestedNoOfSamples = atoi(sampleIndexStr); // This is relative so that "now" is zero and needs to be translated to circular buffer index.

  s->circularBufferLastWriteAtCallTime = voltageShortHistLastWriteIndex; //Save it in a httpd_state as this function will be interrupted and local variables can change
  
  PSOCK_BEGIN(&s->sout);

  /** generate functions gets called ONCE PER value at the moment **/
  for(s->count = 0;   s->count  <  s->requestedNoOfSamples;  ){//  ++s->count) { //expression3 is omitted and done put generate function!!!!
      PSOCK_GENERATOR_SEND(&s->sout, generate_volt_stats, s);
  }//for

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


示例12: 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);
	
	#ifdef PAKAI_FILE_SIMPAN
	if ( s->file.flag == 27 )
	{
		//printf(" Close file\r\n");
		
		f_close( s->file.fd );
		
    }
    #endif
	
  PSOCK_END(&s->sout);
}
开发者ID:hericz,项目名称:atinom_banyu,代码行数:25,代码来源:httpd.c


示例13: PT_THREAD

static PT_THREAD(led_io(struct httpd_state *s, char *ptr))
{
  PSOCK_BEGIN(&s->sout);
  PSOCK_GENERATOR_SEND(&s->sout, generate_io_state, NULL);
  PSOCK_END(&s->sout);
}
开发者ID:dirk-brandewie,项目名称:freertos,代码行数:6,代码来源:httpd-cgi.c


示例14: PT_THREAD

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

  PSOCK_GENERATOR_SEND(&s->sout, generate_status, (char *) statushdr);

  ptr = strrchr(s->filename, ISO_period);
  if (httpd_strncmp("4", statushdr, 1) == 0) { //404
    PSOCK_GENERATOR_SEND(&s->sout, generate_header, &httpd_mime_htm);
  } else if (ptr == NULL) {
#if WEBSERVER_CONF_BIN
    PSOCK_GENERATOR_SEND(&s->sout, generate_header, &httpd_mime_bin);
#else
    PSOCK_GENERATOR_SEND(&s->sout, generate_header, &httpd_mime_htm);
#endif 
  } else {
    ptr++;
#if WEBSERVER_CONF_INCLUDE || WEBSERVER_CONF_CGI
    if (httpd_strncmp(ptr, &httpd_mime_htm[5], 3) == 0 || httpd_strncmp(ptr, &httpd_str_shtml[1], 4) == 0) {
#else
    if (httpd_strncmp(ptr, &httpd_mime_htm[5], 3) == 0) {
#endif
      PSOCK_GENERATOR_SEND(&s->sout, generate_header, &httpd_mime_htm);
#if WEBSEVER_CONF_CSS
    } else if (httpd_strcmp(ptr, &httpd_mime_css[5]) == 0) {
      PSOCK_GENERATOR_SEND(&s->sout, generate_header, &httpd_mime_css);
#endif
#if WEBSERVER_CONF_PNG
    } else if (httpd_strcmp(ptr, &httpd_mime_png[6]) == 0) {
      PSOCK_GENERATOR_SEND(&s->sout, generate_header, &httpd_mime_png);
#endif
#if WEBSERVER_CONF_GIF
    } else if (httpd_strcmp(ptr, &httpd_mime_gif[6]) == 0) {
      PSOCK_GENERATOR_SEND(&s->sout, generate_header, &httpd_mime_gif);
#endif
#if WEBSERVER_CONF_JPG
    } else if (httpd_strcmp(ptr, httpd_mime_jpg) == 0) {
      PSOCK_GENERATOR_SEND(&s->sout, generate_header, &httpd_mime_jpg);
#endif
#if WEBSERVER_CONF_TXT
    } else {
      PSOCK_GENERATOR_SEND(&s->sout, generate_header, &httpd_mime_txt);
#endif
    }
  }
  PSOCK_END(&s->sout);
}
/*---------------------------------------------------------------------------*/
static
PT_THREAD(handle_output(struct httpd_state *s))
{
  char *ptr;

  PT_BEGIN(&s->outputpt);

#if DEBUGLOGIC
  httpd_strcpy(s->filename, httpd_str_indexfn);
#endif

  s->fd = httpd_fs_open(s->filename, HTTPD_FS_READ);
  if (s->fd == -1) { // Opening file failed.

    /* TODO: try index.htm ? */
#if WEBSERVER_CONF_INCLUDE || WEBSERVER_CONF_CGI
    /* If index.html not found try index.htm */
    if (httpd_strcmp(s->filename, httpd_str_indexfn) == 0) {
      httpd_strcpy(s->filename, httpd_str_indexfn3);
    }
    s->fd = httpd_fs_open(s->filename, HTTPD_FS_READ);
    if (s->fd != -1) {
      goto sendfile;
    }
    /* If index.html not found try index.shtml */
    if (httpd_strcmp(s->filename, httpd_str_indexfn) == 0) {
      httpd_strcpy(s->filename, httpd_str_indexsfn);
    }
    s->fd = httpd_fs_open(s->filename, HTTPD_FS_READ);
    if (s->fd == -1) {
      PRINTD("Opening %s failed\n", s->filename);
      goto psock_close;
    } else {
      goto sendfile;
    }
#endif
    /* If nothing was found, send 404 page */
    httpd_strcpy(s->filename, httpd_str_404fn);
    s->fd = httpd_fs_open(s->filename, HTTPD_FS_READ);
    PT_WAIT_THREAD(&s->outputpt, send_headers(s, httpd_str_404notf));
    PT_WAIT_THREAD(&s->outputpt, send_file(s));

  } else { // Opening file succeeded.

sendfile:
    PT_WAIT_THREAD(&s->outputpt, send_headers(s, httpd_str_200ok));
#if WEBSERVER_CONF_INCLUDE || WEBSERVER_CONF_CGI
    /* If filename ends with .shtml, scan file for script includes or cgi */
    ptr = strchr(s->filename, ISO_period);
//.........这里部分代码省略.........
开发者ID:DrMcCoy,项目名称:contiki-inga,代码行数:101,代码来源:httpd.c


示例15: PT_THREAD

static
PT_THREAD(generate_routes(struct httpd_state *s))
{
  uint8_t i=0;
  PSOCK_BEGIN(&s->sout);

  PSOCK_GENERATOR_SEND(&s->sout, generate_string_P, (char *) TOP1);
  PSOCK_GENERATOR_SEND(&s->sout, generate_string_P, (char *) TOP2);

#if UIP_CONF_IPV6     //allow ip4 builds
  blen = 0;
  ADD("<h2>Neighbors [%u max]</h2>",UIP_DS6_NBR_NB);
  PSOCK_GENERATOR_SEND(&s->sout, generate_string, buf);  
  blen = 0;
  for(i = 0; i < UIP_DS6_NBR_NB; i++) {
    if(uip_ds6_nbr_cache[i].isused) {
      ipaddr_add(&uip_ds6_nbr_cache[i].ipaddr);
      ADD("<br>");
//    if(blen > sizeof(buf) - 45) {
        PSOCK_GENERATOR_SEND(&s->sout, generate_string, buf);  
        blen = 0;
//    }
    }
  }

  ADD("<h2>Routes [%u max]</h2>",UIP_DS6_ROUTE_NB);
  PSOCK_GENERATOR_SEND(&s->sout, generate_string, buf);  
  blen = 0;
  for(i = 0; i < UIP_DS6_ROUTE_NB; i++) {
    if(uip_ds6_routing_table[i].isused) {
      ipaddr_add(&uip_ds6_routing_table[i].ipaddr);
      ADD("/%u (via ", uip_ds6_routing_table[i].length);
 	  PSOCK_GENERATOR_SEND(&s->sout, generate_string, buf);
      blen=0;
      ipaddr_add(&uip_ds6_routing_table[i].nexthop);
      if(uip_ds6_routing_table[i].state.lifetime < 600) {
        PSOCK_GENERATOR_SEND(&s->sout, generate_string, buf);
        blen=0;
        ADD(") %lus<br>", uip_ds6_routing_table[i].state.lifetime);
      } else {
        ADD(")<br>");
      }
	  PSOCK_GENERATOR_SEND(&s->sout, generate_string, buf);  
      blen = 0;
    }
  }
  if(blen > 0) {
	PSOCK_GENERATOR_SEND(&s->sout, generate_string, buf);  
    blen = 0;
  }
#else /* UIP_CONF_IPV6 */
  blen = 0;i++;
  ADD("<h2>Hey, you got ip4 working!</h2>");
  PSOCK_GENERATOR_SEND(&s->sout, generate_string, buf);  
#endif /* UIP_CONF_IPV6 */

  PSOCK_GENERATOR_SEND(&s->sout, generate_string_P, (char *) BOTTOM);  

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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ PSP_CoreParameter函数代码示例发布时间:2022-05-30
下一篇:
C++ PSOCK_END函数代码示例发布时间: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