Subversion Repositories zxusbnet

Rev

Rev 47 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed | ?url?

  1. #ifndef _SOCKET_H_
  2. #define _SOCKET_H_
  3.  
  4. /**
  5.  * \file    socket.h
  6.  * WIZnet SOCKET API function definition
  7.  *
  8.  * For user application, WIZnet provides SOCKET API functions
  9.  * which are similar to Berkeley SOCKET API.\n
  10.  *
  11.  * \author MidnightCow
  12.  * \date 04/07/2008
  13.  * \version 1.1.1
  14.  *
  15.  * Modify the warning-block code in recv(). Refer to M_15052008.
  16.  * ----------  -------  -----------  ----------------------------
  17.  * Date        Version  Author       Description
  18.  * ----------  -------  -----------  ----------------------------
  19.  * 24/03/2008  1.0.0    MidnightCow  Release with W5300 launching
  20.  * ----------  -------  -----------  ----------------------------
  21.  * 15/05/2008  1.1.0    MidnightCow  Refer to M_15052008.
  22.  *                                   Modify the warning code block in recv().
  23.  * ----------  -------  -----------  ----------------------------  
  24.  * 04/07/2008  1.1.1    MidnightCow  Refer to M_04072008.
  25.  *                                   Modify the warning code block in recv().
  26.  * ----------  -------  -----------  ----------------------------  
  27.  * 08/08/2008  1.2.0    MidnightCow  Refer to M_08082008.
  28.  *                                   Modify close().
  29.  * ----------  -------  -----------  ----------------------------  
  30.  * 15/03/2012  1.2.1    Dongeun      Solution of ARP problem
  31.  *                                   Modify connect() & sendto()
  32.  * ----------  -------  -----------  ----------------------------  
  33.  * 12/07/2012  1.2.2    Dongeun      Solution of ARP problem
  34.  *                                   Modify connect() & sendto()
  35.  * ----------  -------  -----------  ----------------------------  
  36.  */
  37. #include "types.h"
  38. #include "w5300.h"
  39.  
  40. /**********************************
  41.  * define function of SOCKET APIs *
  42.  **********************************/
  43.  
  44. /**
  45.  * Open a SOCKET.
  46.  */
  47. uint8    socket(SOCKET s, uint8 protocol, uint16 port, uint16 flag);
  48.  
  49. /**
  50.  * Close a SOCKET.
  51.  */
  52. void     close(SOCKET s);                                                           // Close socket
  53.  
  54. /**
  55.  * It tries to connect a client.
  56.  */
  57. uint8    connect(SOCKET s, uint8 * addr, uint16 port);
  58.  
  59. /**
  60.  * It tries to disconnect a connection SOCKET with a peer.
  61.  */
  62. void     disconnect(SOCKET s);
  63.  
  64. /**
  65.  * It is listening to a connect-request from a client.
  66.  */
  67. uint8    listen(SOCKET s);         
  68.  
  69. /**
  70.  * It sends TCP data on a connection SOCKET
  71.  */
  72. uint32   send(SOCKET s, uint8 * buf, uint32 len);
  73.  
  74.  
  75. /**
  76.  * It receives TCP data on a connection SOCKET
  77.  */
  78. uint32   recv(SOCKET s, uint8 * buf, uint32 len);
  79.  
  80. /**
  81.  * It sends UDP, IPRAW, or MACRAW data
  82.  */
  83. uint32   sendto(SOCKET s, uint8 * buf, uint32 len, uint8 * addr, uint16 port);
  84.  
  85. /**
  86.  * It receives UDP, IPRAW, or MACRAW data
  87.  */
  88. uint32   recvfrom(SOCKET s, uint8 * buf, uint32 len, uint8 * addr, uint16  *port);
  89.  
  90.  
  91. #endif
  92. /* _SOCKET_H_ */
  93.  
  94.  
  95.