xref: /aoo41x/main/sal/osl/unx/sockimpl.h (revision ebd402a9)
19eab2a37SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
39eab2a37SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
49eab2a37SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
59eab2a37SAndrew Rist  * distributed with this work for additional information
69eab2a37SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
79eab2a37SAndrew Rist  * to you under the Apache License, Version 2.0 (the
89eab2a37SAndrew Rist  * "License"); you may not use this file except in compliance
99eab2a37SAndrew Rist  * with the License.  You may obtain a copy of the License at
109eab2a37SAndrew Rist  *
119eab2a37SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
129eab2a37SAndrew Rist  *
139eab2a37SAndrew Rist  * Unless required by applicable law or agreed to in writing,
149eab2a37SAndrew Rist  * software distributed under the License is distributed on an
159eab2a37SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
169eab2a37SAndrew Rist  * KIND, either express or implied.  See the License for the
179eab2a37SAndrew Rist  * specific language governing permissions and limitations
189eab2a37SAndrew Rist  * under the License.
199eab2a37SAndrew Rist  *
209eab2a37SAndrew Rist  *************************************************************/
219eab2a37SAndrew Rist 
229eab2a37SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _OSL_SOCKETIMPL_H_
25cdf0e10cSrcweir #define _OSL_SOCKETIMPL_H_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <osl/pipe.h>
28cdf0e10cSrcweir #include <osl/socket.h>
29cdf0e10cSrcweir #include <osl/interlck.h>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #ifdef __cplusplus
32cdf0e10cSrcweir extern "C" {
33cdf0e10cSrcweir #endif
34cdf0e10cSrcweir 
35cdf0e10cSrcweir typedef void* (*oslCloseCallback) (void*);
360d76dfe8SAndrea Pescetti 
370d76dfe8SAndrea Pescetti #if defined(LINUX) || defined(FREEBSD) || defined(NETBSD)
380d76dfe8SAndrea Pescetti #define CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT 1
390d76dfe8SAndrea Pescetti #else
400d76dfe8SAndrea Pescetti #define CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT 0
410d76dfe8SAndrea Pescetti #endif
42cdf0e10cSrcweir 
43cdf0e10cSrcweir struct oslSocketImpl {
44cdf0e10cSrcweir     int					m_Socket;
45cdf0e10cSrcweir     int                 m_nLastError;
46cdf0e10cSrcweir 	oslCloseCallback	m_CloseCallback;
47cdf0e10cSrcweir 	void*				m_CallbackArg;
48cdf0e10cSrcweir 	oslInterlockedCount m_nRefCount;
490d76dfe8SAndrea Pescetti #if CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT
50cdf0e10cSrcweir     sal_Bool            m_bIsAccepting;
51cdf0e10cSrcweir     sal_Bool            m_bIsInShutdown;
52cdf0e10cSrcweir #endif
53cdf0e10cSrcweir };
54cdf0e10cSrcweir 
55cdf0e10cSrcweir struct oslSocketAddrImpl
56cdf0e10cSrcweir {
57cdf0e10cSrcweir 	sal_Int32 m_nRefCount;
58cdf0e10cSrcweir 	struct sockaddr m_sockaddr;
59cdf0e10cSrcweir };
60cdf0e10cSrcweir 
61cdf0e10cSrcweir struct oslPipeImpl {
62cdf0e10cSrcweir 	int	 m_Socket;
63cdf0e10cSrcweir 	sal_Char m_Name[PATH_MAX + 1];
64cdf0e10cSrcweir 	oslInterlockedCount m_nRefCount;
65cdf0e10cSrcweir 	sal_Bool m_bClosed;
66*ebd402a9SDamjan Jovanovic #if CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT
67cdf0e10cSrcweir     sal_Bool m_bIsAccepting;
68cdf0e10cSrcweir     sal_Bool m_bIsInShutdown;
69cdf0e10cSrcweir #endif
70cdf0e10cSrcweir };
71cdf0e10cSrcweir 
72cdf0e10cSrcweir oslSocket __osl_createSocketImpl(int Socket);
73cdf0e10cSrcweir void __osl_destroySocketImpl(oslSocket pImpl);
74cdf0e10cSrcweir 
75cdf0e10cSrcweir #ifdef __cplusplus
76cdf0e10cSrcweir }
77cdf0e10cSrcweir #endif
78cdf0e10cSrcweir 
79cdf0e10cSrcweir #endif
80cdf0e10cSrcweir 
81