Hi. This is the feed program for Cosm. (The previous name of the services is Pachube.)

Dependencies:   mbed ThermistorPack Pachube ConfigFile EthernetNetIf TextLCD HTTPClient_ToBeRemoved FatFileSystem SDFileSystem

Committer:
shintamainjp
Date:
Mon Aug 06 12:37:59 2012 +0000
Revision:
0:521ba375aa0f
Pachube renamed to Cosm.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
shintamainjp 0:521ba375aa0f 1 /*
shintamainjp 0:521ba375aa0f 2 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
shintamainjp 0:521ba375aa0f 3 * All rights reserved.
shintamainjp 0:521ba375aa0f 4 *
shintamainjp 0:521ba375aa0f 5 * Redistribution and use in source and binary forms, with or without modification,
shintamainjp 0:521ba375aa0f 6 * are permitted provided that the following conditions are met:
shintamainjp 0:521ba375aa0f 7 *
shintamainjp 0:521ba375aa0f 8 * 1. Redistributions of source code must retain the above copyright notice,
shintamainjp 0:521ba375aa0f 9 * this list of conditions and the following disclaimer.
shintamainjp 0:521ba375aa0f 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
shintamainjp 0:521ba375aa0f 11 * this list of conditions and the following disclaimer in the documentation
shintamainjp 0:521ba375aa0f 12 * and/or other materials provided with the distribution.
shintamainjp 0:521ba375aa0f 13 * 3. The name of the author may not be used to endorse or promote products
shintamainjp 0:521ba375aa0f 14 * derived from this software without specific prior written permission.
shintamainjp 0:521ba375aa0f 15 *
shintamainjp 0:521ba375aa0f 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
shintamainjp 0:521ba375aa0f 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
shintamainjp 0:521ba375aa0f 18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
shintamainjp 0:521ba375aa0f 19 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
shintamainjp 0:521ba375aa0f 20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
shintamainjp 0:521ba375aa0f 21 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
shintamainjp 0:521ba375aa0f 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
shintamainjp 0:521ba375aa0f 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
shintamainjp 0:521ba375aa0f 24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
shintamainjp 0:521ba375aa0f 25 * OF SUCH DAMAGE.
shintamainjp 0:521ba375aa0f 26 *
shintamainjp 0:521ba375aa0f 27 * This file is part of the lwIP TCP/IP stack.
shintamainjp 0:521ba375aa0f 28 *
shintamainjp 0:521ba375aa0f 29 * Author: Adam Dunkels <adam@sics.se>
shintamainjp 0:521ba375aa0f 30 *
shintamainjp 0:521ba375aa0f 31 */
shintamainjp 0:521ba375aa0f 32 #ifndef __LWIP_API_MSG_H__
shintamainjp 0:521ba375aa0f 33 #define __LWIP_API_MSG_H__
shintamainjp 0:521ba375aa0f 34
shintamainjp 0:521ba375aa0f 35 #include "lwip/opt.h"
shintamainjp 0:521ba375aa0f 36
shintamainjp 0:521ba375aa0f 37 #if LWIP_NETCONN /* don't build if not configured for use in lwipopts.h */
shintamainjp 0:521ba375aa0f 38
shintamainjp 0:521ba375aa0f 39 #include <stddef.h> /* for size_t */
shintamainjp 0:521ba375aa0f 40
shintamainjp 0:521ba375aa0f 41 #include "lwip/ip_addr.h"
shintamainjp 0:521ba375aa0f 42 #include "lwip/err.h"
shintamainjp 0:521ba375aa0f 43 #include "lwip/sys.h"
shintamainjp 0:521ba375aa0f 44 #include "lwip/igmp.h"
shintamainjp 0:521ba375aa0f 45 #include "lwip/api.h"
shintamainjp 0:521ba375aa0f 46
shintamainjp 0:521ba375aa0f 47 #ifdef __cplusplus
shintamainjp 0:521ba375aa0f 48 extern "C" {
shintamainjp 0:521ba375aa0f 49 #endif
shintamainjp 0:521ba375aa0f 50
shintamainjp 0:521ba375aa0f 51 #define NETCONN_SHUT_RD 1
shintamainjp 0:521ba375aa0f 52 #define NETCONN_SHUT_WR 2
shintamainjp 0:521ba375aa0f 53 #define NETCONN_SHUT_RDWR 3
shintamainjp 0:521ba375aa0f 54
shintamainjp 0:521ba375aa0f 55 /* IP addresses and port numbers are expected to be in
shintamainjp 0:521ba375aa0f 56 * the same byte order as in the corresponding pcb.
shintamainjp 0:521ba375aa0f 57 */
shintamainjp 0:521ba375aa0f 58 /** This struct includes everything that is necessary to execute a function
shintamainjp 0:521ba375aa0f 59 for a netconn in another thread context (mainly used to process netconns
shintamainjp 0:521ba375aa0f 60 in the tcpip_thread context to be thread safe). */
shintamainjp 0:521ba375aa0f 61 struct api_msg_msg {
shintamainjp 0:521ba375aa0f 62 /** The netconn which to process - always needed: it includes the semaphore
shintamainjp 0:521ba375aa0f 63 which is used to block the application thread until the function finished. */
shintamainjp 0:521ba375aa0f 64 struct netconn *conn;
shintamainjp 0:521ba375aa0f 65 /** The return value of the function executed in tcpip_thread. */
shintamainjp 0:521ba375aa0f 66 err_t err;
shintamainjp 0:521ba375aa0f 67 /** Depending on the executed function, one of these union members is used */
shintamainjp 0:521ba375aa0f 68 union {
shintamainjp 0:521ba375aa0f 69 /** used for do_send */
shintamainjp 0:521ba375aa0f 70 struct netbuf *b;
shintamainjp 0:521ba375aa0f 71 /** used for do_newconn */
shintamainjp 0:521ba375aa0f 72 struct {
shintamainjp 0:521ba375aa0f 73 u8_t proto;
shintamainjp 0:521ba375aa0f 74 } n;
shintamainjp 0:521ba375aa0f 75 /** used for do_bind and do_connect */
shintamainjp 0:521ba375aa0f 76 struct {
shintamainjp 0:521ba375aa0f 77 ip_addr_t *ipaddr;
shintamainjp 0:521ba375aa0f 78 u16_t port;
shintamainjp 0:521ba375aa0f 79 } bc;
shintamainjp 0:521ba375aa0f 80 /** used for do_getaddr */
shintamainjp 0:521ba375aa0f 81 struct {
shintamainjp 0:521ba375aa0f 82 ip_addr_t *ipaddr;
shintamainjp 0:521ba375aa0f 83 u16_t *port;
shintamainjp 0:521ba375aa0f 84 u8_t local;
shintamainjp 0:521ba375aa0f 85 } ad;
shintamainjp 0:521ba375aa0f 86 /** used for do_write */
shintamainjp 0:521ba375aa0f 87 struct {
shintamainjp 0:521ba375aa0f 88 const void *dataptr;
shintamainjp 0:521ba375aa0f 89 size_t len;
shintamainjp 0:521ba375aa0f 90 u8_t apiflags;
shintamainjp 0:521ba375aa0f 91 } w;
shintamainjp 0:521ba375aa0f 92 /** used for do_recv */
shintamainjp 0:521ba375aa0f 93 struct {
shintamainjp 0:521ba375aa0f 94 u32_t len;
shintamainjp 0:521ba375aa0f 95 } r;
shintamainjp 0:521ba375aa0f 96 /** used for do_close (/shutdown) */
shintamainjp 0:521ba375aa0f 97 struct {
shintamainjp 0:521ba375aa0f 98 u8_t shut;
shintamainjp 0:521ba375aa0f 99 } sd;
shintamainjp 0:521ba375aa0f 100 #if LWIP_IGMP
shintamainjp 0:521ba375aa0f 101 /** used for do_join_leave_group */
shintamainjp 0:521ba375aa0f 102 struct {
shintamainjp 0:521ba375aa0f 103 ip_addr_t *multiaddr;
shintamainjp 0:521ba375aa0f 104 ip_addr_t *netif_addr;
shintamainjp 0:521ba375aa0f 105 enum netconn_igmp join_or_leave;
shintamainjp 0:521ba375aa0f 106 } jl;
shintamainjp 0:521ba375aa0f 107 #endif /* LWIP_IGMP */
shintamainjp 0:521ba375aa0f 108 #if TCP_LISTEN_BACKLOG
shintamainjp 0:521ba375aa0f 109 struct {
shintamainjp 0:521ba375aa0f 110 u8_t backlog;
shintamainjp 0:521ba375aa0f 111 } lb;
shintamainjp 0:521ba375aa0f 112 #endif /* TCP_LISTEN_BACKLOG */
shintamainjp 0:521ba375aa0f 113 } msg;
shintamainjp 0:521ba375aa0f 114 };
shintamainjp 0:521ba375aa0f 115
shintamainjp 0:521ba375aa0f 116 /** This struct contains a function to execute in another thread context and
shintamainjp 0:521ba375aa0f 117 a struct api_msg_msg that serves as an argument for this function.
shintamainjp 0:521ba375aa0f 118 This is passed to tcpip_apimsg to execute functions in tcpip_thread context. */
shintamainjp 0:521ba375aa0f 119 struct api_msg {
shintamainjp 0:521ba375aa0f 120 /** function to execute in tcpip_thread context */
shintamainjp 0:521ba375aa0f 121 void (* function)(struct api_msg_msg *msg);
shintamainjp 0:521ba375aa0f 122 /** arguments for this function */
shintamainjp 0:521ba375aa0f 123 struct api_msg_msg msg;
shintamainjp 0:521ba375aa0f 124 };
shintamainjp 0:521ba375aa0f 125
shintamainjp 0:521ba375aa0f 126 #if LWIP_DNS
shintamainjp 0:521ba375aa0f 127 /** As do_gethostbyname requires more arguments but doesn't require a netconn,
shintamainjp 0:521ba375aa0f 128 it has its own struct (to avoid struct api_msg getting bigger than necessary).
shintamainjp 0:521ba375aa0f 129 do_gethostbyname must be called using tcpip_callback instead of tcpip_apimsg
shintamainjp 0:521ba375aa0f 130 (see netconn_gethostbyname). */
shintamainjp 0:521ba375aa0f 131 struct dns_api_msg {
shintamainjp 0:521ba375aa0f 132 /** Hostname to query or dotted IP address string */
shintamainjp 0:521ba375aa0f 133 const char *name;
shintamainjp 0:521ba375aa0f 134 /** Rhe resolved address is stored here */
shintamainjp 0:521ba375aa0f 135 ip_addr_t *addr;
shintamainjp 0:521ba375aa0f 136 /** This semaphore is posted when the name is resolved, the application thread
shintamainjp 0:521ba375aa0f 137 should wait on it. */
shintamainjp 0:521ba375aa0f 138 sys_sem_t *sem;
shintamainjp 0:521ba375aa0f 139 /** Errors are given back here */
shintamainjp 0:521ba375aa0f 140 err_t *err;
shintamainjp 0:521ba375aa0f 141 };
shintamainjp 0:521ba375aa0f 142 #endif /* LWIP_DNS */
shintamainjp 0:521ba375aa0f 143
shintamainjp 0:521ba375aa0f 144 void do_newconn ( struct api_msg_msg *msg);
shintamainjp 0:521ba375aa0f 145 void do_delconn ( struct api_msg_msg *msg);
shintamainjp 0:521ba375aa0f 146 void do_bind ( struct api_msg_msg *msg);
shintamainjp 0:521ba375aa0f 147 void do_connect ( struct api_msg_msg *msg);
shintamainjp 0:521ba375aa0f 148 void do_disconnect ( struct api_msg_msg *msg);
shintamainjp 0:521ba375aa0f 149 void do_listen ( struct api_msg_msg *msg);
shintamainjp 0:521ba375aa0f 150 void do_send ( struct api_msg_msg *msg);
shintamainjp 0:521ba375aa0f 151 void do_recv ( struct api_msg_msg *msg);
shintamainjp 0:521ba375aa0f 152 void do_write ( struct api_msg_msg *msg);
shintamainjp 0:521ba375aa0f 153 void do_getaddr ( struct api_msg_msg *msg);
shintamainjp 0:521ba375aa0f 154 void do_close ( struct api_msg_msg *msg);
shintamainjp 0:521ba375aa0f 155 void do_shutdown ( struct api_msg_msg *msg);
shintamainjp 0:521ba375aa0f 156 #if LWIP_IGMP
shintamainjp 0:521ba375aa0f 157 void do_join_leave_group( struct api_msg_msg *msg);
shintamainjp 0:521ba375aa0f 158 #endif /* LWIP_IGMP */
shintamainjp 0:521ba375aa0f 159
shintamainjp 0:521ba375aa0f 160 #if LWIP_DNS
shintamainjp 0:521ba375aa0f 161 void do_gethostbyname(void *arg);
shintamainjp 0:521ba375aa0f 162 #endif /* LWIP_DNS */
shintamainjp 0:521ba375aa0f 163
shintamainjp 0:521ba375aa0f 164 struct netconn* netconn_alloc(enum netconn_type t, netconn_callback callback);
shintamainjp 0:521ba375aa0f 165 void netconn_free(struct netconn *conn);
shintamainjp 0:521ba375aa0f 166
shintamainjp 0:521ba375aa0f 167 #ifdef __cplusplus
shintamainjp 0:521ba375aa0f 168 }
shintamainjp 0:521ba375aa0f 169 #endif
shintamainjp 0:521ba375aa0f 170
shintamainjp 0:521ba375aa0f 171 #endif /* LWIP_NETCONN */
shintamainjp 0:521ba375aa0f 172
shintamainjp 0:521ba375aa0f 173 #endif /* __LWIP_API_MSG_H__ */