summaryrefslogtreecommitdiff
path: root/Libraries/WiShield/server.h
blob: 80ee3e9871a7eb8e55f4ab39cc95b0625823473e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/******************************************************************************

 Filename:		server.h
 Description:	Private header file for WiServer

 ******************************************************************************

 Copyright(c) 2009 Mark A. Patel  All rights reserved.

 This program is free software; you can redistribute it and/or modify it
 under the terms of version 2 of the GNU General Public License as
 published by the Free Software Foundation.

 This program is distributed in the hope that it will be useful, but WITHOUT
 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 more details.

 You should have received a copy of the GNU General Public License along with
 this program; if not, write to the Free Software Foundation, Inc., 59
 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

 Contact Information:

 Author               Date        Comment
 ---------------------------------------------------------------
 Mark A. Patel		06/10/2009	Initial version

 *****************************************************************************/

#ifndef __SERVER_H__
#define __SERVER_H__

#include <avr/pgmspace.h>
#include <uip-conf.h>

#ifdef APP_WISERVER

// Enables client mode (i.e. for sending Tweets and HTTP POST or GET requests)
// Comment out this #define if client mode isn't required
// (it'll save a bunch of code size and a bit of RAM too!)
#define ENABLE_CLIENT_MODE

// If DEBUG is defined, the Serial class is used to output lots of diagnostic data
// (verbose mode is also enabled automatically)
// Warning: this increases RAM usage and code size and will slow execution speed
//#define DEBUG


// Declare the server's uip callback function
void server_app_task();

#define UIP_APPCALL server_app_task

/*
 * Stores the state for a single connection
 */
struct conn_state {
	int ackedCount; // Number of bytes sent and acked
	int sentCount; // Number of bytes awaiting an ack
	char* cursor; // Virtual cursor for write operations
	void* request; // Points to a char* URL (server mode) or a request object (client mode)
};

typedef struct conn_state uip_tcp_appstate_t;

#endif	/* APP_WISERVER */

#endif //__SERVER_H__