/*

  sakuralib.h
  Copyright(C) 2002-2008 INASOFT 矢吹拓也/Ayacy

  sakuralib.libを利用するためのヘッダファイル
  (Web通信用モジュール)

*/

#ifndef MYLIB__ISSAKURALIB__
#define MYLIB__ISSAKURALIB__

#ifndef OWN__SAKURALIB__
#pragma comment(lib, "sakuralib.lib")
#endif /* OWN__SAKURALIB__ */

#ifdef __cplusplus

#ifndef LibExport
#define LibExport extern "C"
#endif  /* LibExport */

#else /* __cplusplus */

#ifndef LibExport
#define LibExport extern
#endif  /* LibExport */

#endif /* __cplusplus */

LibExport void CloseSocket(SOCKET *p);
LibExport int  OpenSocketA(const char *address, const char *port, SOCKET *p);
LibExport int  OpenSocketW(const wchar_t *address, const wchar_t *port, SOCKET *p);

#ifdef _UNICODE
#define OpenSocket OpenSocketW
#else  /* _UNICODE */
#define OpenSocket OpenSocketA
#endif /* _UNICODE */

LibExport void Sends(const SOCKET *s, const char *p);
LibExport void Receives(const SOCKET *s, char *buf, UINT bufsize, UINT timeout);
LibExport int ReceiveSocket(const SOCKET *psocket, char *buf, int bufsize);
LibExport int SendSocket(const SOCKET *psocket, const char *buf, int bufsize);

#endif /* MYLIB__ISSAKURALIB__ */
