2 Copyright 1989, 1998 The Open Group
4 Permission to use, copy, modify, distribute, and sell this software and its
5 documentation for any purpose is hereby granted without fee, provided that
6 the above copyright notice appear in all copies and that both that
7 copyright notice and this permission notice appear in supporting
10 The above copyright notice and this permission notice shall be included in
11 all copies or substantial portions of the Software.
13 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
17 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 Except as contained in this notice, the name of The Open Group shall not be
21 used in advertising or otherwise to promote the sale, use or other dealings
22 in this Software without prior written authorization from The Open Group.
24 * Author: Keith Packard, MIT X Consortium
36 #include <X11/Xdmcp.h>
43 #include <X11/Xwinsock.h>
45 #include <sys/socket.h>
50 XdmcpFill (int fd, XdmcpBufferPtr buffer, XdmcpNetaddr from, int *fromlen)
54 struct t_unitdata dataunit;
55 int gotallflag, result;
58 if (buffer->size < XDM_MAX_MSGLEN)
60 newBuf = (BYTE *) malloc(XDM_MAX_MSGLEN);
64 buffer->data = newBuf;
65 buffer->size = XDM_MAX_MSGLEN;
70 dataunit.addr.buf = from;
71 dataunit.addr.maxlen = *fromlen;
72 dataunit.opt.maxlen = 0; /* don't care to know about options */
73 dataunit.udata.buf = (char *)buffer->data;
74 dataunit.udata.maxlen = buffer->size;
75 result = t_rcvudata (fd, &dataunit, &gotallflag);
79 buffer->count = dataunit.udata.len;
80 *fromlen = dataunit.addr.len;
82 buffer->count = recvfrom (fd, (char*)buffer->data, buffer->size, 0,
83 (struct sockaddr *)from, (void *)fromlen);
85 if (buffer->count < 6) {