/**
 * A small example showing how to write applications with
 * \ref psock "protosockets".
 */

#ifndef __SOCKET_APP_H__
#define __SOCKET_APP_H__

/* Since this file will be included by uip.h, we cannot include uip.h
   here. But we might need to include uipopt.h if we need the u8_t and
   u16_t datatypes. */
#include "uipopt.h"

#include "psock.h"

/* Next, we define the uip_tcp_appstate_t datatype. This is the state
   of our application, and the memory required for this state is
   allocated together with each TCP connection. One application state
   for each TCP connection. */
typedef struct socket_app_state {
  struct psock p;
  unsigned char outputbuffer[100];
  unsigned char inputbuffer[8*1024];
  char name[40];
} uip_tcp_appstate_t;

/* Finally we define the application function to be called by uIP. */
void socket_app_appcall(void);
#ifndef UIP_APPCALL
#define UIP_APPCALL socket_app_appcall
#endif /* UIP_APPCALL */

void socket_app_init(void);

#endif /* __SOCKET_APP_H__ */
/** @} */
/** @} */
