libUPnP
1.6.17
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
upnp
src
inc
sock.h
Go to the documentation of this file.
1
#ifndef GENLIB_NET_SOCK_H
2
#define GENLIB_NET_SOCK_H
3
4
/**************************************************************************
5
*
6
* Copyright (c) 2000-2003 Intel Corporation
7
* All rights reserved.
8
* Copyright (c) 2012 France Telecom All rights reserved.
9
*
10
* Redistribution and use in source and binary forms, with or without
11
* modification, are permitted provided that the following conditions are met:
12
*
13
* - Redistributions of source code must retain the above copyright notice,
14
* this list of conditions and the following disclaimer.
15
* - Redistributions in binary form must reproduce the above copyright notice,
16
* this list of conditions and the following disclaimer in the documentation
17
* and/or other materials provided with the distribution.
18
* - Neither name of Intel Corporation nor the names of its contributors
19
* may be used to endorse or promote products derived from this software
20
* without specific prior written permission.
21
*
22
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
26
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
27
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
28
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
29
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
30
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
*
34
**************************************************************************/
35
44
#include "
UpnpInet.h
"
/* for SOCKET, netinet/in */
45
#include "
UpnpGlobal.h
"
/* for UPNP_INLINE */
46
47
/* The following are not defined under winsock.h */
48
#ifndef SD_RECEIVE
49
#define SD_RECEIVE 0x00
50
#define SD_SEND 0x01
51
#define SD_BOTH 0x02
52
#endif
53
55
typedef
struct
56
{
58
SOCKET
socket
;
60
struct
sockaddr_storage foreign_sockaddr;
61
}
SOCKINFO
;
62
63
#ifdef __cplusplus
64
extern
"C"
{
65
#endif
66
72
static
UPNP_INLINE
int
sock_close
(
74
SOCKET
sock)
75
{
76
int
ret = -1;
77
78
if
(sock !=
INVALID_SOCKET
)
79
ret =
UpnpCloseSocket
(sock);
80
81
return
ret;
82
}
83
93
int
sock_init
(
95
SOCKINFO
*info,
97
SOCKET
sockfd);
98
108
int
sock_init_with_ip
(
110
SOCKINFO
* info,
112
SOCKET
sockfd,
114
struct
sockaddr *foreign_sockaddr);
115
127
int
sock_destroy
(
129
SOCKINFO
* info,
131
int
ShutdownMethod);
132
141
int
sock_read
(
143
SOCKINFO
*info,
145
char
* buffer,
147
size_t
bufsize,
149
int
*timeoutSecs);
150
159
int
sock_write
(
161
SOCKINFO
*info,
163
const
char
*buffer,
165
size_t
bufsize,
167
int
*timeoutSecs);
168
174
int
sock_make_blocking
(
175
/* [in] socket. */
176
SOCKET
sock);
177
183
int
sock_make_no_blocking
(
184
/* [in] socket. */
185
SOCKET
sock);
186
187
#ifdef __cplusplus
188
}
/* #extern "C" */
189
#endif
190
191
/* @} Sock Network Socket Library */
192
193
#endif
/* GENLIB_NET_SOCK_H */
Generated on Mon Dec 19 2016 17:09:02 for libUPnP by
1.8.1.2