3
"$Id: pkt.c,v 1.3 1997/06/27 17:32:32 pvmsrc Exp $";
6
* PVM version 3.4: Parallel Virtual Machine System
7
* University of Tennessee, Knoxville TN.
8
* Oak Ridge National Laboratory, Oak Ridge TN.
9
* Emory University, Atlanta GA.
10
* Authors: J. J. Dongarra, G. E. Fagg, M. Fischer
11
* G. A. Geist, J. A. Kohl, R. J. Manchek, P. Mucci,
12
* P. M. Papadopoulos, S. L. Scott, and V. S. Sunderam
13
* (C) 1997 All Rights Reserved
17
* Permission to use, copy, modify, and distribute this software and
18
* its documentation for any purpose and without fee is hereby granted
19
* provided that the above copyright notice appear in all copies and
20
* that both the copyright notice and this permission notice appear in
21
* supporting documentation.
23
* Neither the Institutions (Emory University, Oak Ridge National
24
* Laboratory, and University of Tennessee) nor the Authors make any
25
* representations about the suitability of this software for any
26
* purpose. This software is provided ``as is'' without express or
29
* PVM version 3 was funded in part by the U.S. Department of Energy,
30
* the National Science Foundation and the State of Tennessee.
39
* Revision 1.3 1997/06/27 17:32:32 pvmsrc
40
* Updated for WIN32 header files & Authors.
42
* Revision 1.2 1997/01/28 19:26:56 pvmsrc
43
* New Copyright Notice & Authors.
45
* Revision 1.1 1996/09/23 23:44:23 pvmsrc
48
* Revision 1.3 1995/07/24 18:27:24 manchek
49
* zero pk_cpos on create
51
* Revision 1.2 1994/06/03 20:38:20 manchek
54
* Revision 1.1 1993/08/30 23:26:49 manchek
74
extern void pvmbailout();
84
/*********************
87
*********************/
92
* Create a new pkt, not in a list.
93
* If len is nonzero, len bytes are allocated as data space.
94
* Else, the pkt has no data (is a master or will get data later).
96
* The following fields are uninitialized:
97
* pk_src, pk_dst, pk_flag, pk_tag, pk_ctx, pk_enc, pk_wid, pk_crc, pk_hostd,
98
* pk_seq, pk_ack, pk_rtv, pk_rta, pk_rto, pk_at, pk_nrt
103
int len; /* (max) buffer size or 0 */
107
if (!(pp = TALLOC(1, struct pkt, "pkt")))
110
BZERO((char*)pp, sizeof(struct pkt));
113
if (len) { /* slave pkt */
114
if (!(pp->pk_dat = pp->pk_buf = da_new(len))) {
120
pp->pk_link = pp->pk_rlink = 0;
122
} else { /* master */
123
pp->pk_dat = pp->pk_buf = 0;
124
pp->pk_link = pp->pk_rlink = pp;
127
pp->pk_tlink = pp->pk_trlink = 0;
131
pvmlogerror("pk_new() can't get memory\n");
133
return (struct pkt*)0;
141
struct pkt *pp2, *pp3;
143
if (pp->pk_buf) { /* slave pkt */
145
LISTDELETE(pp, pk_tlink, pk_trlink);
147
da_unref(pp->pk_buf);
149
} else { /* master pkt */
151
/* free all pkts in chain */
152
for (pp2 = pp->pk_link; pp2 != pp; pp2 = pp3) {
154
LISTDELETE(pp2, pk_link, pk_rlink);