Subversion Repositories HomeAutomation

Rev

Rev 213 | Blame | Compare with Previous | Last modification | View Log | SVN | RSS feed

  1. /*********************************************
  2.  * vim:sw=8:ts=8:si:et
  3.  * To use the above modeline in vim you must have "set modeline" in your .vimrc
  4.  * Author: Guido Socher
  5.  * Copyright: GPL V2
  6.  *
  7.  * IP/ARP/UDP/TCP functions
  8.  *
  9.  * Chip type           : ATMEGA88 with ENC28J60
  10.  *********************************************/
  11. //@{
  12. #ifndef IP_ARP_UDP_TCP_H
  13. #define IP_ARP_UDP_TCP_H
  14. #include <avr/pgmspace.h>
  15.  
  16. #define useUDP
  17. //#define useTCP
  18.  
  19. // you must call this function once before you use any of the other functions:
  20. extern void init_ip_arp_udp_tcp(uint8_t *mymac,uint8_t *myip,uint8_t wwwp);
  21. //
  22. extern uint8_t eth_type_is_arp_and_my_ip(uint8_t *buf,uint16_t len);
  23. extern uint8_t eth_type_is_ip_and_my_ip(uint8_t *buf,uint16_t len);
  24. extern void make_arp_answer_from_request(uint8_t *buf);
  25. extern void make_echo_reply_from_request(uint8_t *buf,uint16_t len);
  26.  
  27. #ifdef useUDP
  28. extern void make_udp_reply_from_request(uint8_t *buf,char *data,uint8_t datalen,uint16_t port);
  29. extern void send_udp(uint8_t *buf,char *data,uint8_t datalen,uint16_t port, uint8_t *remotemac, uint8_t *remoteip);
  30. #endif //useUDP
  31.  
  32. #ifdef useTCP
  33. extern void make_tcp_synack_from_syn(uint8_t *buf);
  34. extern void init_len_info(uint8_t *buf);
  35. extern uint16_t get_tcp_data_pointer(void);
  36. extern uint16_t fill_tcp_data_p(uint8_t *buf,uint16_t pos, const prog_char *progmem_s);
  37. extern uint16_t fill_tcp_data(uint8_t *buf,uint16_t pos, const char *s);
  38. extern void make_tcp_ack_from_any(uint8_t *buf);
  39. extern void make_tcp_ack_with_data(uint8_t *buf,uint16_t dlen);
  40. #endif //useTCP
  41.  
  42. #endif /* IP_ARP_UDP_TCP_H */
  43. //@}
  44.