xref: /aoo42x/main/sal/osl/w32/sockimpl.h (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _OSL_SOCKETIMPL_H_
29 #define _OSL_SOCKETIMPL_H_
30 
31 #include <osl/socket.h>
32 #include <osl/interlck.h>
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 /*****************************************************************************/
39 /* oslSocketImpl */
40 /*****************************************************************************/
41 #define OSL_SOCKET_FLAGS_NONBLOCKING	0x0001
42 
43 typedef void* (SAL_CALL * oslCloseCallback) (void*);
44 
45 struct oslSocketImpl {
46 	oslInterlockedCount m_nRefCount;
47 	SOCKET				m_Socket;
48 	int					m_Flags;
49 	oslCloseCallback	m_CloseCallback;
50 	void*				m_CallbackArg;
51 };
52 
53 struct oslSocketAddrImpl
54 {
55 	struct sockaddr m_sockaddr;
56 	oslInterlockedCount m_nRefCount;
57 };
58 
59 oslSocket __osl_createSocketImpl(SOCKET Socket);
60 void __osl_destroySocketImpl(oslSocket pImpl);
61 
62 /*****************************************************************************/
63 /* oslSocketDialupImpl */
64 /*****************************************************************************/
65 #define INTERNET_MODULE_NAME "wininet.dll"
66 
67 #define INTERNET_CONNECTION_MODEM  0x00000001L
68 #define INTERNET_CONNECTION_LAN    0x00000002L
69 #define INTERNET_CONNECTION_HANGUP 0x80000000L
70 
71 typedef DWORD (WINAPI *INTERNETATTEMPTCONNECT) (
72 	DWORD dwReserved);
73 typedef BOOL (WINAPI *INTERNETAUTODIAL) (
74 	DWORD dwFlags, DWORD dwReserved);
75 typedef BOOL (WINAPI *INTERNETAUTODIALHANGUP) (
76 	DWORD dwReserved);
77 typedef BOOL (WINAPI *INTERNETGETCONNECTEDSTATE) (
78 	LPDWORD lpdwFlags, DWORD dwReserved);
79 
80 typedef struct osl_socket_dialup_impl_st
81 {
82 	CRITICAL_SECTION          m_hMutex;
83 	HINSTANCE                 m_hModule;
84 	INTERNETATTEMPTCONNECT    m_pfnAttemptConnect;
85 	INTERNETAUTODIAL          m_pfnAutodial;
86 	INTERNETAUTODIALHANGUP    m_pfnAutodialHangup;
87 	INTERNETGETCONNECTEDSTATE m_pfnGetConnectedState;
88 	DWORD                     m_dwFlags;
89 } oslSocketDialupImpl;
90 
91 static oslSocketDialupImpl* __osl_createSocketDialupImpl (void);
92 static void __osl_initSocketDialupImpl (oslSocketDialupImpl *pImpl);
93 static void __osl_destroySocketDialupImpl (oslSocketDialupImpl *pImpl);
94 
95 static sal_Bool __osl_querySocketDialupImpl (void);
96 static sal_Bool __osl_attemptSocketDialupImpl (void);
97 
98 /*****************************************************************************/
99 /* The End */
100 /*****************************************************************************/
101 
102 #ifdef __cplusplus
103 }
104 #endif
105 
106 #endif
107 
108 
109