1999-09-07 11:20:51 -04:00
|
|
|
/* -------------------------------------------------------------------------
|
|
|
|
* Project: GSocket (Generic Socket) for WX
|
|
|
|
* Name: gsockmsw.h
|
|
|
|
* Purpose: GSocket MSW header
|
|
|
|
* CVSID: $Id$
|
|
|
|
* -------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __GSOCK_MSW_H
|
|
|
|
#define __GSOCK_MSW_H
|
|
|
|
|
1999-09-14 22:21:15 -04:00
|
|
|
#ifndef __GSOCKET_STANDALONE__
|
|
|
|
#include "wx/setup.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__)
|
|
|
|
|
1999-09-14 20:02:49 -04:00
|
|
|
#ifndef __GSOCKET_STANDALONE__
|
1999-09-07 11:20:51 -04:00
|
|
|
#include "wx/gsocket.h"
|
|
|
|
#else
|
|
|
|
#include "gsocket.h"
|
|
|
|
#endif
|
|
|
|
|
1999-11-15 08:57:22 -05:00
|
|
|
#include <windows.h>
|
1999-09-07 11:20:51 -04:00
|
|
|
#include <winsock.h>
|
|
|
|
|
1999-09-14 20:02:49 -04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2000-03-16 16:57:20 -05:00
|
|
|
#ifndef TRUE
|
|
|
|
#define TRUE 1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef FALSE
|
|
|
|
#define FALSE 0
|
|
|
|
#endif
|
|
|
|
|
1999-09-07 11:20:51 -04:00
|
|
|
/* Definition of GSocket */
|
|
|
|
struct _GSocket
|
|
|
|
{
|
|
|
|
SOCKET m_fd;
|
|
|
|
GAddress *m_local;
|
|
|
|
GAddress *m_peer;
|
|
|
|
GSocketError m_error;
|
|
|
|
|
1999-09-30 19:53:10 -04:00
|
|
|
/* Attributes */
|
2001-05-10 02:31:39 -04:00
|
|
|
int m_non_blocking;
|
|
|
|
int m_server;
|
|
|
|
int m_stream;
|
|
|
|
int m_oriented;
|
|
|
|
int m_establishing;
|
1999-09-07 11:20:51 -04:00
|
|
|
struct timeval m_timeout;
|
|
|
|
|
|
|
|
/* Callbacks */
|
1999-09-30 19:53:10 -04:00
|
|
|
GSocketEventFlags m_detected;
|
1999-09-07 11:20:51 -04:00
|
|
|
GSocketCallback m_cbacks[GSOCK_MAX_EVENT];
|
|
|
|
char *m_data[GSOCK_MAX_EVENT];
|
|
|
|
int m_msgnumber;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Definition of GAddress */
|
|
|
|
struct _GAddress
|
|
|
|
{
|
|
|
|
struct sockaddr *m_addr;
|
|
|
|
size_t m_len;
|
|
|
|
|
|
|
|
GAddressType m_family;
|
|
|
|
int m_realfamily;
|
|
|
|
|
|
|
|
GSocketError m_error;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Input / output */
|
|
|
|
|
|
|
|
GSocketError _GSocket_Input_Timeout(GSocket *socket);
|
|
|
|
GSocketError _GSocket_Output_Timeout(GSocket *socket);
|
2000-01-20 22:12:01 -05:00
|
|
|
GSocketError _GSocket_Connect_Timeout(GSocket *socket);
|
1999-09-07 11:20:51 -04:00
|
|
|
int _GSocket_Recv_Stream(GSocket *socket, char *buffer, int size);
|
|
|
|
int _GSocket_Recv_Dgram(GSocket *socket, char *buffer, int size);
|
|
|
|
int _GSocket_Send_Stream(GSocket *socket, const char *buffer, int size);
|
|
|
|
int _GSocket_Send_Dgram(GSocket *socket, const char *buffer, int size);
|
|
|
|
|
|
|
|
/* Callbacks */
|
|
|
|
|
2003-08-07 08:26:17 -04:00
|
|
|
int _GSocket_GUI_Init(void);
|
|
|
|
void _GSocket_GUI_Cleanup(void);
|
|
|
|
int _GSocket_GUI_Init_Socket(GSocket *socket);
|
|
|
|
void _GSocket_GUI_Destroy_Socket(GSocket *socket);
|
2000-03-13 23:43:58 -05:00
|
|
|
|
|
|
|
LRESULT CALLBACK _GSocket_Internal_WinProc(HWND, UINT, WPARAM, LPARAM);
|
|
|
|
|
1999-09-30 19:53:10 -04:00
|
|
|
void _GSocket_Enable_Events(GSocket *socket);
|
|
|
|
void _GSocket_Disable_Events(GSocket *socket);
|
1999-09-07 11:20:51 -04:00
|
|
|
|
|
|
|
/* GAddress */
|
|
|
|
|
|
|
|
GSocketError _GAddress_translate_from(GAddress *address,
|
|
|
|
struct sockaddr *addr, int len);
|
2000-01-20 22:12:01 -05:00
|
|
|
GSocketError _GAddress_translate_to (GAddress *address,
|
|
|
|
struct sockaddr **addr, int *len);
|
1999-09-07 11:20:51 -04:00
|
|
|
GSocketError _GAddress_Init_INET(GAddress *address);
|
|
|
|
GSocketError _GAddress_Init_UNIX(GAddress *address);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
1999-09-14 22:21:15 -04:00
|
|
|
#endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */
|
|
|
|
|
1999-09-07 11:20:51 -04:00
|
|
|
#endif /* __GSOCK_MSW_H */
|