gdiplus: Support GdipSetClipRegion in metafiles.
[wine.git] / dlls / iphlpapi / icmp.c
blobebc2f2b65c3e8f2836fe412233955c4be5dfbddd
1 /*
2 * ICMP
4 * Francois Gouget, 1999, based on the work of
5 * RW Hall, 1999, based on public domain code PING.C by Mike Muus (1983)
6 * and later works (c) 1989 Regents of Univ. of California - see copyright
7 * notice at end of source-code.
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 /* Future work:
25 * - Systems like FreeBSD don't seem to support the IP_TTL option and maybe others.
26 * But using IP_HDRINCL and building the IP header by hand might work.
27 * - Not all IP options are supported.
28 * - Are ICMP handles real handles, i.e. inheritable and all? There might be some
29 * more work to do here, including server side stuff with synchronization.
30 * - This API should probably be thread safe. Is it really?
31 * - Using the winsock functions has not been tested.
34 #include "config.h"
36 #include <sys/types.h>
37 #ifdef HAVE_SYS_SOCKET_H
38 # include <sys/socket.h>
39 #endif
40 #ifdef HAVE_NETDB_H
41 # include <netdb.h>
42 #endif
43 #ifdef HAVE_NETINET_IN_SYSTM_H
44 # include <netinet/in_systm.h>
45 #endif
46 #ifdef HAVE_NETINET_IN_H
47 # include <netinet/in.h>
48 #endif
50 #ifdef HAVE_SYS_TIME_H
51 # include <sys/time.h>
52 #endif
53 #include <stdarg.h>
54 #include <string.h>
55 #include <errno.h>
56 #ifdef HAVE_UNISTD_H
57 # include <unistd.h>
58 #endif
59 #ifdef HAVE_ARPA_INET_H
60 # include <arpa/inet.h>
61 #endif
62 #ifdef HAVE_SYS_POLL_H
63 # include <sys/poll.h>
64 #endif
66 #define USE_WS_PREFIX
68 #include "windef.h"
69 #include "winbase.h"
70 #include "winerror.h"
71 #include "winternl.h"
72 #include "ipexport.h"
73 #include "icmpapi.h"
74 #include "wine/debug.h"
76 /* Set up endianness macros for the ip and ip_icmp BSD headers */
77 #ifndef BIG_ENDIAN
78 #define BIG_ENDIAN 4321
79 #endif
80 #ifndef LITTLE_ENDIAN
81 #define LITTLE_ENDIAN 1234
82 #endif
83 #ifndef BYTE_ORDER
84 #ifdef WORDS_BIGENDIAN
85 #define BYTE_ORDER BIG_ENDIAN
86 #else
87 #define BYTE_ORDER LITTLE_ENDIAN
88 #endif
89 #endif /* BYTE_ORDER */
91 #define u_int16_t WORD
92 #define u_int32_t DWORD
94 /* These are BSD headers. We use these here because they are needed on
95 * libc5 Linux systems. On other platforms they are usually simply more
96 * complete than the native stuff, and cause less portability problems
97 * so we use them anyway.
99 #include "ip.h"
100 #include "ip_icmp.h"
103 WINE_DEFAULT_DEBUG_CHANNEL(icmp);
104 WINE_DECLARE_DEBUG_CHANNEL(winediag);
107 typedef struct {
108 int sid;
109 IP_OPTION_INFORMATION default_opts;
110 } icmp_t;
112 #define IP_OPTS_UNKNOWN 0
113 #define IP_OPTS_DEFAULT 1
114 #define IP_OPTS_CUSTOM 2
116 /* The sequence number is unique process wide, so that all threads
117 * have a distinct sequence number.
119 static LONG icmp_sequence=0;
121 static int in_cksum(u_short *addr, int len)
123 int nleft=len;
124 u_short *w = addr;
125 int sum = 0;
126 u_short answer = 0;
128 while (nleft > 1) {
129 sum += *w++;
130 nleft -= 2;
133 if (nleft == 1) {
134 *(u_char *)(&answer) = *(u_char *)w;
135 sum += answer;
138 sum = (sum >> 16) + (sum & 0xffff);
139 sum += (sum >> 16);
140 answer = ~sum;
141 return(answer);
147 * Exported Routines.
150 /***********************************************************************
151 * Icmp6CreateFile (IPHLPAPI.@)
153 HANDLE WINAPI Icmp6CreateFile(VOID)
155 icmp_t* icp;
157 int sid=socket(AF_INET6,SOCK_RAW,IPPROTO_ICMPV6);
158 if (sid < 0)
160 /* Mac OS X supports non-privileged ICMP via SOCK_DGRAM type. */
161 sid=socket(AF_INET6,SOCK_DGRAM,IPPROTO_ICMPV6);
163 if (sid < 0) {
164 ERR_(winediag)("Failed to use ICMPV6 (network ping), this requires special permissions.\n");
165 SetLastError(ERROR_ACCESS_DENIED);
166 return INVALID_HANDLE_VALUE;
169 icp=HeapAlloc(GetProcessHeap(), 0, sizeof(*icp));
170 if (icp==NULL) {
171 close(sid);
172 SetLastError(IP_NO_RESOURCES);
173 return INVALID_HANDLE_VALUE;
175 icp->sid=sid;
176 icp->default_opts.OptionsSize=IP_OPTS_UNKNOWN;
177 return (HANDLE)icp;
181 /***********************************************************************
182 * Icmp6SendEcho2 (IPHLPAPI.@)
184 DWORD WINAPI Icmp6SendEcho2(
185 HANDLE IcmpHandle,
186 HANDLE Event,
187 PIO_APC_ROUTINE ApcRoutine,
188 PVOID ApcContext,
189 struct sockaddr_in6* SourceAddress,
190 struct sockaddr_in6* DestinationAddress,
191 LPVOID RequestData,
192 WORD RequestSize,
193 PIP_OPTION_INFORMATION RequestOptions,
194 LPVOID ReplyBuffer,
195 DWORD ReplySize,
196 DWORD Timeout
199 FIXME("(%p, %p, %p, %p, %p, %p, %p, %d, %p, %p, %d, %d): stub\n", IcmpHandle, Event,
200 ApcRoutine, ApcContext, SourceAddress, DestinationAddress, RequestData,
201 RequestSize, RequestOptions, ReplyBuffer, ReplySize, Timeout);
202 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
203 return 0;
207 /***********************************************************************
208 * IcmpCreateFile (IPHLPAPI.@)
210 HANDLE WINAPI IcmpCreateFile(VOID)
212 icmp_t* icp;
214 int sid=socket(AF_INET,SOCK_RAW,IPPROTO_ICMP);
215 if (sid < 0)
217 /* Mac OS X supports non-privileged ICMP via SOCK_DGRAM type. */
218 sid=socket(AF_INET,SOCK_DGRAM,IPPROTO_ICMP);
220 if (sid < 0) {
221 ERR_(winediag)("Failed to use ICMP (network ping), this requires special permissions.\n");
222 SetLastError(ERROR_ACCESS_DENIED);
223 return INVALID_HANDLE_VALUE;
226 icp=HeapAlloc(GetProcessHeap(), 0, sizeof(*icp));
227 if (icp==NULL) {
228 close(sid);
229 SetLastError(IP_NO_RESOURCES);
230 return INVALID_HANDLE_VALUE;
232 icp->sid=sid;
233 icp->default_opts.OptionsSize=IP_OPTS_UNKNOWN;
234 return (HANDLE)icp;
238 /***********************************************************************
239 * IcmpCloseHandle (IPHLPAPI.@)
241 BOOL WINAPI IcmpCloseHandle(HANDLE IcmpHandle)
243 icmp_t* icp=(icmp_t*)IcmpHandle;
244 if (IcmpHandle==INVALID_HANDLE_VALUE) {
245 /* FIXME: in fact win98 seems to ignore the handle value !!! */
246 SetLastError(ERROR_INVALID_HANDLE);
247 return FALSE;
250 close( icp->sid );
251 HeapFree(GetProcessHeap (), 0, icp);
252 return TRUE;
256 /***********************************************************************
257 * IcmpSendEcho (IPHLPAPI.@)
259 DWORD WINAPI IcmpSendEcho(
260 HANDLE IcmpHandle,
261 IPAddr DestinationAddress,
262 LPVOID RequestData,
263 WORD RequestSize,
264 PIP_OPTION_INFORMATION RequestOptions,
265 LPVOID ReplyBuffer,
266 DWORD ReplySize,
267 DWORD Timeout
270 icmp_t* icp=(icmp_t*)IcmpHandle;
271 unsigned char* reqbuf;
272 int reqsize;
274 struct icmp_echo_reply* ier;
275 struct ip* ip_header;
276 struct icmp* icmp_header;
277 char* endbuf;
278 int ip_header_len;
279 int maxlen;
280 struct pollfd fdr;
281 DWORD send_time,recv_time;
282 struct sockaddr_in addr;
283 socklen_t addrlen;
284 unsigned short id,seq,cksum;
285 int res;
287 if (IcmpHandle==INVALID_HANDLE_VALUE) {
288 /* FIXME: in fact win98 seems to ignore the handle value !!! */
289 SetLastError(ERROR_INVALID_HANDLE);
290 return 0;
293 if (ReplySize<sizeof(ICMP_ECHO_REPLY)+ICMP_MINLEN) {
294 SetLastError(IP_BUF_TOO_SMALL);
295 return 0;
297 /* check the request size against SO_MAX_MSG_SIZE using getsockopt */
299 if (!DestinationAddress) {
300 SetLastError(ERROR_INVALID_NETNAME);
301 return 0;
304 /* Prepare the request */
305 id=getpid() & 0xFFFF;
306 seq=InterlockedIncrement(&icmp_sequence) & 0xFFFF;
308 reqsize=ICMP_MINLEN+RequestSize;
309 reqbuf=HeapAlloc(GetProcessHeap(), 0, reqsize);
310 if (reqbuf==NULL) {
311 SetLastError(ERROR_OUTOFMEMORY);
312 return 0;
315 icmp_header=(struct icmp*)reqbuf;
316 icmp_header->icmp_type=ICMP_ECHO;
317 icmp_header->icmp_code=0;
318 icmp_header->icmp_cksum=0;
319 icmp_header->icmp_id=id;
320 icmp_header->icmp_seq=seq;
321 memcpy(reqbuf+ICMP_MINLEN, RequestData, RequestSize);
322 icmp_header->icmp_cksum=cksum=in_cksum((u_short*)reqbuf,reqsize);
324 addr.sin_family=AF_INET;
325 addr.sin_addr.s_addr=DestinationAddress;
326 addr.sin_port=0;
328 if (RequestOptions!=NULL) {
329 int val;
330 if (icp->default_opts.OptionsSize==IP_OPTS_UNKNOWN) {
331 socklen_t len;
332 /* Before we mess with the options, get the default values */
333 len=sizeof(val);
334 getsockopt(icp->sid,IPPROTO_IP,IP_TTL,(char *)&val,&len);
335 icp->default_opts.Ttl=val;
337 len=sizeof(val);
338 getsockopt(icp->sid,IPPROTO_IP,IP_TOS,(char *)&val,&len);
339 icp->default_opts.Tos=val;
340 /* FIXME: missing: handling of IP 'flags', and all the other options */
343 val=RequestOptions->Ttl;
344 setsockopt(icp->sid,IPPROTO_IP,IP_TTL,(char *)&val,sizeof(val));
345 val=RequestOptions->Tos;
346 setsockopt(icp->sid,IPPROTO_IP,IP_TOS,(char *)&val,sizeof(val));
347 /* FIXME: missing: handling of IP 'flags', and all the other options */
349 icp->default_opts.OptionsSize=IP_OPTS_CUSTOM;
350 } else if (icp->default_opts.OptionsSize==IP_OPTS_CUSTOM) {
351 int val;
353 /* Restore the default options */
354 val=icp->default_opts.Ttl;
355 setsockopt(icp->sid,IPPROTO_IP,IP_TTL,(char *)&val,sizeof(val));
356 val=icp->default_opts.Tos;
357 setsockopt(icp->sid,IPPROTO_IP,IP_TOS,(char *)&val,sizeof(val));
358 /* FIXME: missing: handling of IP 'flags', and all the other options */
360 icp->default_opts.OptionsSize=IP_OPTS_DEFAULT;
363 /* Get ready for receiving the reply
364 * Do it before we send the request to minimize the risk of introducing delays
366 fdr.fd = icp->sid;
367 fdr.events = POLLIN;
368 addrlen=sizeof(addr);
369 ier=ReplyBuffer;
370 ip_header=(struct ip *) ((char *) ReplyBuffer+sizeof(ICMP_ECHO_REPLY));
371 endbuf=(char *) ReplyBuffer+ReplySize;
372 maxlen=ReplySize-sizeof(ICMP_ECHO_REPLY);
374 /* Send the packet */
375 TRACE("Sending %d bytes (RequestSize=%d) to %s\n", reqsize, RequestSize, inet_ntoa(addr.sin_addr));
376 #if 0
377 if (TRACE_ON(icmp)){
378 unsigned char* buf=(unsigned char*)reqbuf;
379 int i;
380 printf("Output buffer:\n");
381 for (i=0;i<reqsize;i++)
382 printf("%2x,", buf[i]);
383 printf("\n");
385 #endif
387 send_time = GetTickCount();
388 res=sendto(icp->sid, reqbuf, reqsize, 0, (struct sockaddr*)&addr, sizeof(addr));
389 HeapFree(GetProcessHeap (), 0, reqbuf);
390 if (res<0) {
391 if (errno==EMSGSIZE)
392 SetLastError(IP_PACKET_TOO_BIG);
393 else {
394 switch (errno) {
395 case ENETUNREACH:
396 SetLastError(IP_DEST_NET_UNREACHABLE);
397 break;
398 case EHOSTUNREACH:
399 SetLastError(IP_DEST_HOST_UNREACHABLE);
400 break;
401 default:
402 TRACE("unknown error: errno=%d\n",errno);
403 SetLastError(IP_GENERAL_FAILURE);
406 return 0;
409 /* Get the reply */
410 ip_header_len=0; /* because gcc was complaining */
411 while (poll(&fdr,1,Timeout)>0) {
412 recv_time = GetTickCount();
413 res=recvfrom(icp->sid, (char*)ip_header, maxlen, 0, (struct sockaddr*)&addr,&addrlen);
414 TRACE("received %d bytes from %s\n",res, inet_ntoa(addr.sin_addr));
415 ier->Status=IP_REQ_TIMED_OUT;
417 /* Check whether we should ignore this packet */
418 if ((ip_header->ip_p==IPPROTO_ICMP) && (res>=sizeof(struct ip)+ICMP_MINLEN)) {
419 ip_header_len=ip_header->ip_hl << 2;
420 icmp_header=(struct icmp*)(((char*)ip_header)+ip_header_len);
421 TRACE("received an ICMP packet of type,code=%d,%d\n",icmp_header->icmp_type,icmp_header->icmp_code);
422 if (icmp_header->icmp_type==ICMP_ECHOREPLY) {
423 if ((icmp_header->icmp_id==id) && (icmp_header->icmp_seq==seq))
424 ier->Status=IP_SUCCESS;
425 } else {
426 switch (icmp_header->icmp_type) {
427 case ICMP_UNREACH:
428 switch (icmp_header->icmp_code) {
429 case ICMP_UNREACH_HOST:
430 #ifdef ICMP_UNREACH_HOST_UNKNOWN
431 case ICMP_UNREACH_HOST_UNKNOWN:
432 #endif
433 #ifdef ICMP_UNREACH_ISOLATED
434 case ICMP_UNREACH_ISOLATED:
435 #endif
436 #ifdef ICMP_UNREACH_HOST_PROHIB
437 case ICMP_UNREACH_HOST_PROHIB:
438 #endif
439 #ifdef ICMP_UNREACH_TOSHOST
440 case ICMP_UNREACH_TOSHOST:
441 #endif
442 ier->Status=IP_DEST_HOST_UNREACHABLE;
443 break;
444 case ICMP_UNREACH_PORT:
445 ier->Status=IP_DEST_PORT_UNREACHABLE;
446 break;
447 case ICMP_UNREACH_PROTOCOL:
448 ier->Status=IP_DEST_PROT_UNREACHABLE;
449 break;
450 case ICMP_UNREACH_SRCFAIL:
451 ier->Status=IP_BAD_ROUTE;
452 break;
453 default:
454 ier->Status=IP_DEST_NET_UNREACHABLE;
456 break;
457 case ICMP_TIMXCEED:
458 if (icmp_header->icmp_code==ICMP_TIMXCEED_REASS)
459 ier->Status=IP_TTL_EXPIRED_REASSEM;
460 else
461 ier->Status=IP_TTL_EXPIRED_TRANSIT;
462 break;
463 case ICMP_PARAMPROB:
464 ier->Status=IP_PARAM_PROBLEM;
465 break;
466 case ICMP_SOURCEQUENCH:
467 ier->Status=IP_SOURCE_QUENCH;
468 break;
470 if (ier->Status!=IP_REQ_TIMED_OUT) {
471 struct ip* rep_ip_header;
472 struct icmp* rep_icmp_header;
473 /* The ICMP header size of all the packets we accept is the same */
474 rep_ip_header=(struct ip*)(((char*)icmp_header)+ICMP_MINLEN);
475 rep_icmp_header=(struct icmp*)(((char*)rep_ip_header)+(rep_ip_header->ip_hl << 2));
477 /* Make sure that this is really a reply to our packet */
478 if (ip_header_len+ICMP_MINLEN+(rep_ip_header->ip_hl << 2)+ICMP_MINLEN>ip_header->ip_len) {
479 ier->Status=IP_REQ_TIMED_OUT;
480 } else if ((rep_icmp_header->icmp_type!=ICMP_ECHO) ||
481 (rep_icmp_header->icmp_code!=0) ||
482 (rep_icmp_header->icmp_id!=id) ||
483 /* windows doesn't check this checksum, else tracert */
484 /* behind a Linux 2.2 masquerading firewall would fail*/
485 /* (rep_icmp_header->icmp_cksum!=cksum) || */
486 (rep_icmp_header->icmp_seq!=seq)) {
487 /* This was not a reply to one of our packets after all */
488 TRACE("skipping type,code=%d,%d id,seq=%d,%d cksum=%d\n",
489 rep_icmp_header->icmp_type,rep_icmp_header->icmp_code,
490 rep_icmp_header->icmp_id,rep_icmp_header->icmp_seq,
491 rep_icmp_header->icmp_cksum);
492 TRACE("expected type,code=8,0 id,seq=%d,%d cksum=%d\n",
493 id,seq,
494 cksum);
495 ier->Status=IP_REQ_TIMED_OUT;
501 if (ier->Status==IP_REQ_TIMED_OUT) {
502 /* This packet was not for us.
503 * Decrease the timeout so that we don't enter an endless loop even
504 * if we get flooded with ICMP packets that are not for us.
506 DWORD t = (recv_time - send_time);
507 if (Timeout > t) Timeout -= t;
508 else Timeout = 0;
509 continue;
510 } else {
511 /* This is a reply to our packet */
512 memcpy(&ier->Address,&ip_header->ip_src,sizeof(IPAddr));
513 /* Status is already set */
514 ier->RoundTripTime= recv_time - send_time;
515 ier->DataSize=res-ip_header_len-ICMP_MINLEN;
516 ier->Reserved=0;
517 ier->Data=endbuf-ier->DataSize;
518 memmove(ier->Data,((char*)ip_header)+ip_header_len+ICMP_MINLEN,ier->DataSize);
519 ier->Options.Ttl=ip_header->ip_ttl;
520 ier->Options.Tos=ip_header->ip_tos;
521 ier->Options.Flags=ip_header->ip_off >> 13;
522 ier->Options.OptionsSize=ip_header_len-sizeof(struct ip);
523 if (ier->Options.OptionsSize!=0) {
524 ier->Options.OptionsData=(unsigned char *) ier->Data-ier->Options.OptionsSize;
525 /* FIXME: We are supposed to rearrange the option's 'source route' data */
526 memmove(ier->Options.OptionsData,((char*)ip_header)+ip_header_len,ier->Options.OptionsSize);
527 endbuf=(char*)ier->Options.OptionsData;
528 } else {
529 ier->Options.OptionsData=NULL;
530 endbuf=ier->Data;
533 /* Prepare for the next packet */
534 ier++;
535 ip_header=(struct ip*)(((char*)ip_header)+sizeof(ICMP_ECHO_REPLY));
536 maxlen=endbuf-(char*)ip_header;
538 /* Check out whether there is more but don't wait this time */
539 Timeout=0;
542 res=ier-(ICMP_ECHO_REPLY*)ReplyBuffer;
543 if (res==0)
544 SetLastError(IP_REQ_TIMED_OUT);
545 TRACE("received %d replies\n",res);
546 return res;
549 /***********************************************************************
550 * IcmpSendEcho2 (IPHLPAPI.@)
552 DWORD WINAPI IcmpSendEcho2(
553 HANDLE IcmpHandle,
554 HANDLE Event,
555 PIO_APC_ROUTINE ApcRoutine,
556 PVOID ApcContext,
557 IPAddr DestinationAddress,
558 LPVOID RequestData,
559 WORD RequestSize,
560 PIP_OPTION_INFORMATION RequestOptions,
561 LPVOID ReplyBuffer,
562 DWORD ReplySize,
563 DWORD Timeout
566 TRACE("(%p, %p, %p, %p, %08x, %p, %d, %p, %p, %d, %d): stub\n", IcmpHandle,
567 Event, ApcRoutine, ApcContext, DestinationAddress, RequestData,
568 RequestSize, RequestOptions, ReplyBuffer, ReplySize, Timeout);
570 if (Event)
572 FIXME("unsupported for events\n");
573 return 0;
575 if (ApcRoutine)
577 FIXME("unsupported for APCs\n");
578 return 0;
580 return IcmpSendEcho(IcmpHandle, DestinationAddress, RequestData,
581 RequestSize, RequestOptions, ReplyBuffer, ReplySize, Timeout);
584 /***********************************************************************
585 * IcmpSendEcho2Ex (IPHLPAPI.@)
587 DWORD WINAPI IcmpSendEcho2Ex(
588 HANDLE IcmpHandle,
589 HANDLE Event,
590 PIO_APC_ROUTINE ApcRoutine,
591 PVOID ApcContext,
592 IPAddr SourceAddress,
593 IPAddr DestinationAddress,
594 LPVOID RequestData,
595 WORD RequestSize,
596 PIP_OPTION_INFORMATION RequestOptions,
597 LPVOID ReplyBuffer,
598 DWORD ReplySize,
599 DWORD Timeout
602 TRACE("(%p, %p, %p, %p, %08x, %08x, %p, %d, %p, %p, %d, %d): stub\n", IcmpHandle,
603 Event, ApcRoutine, ApcContext, SourceAddress, DestinationAddress, RequestData,
604 RequestSize, RequestOptions, ReplyBuffer, ReplySize, Timeout);
606 if (Event)
608 FIXME("unsupported for events\n");
609 return 0;
611 if (ApcRoutine)
613 FIXME("unsupported for APCs\n");
614 return 0;
616 if (SourceAddress)
618 FIXME("unsupported for source addresses\n");
619 return 0;
622 return IcmpSendEcho(IcmpHandle, DestinationAddress, RequestData,
623 RequestSize, RequestOptions, ReplyBuffer, ReplySize, Timeout);
627 * Copyright (c) 1989 The Regents of the University of California.
628 * All rights reserved.
630 * This code is derived from software contributed to Berkeley by
631 * Mike Muuss.
633 * Redistribution and use in source and binary forms, with or without
634 * modification, are permitted provided that the following conditions
635 * are met:
636 * 1. Redistributions of source code must retain the above copyright
637 * notice, this list of conditions and the following disclaimer.
638 * 2. Redistributions in binary form must reproduce the above copyright
639 * notice, this list of conditions and the following disclaimer in the
640 * documentation and/or other materials provided with the distribution.
641 * 3. Neither the name of the University nor the names of its contributors
642 * may be used to endorse or promote products derived from this software
643 * without specific prior written permission.
645 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
646 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
647 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
648 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
649 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
650 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
651 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
652 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
653 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
654 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
655 * SUCH DAMAGE.