wmiutils: Implement IWbemPath::GetNamespaceAt.
[wine] / dlls / iphlpapi / icmp.c
1 /*
2  * ICMP
3  *
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.
8  *
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.
13  *
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.
18  *
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
22  */
23
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.
32  */
33
34 #include "config.h"
35
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
49
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
65
66 #define USE_WS_PREFIX
67
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"
75
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 */
90
91 #define u_int16_t  WORD
92 #define u_int32_t  DWORD
93
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.
98  */
99 #include "ip.h"
100 #include "ip_icmp.h"
101
102
103 WINE_DEFAULT_DEBUG_CHANNEL(icmp);
104 WINE_DECLARE_DEBUG_CHANNEL(winediag);
105
106
107 typedef struct {
108     int sid;
109     IP_OPTION_INFORMATION default_opts;
110 } icmp_t;
111
112 #define IP_OPTS_UNKNOWN     0
113 #define IP_OPTS_DEFAULT     1
114 #define IP_OPTS_CUSTOM      2
115
116 /* The sequence number is unique process wide, so that all threads
117  * have a distinct sequence number.
118  */
119 static LONG icmp_sequence=0;
120
121 static int in_cksum(u_short *addr, int len)
122 {
123     int nleft=len;
124     u_short *w = addr;
125     int sum = 0;
126     u_short answer = 0;
127
128     while (nleft > 1) {
129         sum += *w++;
130         nleft -= 2;
131     }
132
133     if (nleft == 1) {
134         *(u_char *)(&answer) = *(u_char *)w;
135         sum += answer;
136     }
137
138     sum = (sum >> 16) + (sum & 0xffff);
139     sum  += (sum >> 16);
140     answer = ~sum;
141     return(answer);
142 }
143
144
145
146 /*
147  * Exported Routines.
148  */
149
150 /***********************************************************************
151  *              IcmpCreateFile (IPHLPAPI.@)
152  */
153 HANDLE WINAPI IcmpCreateFile(VOID)
154 {
155     icmp_t* icp;
156
157     int sid=socket(AF_INET,SOCK_RAW,IPPROTO_ICMP);
158     if (sid < 0)
159     {
160         /* Mac OS X supports non-privileged ICMP via SOCK_DGRAM type. */
161         sid=socket(AF_INET,SOCK_DGRAM,IPPROTO_ICMP);
162     }
163     if (sid < 0) {
164         ERR_(winediag)("Failed to use ICMP (network ping), this requires special permissions.\n");
165         SetLastError(ERROR_ACCESS_DENIED);
166         return INVALID_HANDLE_VALUE;
167     }
168
169     icp=HeapAlloc(GetProcessHeap(), 0, sizeof(*icp));
170     if (icp==NULL) {
171         close(sid);
172         SetLastError(IP_NO_RESOURCES);
173         return INVALID_HANDLE_VALUE;
174     }
175     icp->sid=sid;
176     icp->default_opts.OptionsSize=IP_OPTS_UNKNOWN;
177     return (HANDLE)icp;
178 }
179
180
181 /***********************************************************************
182  *              IcmpCloseHandle (IPHLPAPI.@)
183  */
184 BOOL WINAPI IcmpCloseHandle(HANDLE  IcmpHandle)
185 {
186     icmp_t* icp=(icmp_t*)IcmpHandle;
187     if (IcmpHandle==INVALID_HANDLE_VALUE) {
188         /* FIXME: in fact win98 seems to ignore the handle value !!! */
189         SetLastError(ERROR_INVALID_HANDLE);
190         return FALSE;
191     }
192
193     close( icp->sid );
194     HeapFree(GetProcessHeap (), 0, icp);
195     return TRUE;
196 }
197
198
199 /***********************************************************************
200  *              IcmpSendEcho (IPHLPAPI.@)
201  */
202 DWORD WINAPI IcmpSendEcho(
203     HANDLE                   IcmpHandle,
204     IPAddr                   DestinationAddress,
205     LPVOID                   RequestData,
206     WORD                     RequestSize,
207     PIP_OPTION_INFORMATION   RequestOptions,
208     LPVOID                   ReplyBuffer,
209     DWORD                    ReplySize,
210     DWORD                    Timeout
211     )
212 {
213     icmp_t* icp=(icmp_t*)IcmpHandle;
214     unsigned char* reqbuf;
215     int reqsize;
216
217     struct icmp_echo_reply* ier;
218     struct ip* ip_header;
219     struct icmp* icmp_header;
220     char* endbuf;
221     int ip_header_len;
222     int maxlen;
223     struct pollfd fdr;
224     DWORD send_time,recv_time;
225     struct sockaddr_in addr;
226     unsigned int addrlen;
227     unsigned short id,seq,cksum;
228     int res;
229
230     if (IcmpHandle==INVALID_HANDLE_VALUE) {
231         /* FIXME: in fact win98 seems to ignore the handle value !!! */
232         SetLastError(ERROR_INVALID_HANDLE);
233         return 0;
234     }
235
236     if (ReplySize<sizeof(ICMP_ECHO_REPLY)+ICMP_MINLEN) {
237         SetLastError(IP_BUF_TOO_SMALL);
238         return 0;
239     }
240     /* check the request size against SO_MAX_MSG_SIZE using getsockopt */
241
242     /* Prepare the request */
243     id=getpid() & 0xFFFF;
244     seq=InterlockedIncrement(&icmp_sequence) & 0xFFFF;
245
246     reqsize=ICMP_MINLEN+RequestSize;
247     reqbuf=HeapAlloc(GetProcessHeap(), 0, reqsize);
248     if (reqbuf==NULL) {
249         SetLastError(ERROR_OUTOFMEMORY);
250         return 0;
251     }
252
253     icmp_header=(struct icmp*)reqbuf;
254     icmp_header->icmp_type=ICMP_ECHO;
255     icmp_header->icmp_code=0;
256     icmp_header->icmp_cksum=0;
257     icmp_header->icmp_id=id;
258     icmp_header->icmp_seq=seq;
259     memcpy(reqbuf+ICMP_MINLEN, RequestData, RequestSize);
260     icmp_header->icmp_cksum=cksum=in_cksum((u_short*)reqbuf,reqsize);
261
262     addr.sin_family=AF_INET;
263     addr.sin_addr.s_addr=DestinationAddress;
264     addr.sin_port=0;
265
266     if (RequestOptions!=NULL) {
267         int val;
268         if (icp->default_opts.OptionsSize==IP_OPTS_UNKNOWN) {
269             unsigned int len;
270             /* Before we mess with the options, get the default values */
271             len=sizeof(val);
272             getsockopt(icp->sid,IPPROTO_IP,IP_TTL,(char *)&val,&len);
273             icp->default_opts.Ttl=val;
274
275             len=sizeof(val);
276             getsockopt(icp->sid,IPPROTO_IP,IP_TOS,(char *)&val,&len);
277             icp->default_opts.Tos=val;
278             /* FIXME: missing: handling of IP 'flags', and all the other options */
279         }
280
281         val=RequestOptions->Ttl;
282         setsockopt(icp->sid,IPPROTO_IP,IP_TTL,(char *)&val,sizeof(val));
283         val=RequestOptions->Tos;
284         setsockopt(icp->sid,IPPROTO_IP,IP_TOS,(char *)&val,sizeof(val));
285         /* FIXME:  missing: handling of IP 'flags', and all the other options */
286
287         icp->default_opts.OptionsSize=IP_OPTS_CUSTOM;
288     } else if (icp->default_opts.OptionsSize==IP_OPTS_CUSTOM) {
289         int val;
290
291         /* Restore the default options */
292         val=icp->default_opts.Ttl;
293         setsockopt(icp->sid,IPPROTO_IP,IP_TTL,(char *)&val,sizeof(val));
294         val=icp->default_opts.Tos;
295         setsockopt(icp->sid,IPPROTO_IP,IP_TOS,(char *)&val,sizeof(val));
296         /* FIXME: missing: handling of IP 'flags', and all the other options */
297
298         icp->default_opts.OptionsSize=IP_OPTS_DEFAULT;
299     }
300
301     /* Get ready for receiving the reply
302      * Do it before we send the request to minimize the risk of introducing delays
303      */
304     fdr.fd = icp->sid;
305     fdr.events = POLLIN;
306     addrlen=sizeof(addr);
307     ier=ReplyBuffer;
308     ip_header=(struct ip *) ((char *) ReplyBuffer+sizeof(ICMP_ECHO_REPLY));
309     endbuf=(char *) ReplyBuffer+ReplySize;
310     maxlen=ReplySize-sizeof(ICMP_ECHO_REPLY);
311
312     /* Send the packet */
313     TRACE("Sending %d bytes (RequestSize=%d) to %s\n", reqsize, RequestSize, inet_ntoa(addr.sin_addr));
314 #if 0
315     if (TRACE_ON(icmp)){
316         unsigned char* buf=(unsigned char*)reqbuf;
317         int i;
318         printf("Output buffer:\n");
319         for (i=0;i<reqsize;i++)
320             printf("%2x,", buf[i]);
321         printf("\n");
322     }
323 #endif
324
325     send_time = GetTickCount();
326     res=sendto(icp->sid, reqbuf, reqsize, 0, (struct sockaddr*)&addr, sizeof(addr));
327     HeapFree(GetProcessHeap (), 0, reqbuf);
328     if (res<0) {
329         if (errno==EMSGSIZE)
330             SetLastError(IP_PACKET_TOO_BIG);
331         else {
332             switch (errno) {
333             case ENETUNREACH:
334                 SetLastError(IP_DEST_NET_UNREACHABLE);
335                 break;
336             case EHOSTUNREACH:
337                 SetLastError(IP_DEST_HOST_UNREACHABLE);
338                 break;
339             default:
340                 TRACE("unknown error: errno=%d\n",errno);
341                 SetLastError(IP_GENERAL_FAILURE);
342             }
343         }
344         return 0;
345     }
346
347     /* Get the reply */
348     ip_header_len=0; /* because gcc was complaining */
349     while (poll(&fdr,1,Timeout)>0) {
350         recv_time = GetTickCount();
351         res=recvfrom(icp->sid, (char*)ip_header, maxlen, 0, (struct sockaddr*)&addr,&addrlen);
352         TRACE("received %d bytes from %s\n",res, inet_ntoa(addr.sin_addr));
353         ier->Status=IP_REQ_TIMED_OUT;
354
355         /* Check whether we should ignore this packet */
356         if ((ip_header->ip_p==IPPROTO_ICMP) && (res>=sizeof(struct ip)+ICMP_MINLEN)) {
357             ip_header_len=ip_header->ip_hl << 2;
358             icmp_header=(struct icmp*)(((char*)ip_header)+ip_header_len);
359             TRACE("received an ICMP packet of type,code=%d,%d\n",icmp_header->icmp_type,icmp_header->icmp_code);
360             if (icmp_header->icmp_type==ICMP_ECHOREPLY) {
361                 if ((icmp_header->icmp_id==id) && (icmp_header->icmp_seq==seq))
362                     ier->Status=IP_SUCCESS;
363             } else {
364                 switch (icmp_header->icmp_type) {
365                 case ICMP_UNREACH:
366                     switch (icmp_header->icmp_code) {
367                     case ICMP_UNREACH_HOST:
368 #ifdef ICMP_UNREACH_HOST_UNKNOWN
369                     case ICMP_UNREACH_HOST_UNKNOWN:
370 #endif
371 #ifdef ICMP_UNREACH_ISOLATED
372                     case ICMP_UNREACH_ISOLATED:
373 #endif
374 #ifdef ICMP_UNREACH_HOST_PROHIB
375                     case ICMP_UNREACH_HOST_PROHIB:
376 #endif
377 #ifdef ICMP_UNREACH_TOSHOST
378                     case ICMP_UNREACH_TOSHOST:
379 #endif
380                         ier->Status=IP_DEST_HOST_UNREACHABLE;
381                         break;
382                     case ICMP_UNREACH_PORT:
383                         ier->Status=IP_DEST_PORT_UNREACHABLE;
384                         break;
385                     case ICMP_UNREACH_PROTOCOL:
386                         ier->Status=IP_DEST_PROT_UNREACHABLE;
387                         break;
388                     case ICMP_UNREACH_SRCFAIL:
389                         ier->Status=IP_BAD_ROUTE;
390                         break;
391                     default:
392                         ier->Status=IP_DEST_NET_UNREACHABLE;
393                     }
394                     break;
395                 case ICMP_TIMXCEED:
396                     if (icmp_header->icmp_code==ICMP_TIMXCEED_REASS)
397                         ier->Status=IP_TTL_EXPIRED_REASSEM;
398                     else
399                         ier->Status=IP_TTL_EXPIRED_TRANSIT;
400                     break;
401                 case ICMP_PARAMPROB:
402                     ier->Status=IP_PARAM_PROBLEM;
403                     break;
404                 case ICMP_SOURCEQUENCH:
405                     ier->Status=IP_SOURCE_QUENCH;
406                     break;
407                 }
408                 if (ier->Status!=IP_REQ_TIMED_OUT) {
409                     struct ip* rep_ip_header;
410                     struct icmp* rep_icmp_header;
411                     /* The ICMP header size of all the packets we accept is the same */
412                     rep_ip_header=(struct ip*)(((char*)icmp_header)+ICMP_MINLEN);
413                     rep_icmp_header=(struct icmp*)(((char*)rep_ip_header)+(rep_ip_header->ip_hl << 2));
414
415                     /* Make sure that this is really a reply to our packet */
416                     if (ip_header_len+ICMP_MINLEN+(rep_ip_header->ip_hl << 2)+ICMP_MINLEN>ip_header->ip_len) {
417                         ier->Status=IP_REQ_TIMED_OUT;
418                     } else if ((rep_icmp_header->icmp_type!=ICMP_ECHO) ||
419                         (rep_icmp_header->icmp_code!=0) ||
420                         (rep_icmp_header->icmp_id!=id) ||
421                         /* windows doesn't check this checksum, else tracert */
422                         /* behind a Linux 2.2 masquerading firewall would fail*/
423                         /* (rep_icmp_header->icmp_cksum!=cksum) || */
424                         (rep_icmp_header->icmp_seq!=seq)) {
425                         /* This was not a reply to one of our packets after all */
426                         TRACE("skipping type,code=%d,%d id,seq=%d,%d cksum=%d\n",
427                             rep_icmp_header->icmp_type,rep_icmp_header->icmp_code,
428                             rep_icmp_header->icmp_id,rep_icmp_header->icmp_seq,
429                             rep_icmp_header->icmp_cksum);
430                         TRACE("expected type,code=8,0 id,seq=%d,%d cksum=%d\n",
431                             id,seq,
432                             cksum);
433                         ier->Status=IP_REQ_TIMED_OUT;
434                     }
435                 }
436             }
437         }
438
439         if (ier->Status==IP_REQ_TIMED_OUT) {
440             /* This packet was not for us.
441              * Decrease the timeout so that we don't enter an endless loop even
442              * if we get flooded with ICMP packets that are not for us.
443              */
444             DWORD t = (recv_time - send_time);
445             if (Timeout > t) Timeout -= t;
446             else             Timeout = 0;
447             continue;
448         } else {
449             /* This is a reply to our packet */
450             memcpy(&ier->Address,&ip_header->ip_src,sizeof(IPAddr));
451             /* Status is already set */
452             ier->RoundTripTime= recv_time - send_time;
453             ier->DataSize=res-ip_header_len-ICMP_MINLEN;
454             ier->Reserved=0;
455             ier->Data=endbuf-ier->DataSize;
456             memmove(ier->Data,((char*)ip_header)+ip_header_len+ICMP_MINLEN,ier->DataSize);
457             ier->Options.Ttl=ip_header->ip_ttl;
458             ier->Options.Tos=ip_header->ip_tos;
459             ier->Options.Flags=ip_header->ip_off >> 13;
460             ier->Options.OptionsSize=ip_header_len-sizeof(struct ip);
461             if (ier->Options.OptionsSize!=0) {
462                 ier->Options.OptionsData=(unsigned char *) ier->Data-ier->Options.OptionsSize;
463                 /* FIXME: We are supposed to rearrange the option's 'source route' data */
464                 memmove(ier->Options.OptionsData,((char*)ip_header)+ip_header_len,ier->Options.OptionsSize);
465                 endbuf=(char*)ier->Options.OptionsData;
466             } else {
467                 ier->Options.OptionsData=NULL;
468                 endbuf=ier->Data;
469             }
470
471             /* Prepare for the next packet */
472             ier++;
473             ip_header=(struct ip*)(((char*)ip_header)+sizeof(ICMP_ECHO_REPLY));
474             maxlen=endbuf-(char*)ip_header;
475
476             /* Check out whether there is more but don't wait this time */
477             Timeout=0;
478         }
479     }
480     res=ier-(ICMP_ECHO_REPLY*)ReplyBuffer;
481     if (res==0)
482         SetLastError(IP_REQ_TIMED_OUT);
483     TRACE("received %d replies\n",res);
484     return res;
485 }
486
487 /***********************************************************************
488  *              IcmpSendEcho2 (IPHLPAPI.@)
489  */
490 DWORD WINAPI IcmpSendEcho2(
491     HANDLE                   IcmpHandle,
492     HANDLE                   Event,
493     PIO_APC_ROUTINE          ApcRoutine,
494     PVOID                    ApcContext,
495     IPAddr                   DestinationAddress,
496     LPVOID                   RequestData,
497     WORD                     RequestSize,
498     PIP_OPTION_INFORMATION   RequestOptions,
499     LPVOID                   ReplyBuffer,
500     DWORD                    ReplySize,
501     DWORD                    Timeout
502     )
503 {
504     TRACE("(%p, %p, %p, %p, %08x, %p, %d, %p, %p, %d, %d): stub\n", IcmpHandle,
505             Event, ApcRoutine, ApcContext, DestinationAddress, RequestData,
506             RequestSize, RequestOptions, ReplyBuffer, ReplySize, Timeout);
507
508     if (Event)
509     {
510         FIXME("unsupported for events\n");
511         return 0;
512     }
513     if (ApcRoutine)
514     {
515         FIXME("unsupported for APCs\n");
516         return 0;
517     }
518     return IcmpSendEcho(IcmpHandle, DestinationAddress, RequestData,
519             RequestSize, RequestOptions, ReplyBuffer, ReplySize, Timeout);
520 }
521
522 /***********************************************************************
523  *              IcmpSendEcho2Ex (IPHLPAPI.@)
524  */
525 DWORD WINAPI IcmpSendEcho2Ex(
526     HANDLE                   IcmpHandle,
527     HANDLE                   Event,
528     PIO_APC_ROUTINE          ApcRoutine,
529     PVOID                    ApcContext,
530     IPAddr                   SourceAddress,
531     IPAddr                   DestinationAddress,
532     LPVOID                   RequestData,
533     WORD                     RequestSize,
534     PIP_OPTION_INFORMATION   RequestOptions,
535     LPVOID                   ReplyBuffer,
536     DWORD                    ReplySize,
537     DWORD                    Timeout
538     )
539 {
540     TRACE("(%p, %p, %p, %p, %08x, %08x, %p, %d, %p, %p, %d, %d): stub\n", IcmpHandle,
541             Event, ApcRoutine, ApcContext, SourceAddress, DestinationAddress, RequestData,
542             RequestSize, RequestOptions, ReplyBuffer, ReplySize, Timeout);
543
544     if (Event)
545     {
546         FIXME("unsupported for events\n");
547         return 0;
548     }
549     if (ApcRoutine)
550     {
551         FIXME("unsupported for APCs\n");
552         return 0;
553     }
554     if (SourceAddress)
555     {
556         FIXME("unsupported for source addresses\n");
557         return 0;
558     }
559
560     return IcmpSendEcho(IcmpHandle, DestinationAddress, RequestData,
561             RequestSize, RequestOptions, ReplyBuffer, ReplySize, Timeout);
562 }
563
564 /*
565  * Copyright (c) 1989 The Regents of the University of California.
566  * All rights reserved.
567  *
568  * This code is derived from software contributed to Berkeley by
569  * Mike Muuss.
570  *
571  * Redistribution and use in source and binary forms, with or without
572  * modification, are permitted provided that the following conditions
573  * are met:
574  * 1. Redistributions of source code must retain the above copyright
575  *    notice, this list of conditions and the following disclaimer.
576  * 2. Redistributions in binary form must reproduce the above copyright
577  *    notice, this list of conditions and the following disclaimer in the
578  *    documentation and/or other materials provided with the distribution.
579  * 3. Neither the name of the University nor the names of its contributors
580  *    may be used to endorse or promote products derived from this software
581  *    without specific prior written permission.
582  *
583  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
584  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
585  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
586  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
587  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
588  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
589  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
590  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
591  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
592  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
593  * SUCH DAMAGE.
594  *
595  */