xref: /trunk/main/sal/osl/w32/sockimpl.h (revision 9eab2a37)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _OSL_SOCKETIMPL_H_
25 #define _OSL_SOCKETIMPL_H_
26 
27 #include <osl/socket.h>
28 #include <osl/interlck.h>
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 /*****************************************************************************/
35 /* oslSocketImpl */
36 /*****************************************************************************/
37 #define OSL_SOCKET_FLAGS_NONBLOCKING	0x0001
38 
39 typedef void* (SAL_CALL * oslCloseCallback) (void*);
40 
41 struct oslSocketImpl {
42 	oslInterlockedCount m_nRefCount;
43 	SOCKET				m_Socket;
44 	int					m_Flags;
45 	oslCloseCallback	m_CloseCallback;
46 	void*				m_CallbackArg;
47 };
48 
49 struct oslSocketAddrImpl
50 {
51 	struct sockaddr m_sockaddr;
52 	oslInterlockedCount m_nRefCount;
53 };
54 
55 oslSocket __osl_createSocketImpl(SOCKET Socket);
56 void __osl_destroySocketImpl(oslSocket pImpl);
57 
58 /*****************************************************************************/
59 /* oslSocketDialupImpl */
60 /*****************************************************************************/
61 #define INTERNET_MODULE_NAME "wininet.dll"
62 
63 #define INTERNET_CONNECTION_MODEM  0x00000001L
64 #define INTERNET_CONNECTION_LAN    0x00000002L
65 #define INTERNET_CONNECTION_HANGUP 0x80000000L
66 
67 typedef DWORD (WINAPI *INTERNETATTEMPTCONNECT) (
68 	DWORD dwReserved);
69 typedef BOOL (WINAPI *INTERNETAUTODIAL) (
70 	DWORD dwFlags, DWORD dwReserved);
71 typedef BOOL (WINAPI *INTERNETAUTODIALHANGUP) (
72 	DWORD dwReserved);
73 typedef BOOL (WINAPI *INTERNETGETCONNECTEDSTATE) (
74 	LPDWORD lpdwFlags, DWORD dwReserved);
75 
76 typedef struct osl_socket_dialup_impl_st
77 {
78 	CRITICAL_SECTION          m_hMutex;
79 	HINSTANCE                 m_hModule;
80 	INTERNETATTEMPTCONNECT    m_pfnAttemptConnect;
81 	INTERNETAUTODIAL          m_pfnAutodial;
82 	INTERNETAUTODIALHANGUP    m_pfnAutodialHangup;
83 	INTERNETGETCONNECTEDSTATE m_pfnGetConnectedState;
84 	DWORD                     m_dwFlags;
85 } oslSocketDialupImpl;
86 
87 static oslSocketDialupImpl* __osl_createSocketDialupImpl (void);
88 static void __osl_initSocketDialupImpl (oslSocketDialupImpl *pImpl);
89 static void __osl_destroySocketDialupImpl (oslSocketDialupImpl *pImpl);
90 
91 static sal_Bool __osl_querySocketDialupImpl (void);
92 static sal_Bool __osl_attemptSocketDialupImpl (void);
93 
94 /*****************************************************************************/
95 /* The End */
96 /*****************************************************************************/
97 
98 #ifdef __cplusplus
99 }
100 #endif
101 
102 #endif
103 
104 
105