ping.c revision 266e564d
1/* $Xorg: ping.c,v 1.4 2001/02/09 02:03:26 xorgcvs Exp $ */
2/******************************************************************************
3
4
5Copyright 1993, 1998  The Open Group
6
7Permission to use, copy, modify, distribute, and sell this software and its
8documentation for any purpose is hereby granted without fee, provided that
9the above copyright notice appear in all copies and that both that
10copyright notice and this permission notice appear in supporting
11documentation.
12
13The above copyright notice and this permission notice shall be included in
14all copies or substantial portions of the Software.
15
16THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
19OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
23Except as contained in this notice, the name of The Open Group shall not be
24used in advertising or otherwise to promote the sale, use or other dealings
25in this Software without prior written authorization from The Open Group.
26
27Author: Ralph Mor, X Consortium
28******************************************************************************/
29
30#ifdef HAVE_CONFIG_H
31#include <config.h>
32#endif
33#include <X11/ICE/ICElib.h>
34#include "ICElibint.h"
35
36Status
37IcePing (iceConn, pingReplyProc, clientData)
38
39IceConn		 iceConn;
40IcePingReplyProc pingReplyProc;
41IcePointer	 clientData;
42
43{
44    _IcePingWait *newping = (_IcePingWait *) malloc (sizeof (_IcePingWait));
45    _IcePingWait *ptr = iceConn->ping_waits;
46
47    if (newping == NULL)
48	return (0);
49
50    newping->ping_reply_proc = pingReplyProc;
51    newping->client_data = clientData;
52    newping->next = NULL;
53
54    while (ptr && ptr->next)
55	ptr = ptr->next;
56
57    if (ptr == NULL)
58	iceConn->ping_waits = newping;
59    else
60	ptr->next = newping;
61
62    IceSimpleMessage (iceConn, 0, ICE_Ping);
63    IceFlush (iceConn);
64
65    return (1);
66}
67