コード例 #1
0
ファイル: httplog.c プロジェクト: EtherGraf/ethersex
uint8_t
httplog(char status[140] )
{
  /* Transmission taking action */
  if (httplog_tmp_buf) return 0;

  uint8_t len = strlen(status);
  if (len > 140) {
    HTTPLOG_DEBUG("message too long: cropping");
    len = 140;
  }

  httplog_tmp_buf = malloc(140);
  if (!httplog_tmp_buf) return 0;

  memcpy(httplog_tmp_buf, status, len);
  httplog_tmp_buf[len] = 0;

  uip_ipaddr_t *ipaddr;
  if (!(ipaddr = resolv_lookup(CONF_HTTPLOG_SERVICE))) {
    resolv_query(CONF_HTTPLOG_SERVICE, httplog_dns_query_cb);
  } else {
    httplog_dns_query_cb(NULL, ipaddr);
  }
  return 1;
}
コード例 #2
0
ファイル: httplog.c プロジェクト: picohari/intewa_firmware
static void
httplog_resolve_address(void)
{
  uip_ipaddr_t *ipaddr;
  if (!(ipaddr = resolv_lookup(CONF_HTTPLOG_SERVICE)))
  {
    resolv_query(CONF_HTTPLOG_SERVICE, httplog_dns_query_cb);
  }
  else
  {
    httplog_dns_query_cb(NULL, ipaddr);
  }
}