}
val = 1;
- setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val));
+ setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, CUPS_SOCAST &val, sizeof(val));
#ifdef IPV6_V6ONLY
if (addr->addr.sa_family == AF_INET6)
- setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &val, sizeof(val));
+ setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, CUPS_SOCAST &val, sizeof(val));
#endif /* IPV6_V6ONLY */
_httpAddrSetPort(addr, port);
*/
val = 1;
- setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, &val, sizeof(val));
+ setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, CUPS_SOCAST &val, sizeof(val));
#endif /* SO_NOSIGPIPE */
return (fd);
*/
val = 1;
-#ifdef WIN32
- setsockopt(*sock, SOL_SOCKET, SO_REUSEADDR, (const char *)&val,
- sizeof(val));
-#else
- setsockopt(*sock, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val));
-#endif /* WIN32 */
+ setsockopt(*sock, SOL_SOCKET, SO_REUSEADDR, CUPS_SOCAST &val, sizeof(val));
#ifdef SO_REUSEPORT
val = 1;
- setsockopt(*sock, SOL_SOCKET, SO_REUSEPORT, &val, sizeof(val));
+ setsockopt(*sock, SOL_SOCKET, SO_REUSEPORT, CUPS_SOCAST &val, sizeof(val));
#endif /* SO_REUSEPORT */
#ifdef SO_NOSIGPIPE
val = 1;
- setsockopt(*sock, SOL_SOCKET, SO_NOSIGPIPE, &val, sizeof(val));
+ setsockopt(*sock, SOL_SOCKET, SO_NOSIGPIPE, CUPS_SOCAST &val, sizeof(val));
#endif /* SO_NOSIGPIPE */
/*
*/
val = 1;
-#ifdef WIN32
- setsockopt(*sock, IPPROTO_TCP, TCP_NODELAY, (const char *)&val,
- sizeof(val));
-#else
- setsockopt(*sock, IPPROTO_TCP, TCP_NODELAY, &val, sizeof(val));
-#endif /* WIN32 */
+ setsockopt(*sock, IPPROTO_TCP, TCP_NODELAY, CUPS_SOCAST &val, sizeof(val));
#ifdef FD_CLOEXEC
/*
# ifdef WIN32
# include <io.h>
# include <winsock2.h>
+# define CUPS_SOCAST (const char *)
# else
# include <unistd.h>
# include <fcntl.h>
# include <sys/socket.h>
# define closesocket(f) close(f)
+# define CUPS_SOCAST
# endif /* WIN32 */
# ifdef HAVE_GSSAPI
# ifdef HAVE_DNSSD
if (DNSServiceCreateConnection(&ref) == kDNSServiceErr_NoError)
{
- int interface = kDNSServiceInterfaceIndexAny;
+ int myinterface = kDNSServiceInterfaceIndexAny;
/* Lookup on any interface */
if (!strcmp(scheme, "ippusb"))
- interface = kDNSServiceInterfaceIndexLocalOnly;
+ myinterface = kDNSServiceInterfaceIndexLocalOnly;
localref = ref;
if (DNSServiceResolve(&localref,
- kDNSServiceFlagsShareConnection, interface,
+ kDNSServiceFlagsShareConnection, myinterface,
hostname, regtype, "local.", http_resolve_cb,
&uribuf) == kDNSServiceErr_NoError)
{
domainref = ref;
if (DNSServiceResolve(&domainref,
kDNSServiceFlagsShareConnection,
- interface, hostname, regtype, domain,
+ myinterface, hostname, regtype, domain,
http_resolve_cb,
&uribuf) == kDNSServiceErr_NoError)
domainsent = 1;
*/
val = 1;
- setsockopt(http->fd, SOL_SOCKET, SO_NOSIGPIPE, &val, sizeof(val));
+ setsockopt(http->fd, SOL_SOCKET, SO_NOSIGPIPE, CUPS_SOCAST &val, sizeof(val));
#endif /* SO_NOSIGPIPE */
/*
*/
val = 1;
- setsockopt(http->fd, IPPROTO_TCP, TCP_NODELAY, (char *)&val, sizeof(val));
+ setsockopt(http->fd, IPPROTO_TCP, TCP_NODELAY, CUPS_SOCAST &val, sizeof(val));
#ifdef FD_CLOEXEC
/*
ssize_t bytes; /* Bytes read */
+#ifdef HAVE_LIBZ
DEBUG_printf(("httpRead2(http=%p, buffer=%p, length=" CUPS_LLFMT
") coding=%d data_encoding=%d data_remaining=" CUPS_LLFMT,
- http, buffer, CUPS_LLCAST length, http->coding,
+ http, buffer, CUPS_LLCAST length,
+ http->coding,
+ http->data_encoding, CUPS_LLCAST http->data_remaining));
+#else
+ DEBUG_printf(("httpRead2(http=%p, buffer=%p, length=" CUPS_LLFMT
+ ") data_encoding=%d data_remaining=" CUPS_LLFMT,
+ http, buffer, CUPS_LLCAST length,
http->data_encoding, CUPS_LLCAST http->data_remaining));
+#endif /* HAVE_LIBZ */
if (http == NULL || buffer == NULL)
return (-1);
DEBUG_printf(("1httpRead2: Reading up to %d bytes into buffer.",
(int)length));
- if (length > http->data_remaining)
- length = http->data_remaining;
+ if (length > (size_t)http->data_remaining)
+ length = (size_t)http->data_remaining;
if ((bytes = http_read_buffered(http, buffer, length)) > 0)
http->data_remaining -= bytes;
http_set_length(http);
+#ifdef HAVE_LIBZ
/*
* Then start any content encoding...
*/
DEBUG_puts("1httpWriteResponse: Calling http_content_coding_start.");
http_content_coding_start(http,
httpGetField(http, HTTP_FIELD_CONTENT_ENCODING));
+#endif /* HAVE_LIBZ */
}
return (0);
DWORD tv = (DWORD)(timeout * 1000);
/* Timeout in milliseconds */
- setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(tv));
- setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, (char *)&tv, sizeof(tv));
+ setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, CUPS_SOCAST &tv, sizeof(tv));
+ setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, CUPS_SOCAST &tv, sizeof(tv));
#else
struct timeval tv; /* Timeout in secs and usecs */
tv.tv_sec = (int)timeout;
tv.tv_usec = (int)(1000000 * fmod(timeout, 1.0));
- setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
- setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv));
+ setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, CUPS_SOCAST &tv, sizeof(tv));
+ setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, CUPS_SOCAST &tv, sizeof(tv));
#endif /* WIN32 */
}
LIBRARY libcups2\r
-VERSION 2.9\r
+VERSION 2.10\r
EXPORTS\r
_cupsBufferGet\r
_cupsBufferRelease\r
_cups_strcpy\r
_cups_strlcat\r
_cups_strlcpy\r
-_httpAddrPort\r
_httpAddrSetPort\r
_httpAssembleUUID\r
-_httpCreate\r
_httpEncodeURI\r
-_httpPeek\r
_httpResolveURI\r
_httpWait\r
_ippFindOption\r
cupsSetServer\r
cupsSetServerCertCB\r
cupsSetUser\r
+cupsSetUserAgent\r
cupsTempFd\r
cupsTempFile\r
cupsTempFile2\r
+cupsUserAgent\r
cupsUTF32ToUTF8\r
cupsUTF8ToCharset\r
cupsUTF8ToUTF32\r
cupsUser\r
cupsWriteRequestData\r
+httpAcceptConnection\r
httpAddCredential\r
httpAddrAny\r
httpAddrConnect\r
+httpAddrCopyList\r
httpAddrEqual\r
httpAddrFreeList\r
httpAddrGetList\r
httpAddrLength\r
+httpAddrListen\r
httpAddrLocalhost\r
httpAddrLookup\r
+httpAddrPort\r
httpAddrString\r
httpAssembleURI\r
httpAssembleURIf\r
+httpAssembleUUID\r
httpBlocking\r
httpCheck\r
httpClearCookie\r
httpClearFields\r
httpClose\r
httpConnect\r
+httpConnect2\r
httpConnectEncrypt\r
httpCopyCredentials\r
httpDecode64\r
httpFreeCredentials\r
httpGet\r
httpGetBlocking\r
+httpGetContentEncoding\r
httpGetCookie\r
httpGetDateString\r
httpGetDateString2\r
httpGetDateTime\r
+httpGetExpect\r
httpGetFd\r
httpGetField\r
httpGetHostByName\r
httpMD5Final\r
httpMD5String\r
httpOptions\r
+httpPeek\r
httpPost\r
httpPrintf\r
httpPut\r
httpRead\r
httpRead2\r
+httpReadRequest\r
httpReconnect\r
httpSeparate\r
httpSeparate2\r
httpSeparateURI\r
httpSetCookie\r
httpSetCredentials\r
+httpSetDefaultField\r
httpSetExpect\r
httpSetField\r
httpSetLength\r
httpWait\r
httpWrite\r
httpWrite2\r
+httpWriteResponse\r
ippAddBoolean\r
ippAddBooleans\r
ippAddCollection\r
ippAddResolutions\r
ippAddSeparator\r
ippAddString\r
+ippAddStringf\r
+ippAddStringfv\r
ippAddStrings\r
ippAttributeString\r
+ippContainsInteger\r
+ippContainsString\r
ippCopyAttribute\r
ippCopyAttributes\r
ippDateToTime\r
ippLength\r
ippNew\r
ippNewRequest\r
+ippNewResponse\r
ippNextAttribute\r
ippOpString\r
ippOpValue\r
ippSetState\r
ippSetStatusCode\r
ippSetString\r
+ippSetStringf\r
+ippSetStringfv\r
ippSetValueTag\r
ippSetVersion\r
ippTagString\r
ippTagValue\r
ippTimeToDate\r
+ippValidateAttribute\r
+ippValidateAttributes\r
ippWrite\r
ippWriteFile\r
ippWriteIO\r
char ch; /* Connection check byte */
+#ifdef WIN32
+ if (recv(cg->http->fd, &ch, 1, MSG_PEEK) < 0 &&
+ WSAGetLastError() != WSAEWOULDBLOCK)
+#else
if (recv(cg->http->fd, &ch, 1, MSG_PEEK | MSG_DONTWAIT) < 0 &&
errno != EWOULDBLOCK)
+#endif /* WIN32 */
{
/*
* Nope, close the connection...
val = 1;
-#ifdef WIN32
- if (setsockopt(fd, SOL_SOCKET, SO_BROADCAST, (char *)&val, sizeof(val)))
-#else
- if (setsockopt(fd, SOL_SOCKET, SO_BROADCAST, &val, sizeof(val)))
-#endif /* WIN32 */
+ if (setsockopt(fd, SOL_SOCKET, SO_BROADCAST, CUPS_SOCAST &val, sizeof(val)))
{
DEBUG_printf(("5_cupsSNMPOpen: Returning -1 (%s)", strerror(errno)));
_cups_globals_t *cg = _cupsGlobals();
/* Thread globals */
#ifdef WIN32
- SYSTEM_INFO sysinfo; /* System information */
- OSVERSIONEX version; /* OS version info */
+ SYSTEM_INFO sysinfo; /* System information */
+ OSVERSIONINFO version; /* OS version info */
#else
struct utsname name; /* uname info */
#endif /* WIN32 */
}
#ifdef WIN32
- version.dwOSVersionInfoSize = sizeof(OSVERSIONEX);
- GetVersionInfoEx(&version);
+ version.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+ GetVersionEx(&version);
GetNativeSystemInfo(&sysinfo);
snprintf(cg->user_agent, sizeof(cg->user_agent),
CUPS_MINIMAL " (Windows %d.%d; %s) IPP/2.0",
- version.major, version.minor,
+ version.dwMajorVersion, version.dwMinorVersion,
sysinfo.wProcessorArchitecture
== PROCESSOR_ARCHITECTURE_AMD64 ? "amd64" :
sysinfo.wProcessorArchitecture
*
* Configuration file for CUPS on Windows.
*
- * Copyright 2007-2012 by Apple Inc.
+ * Copyright 2007-2013 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* Use <stdint.h>?
*/
-#define HAVE_STDINT_H 1
+/* #undef HAVE_STDINT_H */
/*