/*Copyright (c) 2012, Sierra Wireless, Inc
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
•Redistributions of source code must retain the above copyright notice, this
 list of conditions and the following disclaimer.
•Redistributions in binary form must reproduce the above copyright notice, this
 list of conditions and the following disclaimer in the documentation and/or
 other materials provided with the distribution.
•Neither the name of Sierra Wireless Inc, Richmond, Canada nor the names of its
 contributors may be used to endorse or promote products derived from this
 software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABIL ITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

/* ************************************************************************* */
/*
   File:		wireless_internet_gateway.h
   Version:		v1.0 (20091211)
   Author:		SPT
*/
/* ************************************************************************* */
#ifndef _WIRELESS_INTERNET_GATEWAY_H_
#define _WIRELESS_INTERNET_GATEWAY_H_
/* ************************************************************************* */
#include "adl_global.h"
#include "wip.h"

//#include "c:\workspace\ethernet_driver\itf\wip_drv_dm9000.h"
//#include "c:\workspace\ethernet_driver\itf\wip_drv_eth.h"
//#include "c:\workspace\ethernet_driver\inc\drv_m24cxx.h"

#include "wip_drv_dm9000.h"
#include "wip_drv_eth.h"
#include "drv_m24cxx.h"
/* ************************************************************************* */
#define WIP_BEV_CLOSED                                0
#define GPRS_ERROR                                    255

#define HTTP_REQ_INCOMPLETE                           0
#define HTTP_REQ_COMPLETE                             1

#define HTTP_GET                           0
#define HTTP_POST                          1


#define DHCP_SERVER_IP      "192.168.1.1"
#define DHCP_FIRST_IP       "192.168.1.2"
#define DHCP_SUBNET_IP      "255.255.255.0"

#define NB_OF_WEB_PAGES     8

#define APN                 0
#define UNAME               1
#define PWD                 2

#define RD_BUF_SIZE         4096
#define WR_BUF_SIZE         16384

#define NW_CAP_UNKNOWN      0
#define NW_CAP_GSM          1
#define NW_CAP_GPRS         2
#define NW_CAP_EDGE         3

#define GOOGLE_PUBLIC_DNS1 "8.8.8.8"
#define GOOGLE_PUBLIC_DNS2 "8.8.4.4"
/* ************************************************************************* */
extern s32 wip_drvSubscribe_FASTRACK( const ascii *name );
/* ************************************************************************* */
#define wip_eth_addr_t                           wip_ethAddr_t_7BYTE
#define fn_eth_drv_subscribe					 wip_drvSubscribe_FASTRACK
/* ************************************************************************* */
typedef struct
{
	wip_channel_t* channel;
	u32 bytes_read;
	u32 nb_wr_events;
	u32 bytes_written;
	u32 wr_buf_size;	
} web_client_ctx_st;

typedef void (*web_page_cb)( web_client_ctx_st* lo_web_client_ctx, u8 lo_http_method );

typedef struct
{
	char* page;
	web_page_cb page_cb;	
} web_pages_st;
/* ************************************************************************* */
#endif // _WIRELESS_INTERNET_GATEWAY_H_
