hello-world.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /**
  2. * \addtogroup apps
  3. * @{
  4. */
  5. /**
  6. * \defgroup helloworld Hello, world
  7. * @{
  8. *
  9. * A small example showing how to write applications with
  10. * \ref psock "protosockets".
  11. */
  12. /**
  13. * \file
  14. * Header file for an example of how to write uIP applications
  15. * with protosockets.
  16. * \author
  17. * Adam Dunkels <adam@sics.se>
  18. */
  19. #ifndef __HELLO_WORLD_H__
  20. #define __HELLO_WORLD_H__
  21. /* Since this file will be included by uip.h, we cannot include uip.h
  22. here. But we might need to include uipopt.h if we need the u8_t and
  23. u16_t datatypes. */
  24. #include "uipopt.h"
  25. #include "psock.h"
  26. /* Next, we define the uip_tcp_appstate_t datatype. This is the state
  27. of our application, and the memory required for this state is
  28. allocated together with each TCP connection. One application state
  29. for each TCP connection. */
  30. #define BUF_SIZE 200
  31. typedef struct hello_world_state {
  32. struct psock p;
  33. char inputbuffer[BUF_SIZE];
  34. char name[BUF_SIZE];
  35. } uip_tcp_appstate_t;
  36. /* Finally we define the application function to be called by uIP. */
  37. void hello_world_appcall(void);
  38. #ifndef UIP_APPCALL
  39. #define UIP_APPCALL hello_world_appcall
  40. #endif /* UIP_APPCALL */
  41. void hello_world_init(void);
  42. #endif /* __HELLO_WORLD_H__ */
  43. /** @} */
  44. /** @} */