1999-09-07 15:20:51 +00: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-15 02:21:15 +00:00
|
|
|
#ifndef __GSOCKET_STANDALONE__
|
|
|
|
#include "wx/setup.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__)
|
|
|
|
|
1999-09-15 00:02:49 +00:00
|
|
|
#ifndef __GSOCKET_STANDALONE__
|
1999-09-07 15:20:51 +00:00
|
|
|
#include "wx/gsocket.h"
|
|
|
|
#else
|
|
|
|
#include "gsocket.h"
|
|
|
|
#endif
|
|
|
|
|
1999-11-15 13:57:22 +00:00
|
|
|
#include <windows.h>
|
1999-09-07 15:20:51 +00:00
|
|
|
#include <winsock.h>
|
|
|
|
|
1999-09-15 00:02:49 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2000-03-16 21:57:20 +00:00
|
|
|
#if !defined(__cplusplus)
|
|
|
|
typedef int bool;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef TRUE
|
|
|
|
#define TRUE 1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef FALSE
|
|
|
|
#define FALSE 0
|
|
|
|
#endif
|
|
|
|
|
1999-09-07 15:20:51 +00:00
|
|
|
/* Definition of GSocket */
|
|
|
|
struct _GSocket
|
|
|
|
{
|
|
|
|
SOCKET m_fd;
|
|
|
|
GAddress *m_local;
|
|
|
|
GAddress *m_peer;
|
|
|
|
GSocketError m_error;
|
|
|
|
|
1999-09-30 23:53:10 +00:00
|
|
|
/* Attributes */
|
1999-09-07 15:20:51 +00:00
|
|
|
bool m_non_blocking;
|
|
|
|
bool m_server;
|
|
|
|
bool m_stream;
|
|
|
|
bool m_oriented;
|
2000-03-15 09:03:40 +00:00
|
|
|
bool m_establishing;
|
1999-09-07 15:20:51 +00:00
|
|
|
struct timeval m_timeout;
|
|
|
|
|
|
|
|
/* Callbacks */
|
1999-09-30 23:53:10 +00:00
|
|
|
GSocketEventFlags m_detected;
|
1999-09-07 15:20:51 +00: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-21 03:12:01 +00:00
|
|
|
GSocketError _GSocket_Connect_Timeout(GSocket *socket);
|
1999-09-07 15:20:51 +00: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 */
|
|
|
|
|
2000-03-14 04:43:58 +00:00
|
|
|
bool _GSocket_GUI_Init(GSocket *socket);
|
|
|
|
void _GSocket_GUI_Destroy(GSocket *socket);
|
|
|
|
|
|
|
|
LRESULT CALLBACK _GSocket_Internal_WinProc(HWND, UINT, WPARAM, LPARAM);
|
|
|
|
|
1999-09-30 23:53:10 +00:00
|
|
|
void _GSocket_Enable_Events(GSocket *socket);
|
|
|
|
void _GSocket_Disable_Events(GSocket *socket);
|
1999-09-07 15:20:51 +00:00
|
|
|
|
|
|
|
/* GAddress */
|
|
|
|
|
|
|
|
GSocketError _GAddress_translate_from(GAddress *address,
|
|
|
|
struct sockaddr *addr, int len);
|
2000-01-21 03:12:01 +00:00
|
|
|
GSocketError _GAddress_translate_to (GAddress *address,
|
|
|
|
struct sockaddr **addr, int *len);
|
1999-09-07 15:20:51 +00:00
|
|
|
GSocketError _GAddress_Init_INET(GAddress *address);
|
|
|
|
GSocketError _GAddress_Init_UNIX(GAddress *address);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
1999-09-15 02:21:15 +00:00
|
|
|
#endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */
|
|
|
|
|
1999-09-07 15:20:51 +00:00
|
|
|
#endif /* __GSOCK_MSW_H */
|