This file is indexed.

/usr/include/dpm/marshall.h is in libdpm-dev 1.8.10-1build3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
/*
 * $Id: marshall.h,v 1.1.1.1 2004/01/21 09:19:34 baud Exp $
 */

/*
 * @(#)$RCSfile: marshall.h,v $ $Revision: 1.1.1.1 $ $Date: 2004/01/21 09:19:34 $ CERN IT-PDP/DM  Fabrizio Cane
 */

/*
 * Copyright (C) 1990-2002 by CERN/IT/PDP/DM
 * All rights reserved
 */

/*  marshall.h   -   marshalling/unmarshalling definitions */

#ifndef _MARSHALL_H_INCLUDED_
#define _MARSHALL_H_INCLUDED_

#include <osdep.h>              /* Operating system dependencies        */
#include <memory.h>             /* memory operations definition         */
#include <time.h>
#include <arpa/inet.h>

#define SHORT			WORD
/* #define U_SHORT			U_WORD */
#define SHORTSIZE		WORDSIZE
#define SHORTADDR		WORDADDR

#define marshall_WORD		marshall_SHORT
#define unmarshall_WORD		unmarshall_SHORT		
#define unmarshall_NWORD		unmarshall_NSHORT

#define INC_PTR(ptr,n)		(ptr) = (char*)(ptr) + (n)
#define DIFF_PTR(ptr,base)      (char*)(ptr) - (char*)(base)

/*
 * BIT manipulation
 */

#define  BITSOFBYTE     8       /* number of bits in a byte             */

#define  bitsof(t)      sizeof(t)*BITSOFBYTE /* number of bits in a type*/

typedef  char*          bitvct; /* bit vector type definition           */

/*
 * Allocate enough memory for a 'bitvct' type variable containing
 * 'size' bits
 */

#define  bitalloc(size)		(bitvct)malloc(size/BITSOFBYTE + \
				((size%BITSOFBYTE) ? 1 : 0))

/*
 *  Set the bit 'bit-th' starting from the byte pointed to by 'ptr'
 */

#define  BIT_SET(ptr,bit)	{ char *p = (char*)(ptr) + (bit)/8; \
				  *p = *p | (1 << (7-(bit)%8)) ; \
				}

/*
 *  Clear the bit 'bit-th' starting from the byte pointed to by 'ptr'
 */

#define  BIT_CLR(ptr,bit)	{ char *p = (char*)(ptr) + (bit)/8; \
				  *p = *p & ~(1 << (7-(bit)%8)); \
				}

/*
 *  Test the bit 'bit-th' starting from the byte pointed to by 'ptr'
 */

#define  BIT_ISSET(ptr,bit)	(*(char*)((char*)(ptr)+(bit)/8) & (1 << (7-(bit)%8)))


/*
 *    B Y T E
 */

#define marshall_BYTE(ptr,n)	{ BYTE n_ = n; \
				  (void) memcpy((ptr),BYTEADDR(n_),BYTESIZE); \
				  INC_PTR(ptr,BYTESIZE); \
				} 

#define unmarshall_BYTE(ptr,n)  { BYTE n_; \
				  (void) memcpy(BYTEADDR(n_),(ptr),BYTESIZE); \
				  n = n_; \
				  INC_PTR(ptr,BYTESIZE); \
				} 

static inline BYTE _unmarshall_NBYTE(ptr, end)
char **ptr;
char *end;
{
	BYTE n;
	if (*ptr > end)
		return (0);
	if (end - *ptr < BYTESIZE) {
		*ptr = NULL;
		return (0);
	}
	unmarshall_BYTE(*ptr,n);
	return (n);
}
#define unmarshall_NBYTE(ptr,end,n) ((n)=_unmarshall_NBYTE(&(ptr),end),\
                                     ((ptr)==NULL)?((ptr)=(end),-1):(((ptr)>(end))?-1:0))

/*
 *    S H O R T
 */

#define marshall_SHORT(ptr,n)	{ SHORT n_ = htons((unsigned short)(n)); \
				  (void) memcpy((ptr),SHORTADDR(n_),SHORTSIZE); \
				  INC_PTR(ptr,SHORTSIZE); \
				}
                                                                 
#define unmarshall_SHORT(ptr,n)	{ SHORT n_ = 0;  \
				  (void) memcpy(SHORTADDR(n_),(ptr),SHORTSIZE); \
                                  n = ntohs((unsigned short)(n_)); \
				  if ( BIT_ISSET(ptr,0) && sizeof(SHORT)-SHORTSIZE > 0 ) \
					 (void) memset((char *)&n,255,sizeof(SHORT)-SHORTSIZE); \
				  INC_PTR(ptr,SHORTSIZE); \
				}

static inline SHORT _unmarshall_NSHORT(ptr, end)
char **ptr;
char *end;
{
	SHORT n;
	if (*ptr > end)
		return (0);
	if (end - *ptr < SHORTSIZE) {
		*ptr = NULL;
		return (0);
	}
	unmarshall_SHORT(*ptr,n);
	return (n);
}
#define unmarshall_NSHORT(ptr,end,n) ((n)=_unmarshall_NSHORT(&(ptr),end),\
                                      ((ptr)==NULL)?((ptr)=(end),-1):(((ptr)>(end))?-1:0))

/*
 *    L O N G
 */

#define marshall_LONG(ptr,n)	{ LONG n_ = htonl((unsigned long)(n)); \
				  (void) memcpy((ptr),LONGADDR(n_),LONGSIZE); \
				  INC_PTR(ptr,LONGSIZE); \
				}
                                                                 
#define unmarshall_LONG(ptr,n)	{ LONG n_ = 0;  \
				  (void) memcpy(LONGADDR(n_),(ptr),LONGSIZE); \
                                  n = ntohl((unsigned long)(n_)); \
				  if ( BIT_ISSET(ptr,0) && sizeof(LONG)-LONGSIZE > 0 ) \
					 (void) memset((char *)&n,255,sizeof(LONG)-LONGSIZE); \
				  INC_PTR(ptr,LONGSIZE); \
				}

static inline LONG _unmarshall_NLONG(ptr, end)
char **ptr;
char *end;
{
	LONG n;
	if (*ptr > end)
		return (0);
	if (end - *ptr < LONGSIZE) {
		*ptr = NULL;
		return (0);
	}
	unmarshall_LONG(*ptr,n);
	return (n);
}
#define unmarshall_NLONG(ptr,end,n) ((n)=_unmarshall_NLONG(&(ptr),end),\
                                     ((ptr)==NULL)?((ptr)=(end),-1):(((ptr)>(end))?-1:0))

/*
 *    S T R I N G
 */

#define  marshall_STRING(ptr,str)       {  (void) strcpy((char*)(ptr),(char*)(str)); \
					   INC_PTR(ptr,strlen(str)+1); \
					}

#define  unmarshall_STRING(ptr,str)     { (void) strcpy((char*)(str),(char*)(ptr)); \
					  INC_PTR(ptr,strlen(str)+1); \
					}

EXTERN_C int DLL_DECL _unmarshall_STRINGN _PROTO((char **, char*, int));
EXTERN_C int DLL_DECL _unmarshall_NSTRINGN _PROTO((char **, char*, char *, int));
#define  unmarshall_STRINGN(ptr,str,n)  _unmarshall_STRINGN(&ptr, str, n)
#define  unmarshall_NSTRINGN(ptr,end,str,n)  _unmarshall_NSTRINGN(&ptr, end, str, n)

/*
 *    H Y P E R   ( 6 4   B I T S )
 */

#if !defined(__alpha) && !defined(i386) && !defined(_WIN32) && !defined(__ia64__) && !defined(__x86_64)
#define  marshall_HYPER(ptr,n)          { U_HYPER u_ = n; \
					  LONG n_ = htonl(*((unsigned long *)&(u_))); \
					  (void) memcpy((ptr),LONGADDR(n_),LONGSIZE); \
					  INC_PTR(ptr,LONGSIZE); \
					  n_ = htonl(*((unsigned long *)((char *)&(u_)+LONGSIZE))); \
					  (void) memcpy((ptr),LONGADDR(n_),LONGSIZE); \
					  INC_PTR(ptr,LONGSIZE); \
					}

#define  unmarshall_HYPER(ptr,n)        { U_HYPER u_; \
					  LONG n_ = 0;  \
					  (void) memcpy(LONGADDR(n_),(ptr),LONGSIZE); \
					  *((LONG *)&(u_)) = ntohl((unsigned long)(n_)); \
					  INC_PTR(ptr,LONGSIZE); \
					  n_ = 0;  \
					  (void) memcpy(LONGADDR(n_),(ptr),LONGSIZE); \
					  *((LONG *)((char *)&(u_)+LONGSIZE)) = \
						ntohl((unsigned long)(n_)); \
					  INC_PTR(ptr,LONGSIZE); \
					  n = u_; \
					}
#else
#define  marshall_HYPER(ptr,n)          { U_HYPER u_ = n; \
					  LONG n_ = htonl(*((U_LONG *)((char *)&(u_)+LONGSIZE))); \
					  (void) memcpy((ptr),LONGADDR(n_),LONGSIZE); \
					  INC_PTR(ptr,LONGSIZE); \
					  n_ = htonl(*((U_LONG *)&(u_))); \
					  (void) memcpy((ptr),LONGADDR(n_),LONGSIZE); \
					  INC_PTR(ptr,LONGSIZE); \
					}

#define  unmarshall_HYPER(ptr,n)        { U_HYPER u_; \
					  LONG n_ = 0;  \
					  (void) memcpy(LONGADDR(n_),(ptr),LONGSIZE); \
					  *((LONG *)((char *)&(u_)+LONGSIZE)) = \
						ntohl((U_LONG)(n_)); \
					  INC_PTR(ptr,LONGSIZE); \
					  n_ = 0;  \
					  (void) memcpy(LONGADDR(n_),(ptr),LONGSIZE); \
					  *((LONG *)&(u_)) = ntohl((U_LONG)(n_)); \
					  INC_PTR(ptr,LONGSIZE); \
					  n = u_; \
					}
#endif

static inline U_HYPER _unmarshall_NHYPER(ptr, end)
char **ptr;
char *end;
{
	U_HYPER n;
	if (*ptr > end)
		return (0);
	if (end - *ptr < 2*LONGSIZE) {
		*ptr = NULL;
		return (0);
	}
	unmarshall_HYPER(*ptr,n);
	return (n);
}
#define unmarshall_NHYPER(ptr,end,n) ((n)=_unmarshall_NHYPER(&(ptr),end),\
                                      ((ptr)==NULL)?((ptr)=(end),-1):(((ptr)>(end))?-1:0))

/*
 *    O P A Q U E
 */

#define marshall_OPAQUE(ptr,raw,n)	{ (void) memcpy((ptr),(raw),(n)); \
					  INC_PTR(ptr,(n)); \
					}

#define unmarshall_OPAQUE(ptr,raw,n)	{ (void) memcpy((raw),(ptr),(n)); \
					  INC_PTR(ptr,(n)); \
					}

/*
 *    T I M E
 */

#define  marshall_TIME_T(ptr,n)       {  \
					   TIME_T _marshall_time_dummy = (TIME_T) n; \
					   marshall_HYPER(ptr,_marshall_time_dummy); \
					}

#define  unmarshall_TIME_T(ptr,n)     { \
					   TIME_T _unmarshall_time_dummy; \
					   unmarshall_HYPER(ptr,_unmarshall_time_dummy); \
					   n = (time_t) _unmarshall_time_dummy; \
					}

static inline TIME_T _unmarshall_NTIME_T(ptr, end)
char **ptr;
char *end;
{ 
	TIME_T n;
	if (*ptr > end)
		return (0);
	if (end - *ptr < 2*LONGSIZE) {
		*ptr = NULL;
		return (0);
	}
	unmarshall_TIME_T(*ptr,n);
	return (n);
}
#define unmarshall_NTIME_T(ptr,end,n) ((n)=_unmarshall_NTIME_T(&(ptr),end),\
                                       ((ptr)==NULL)?((ptr)=(end),-1):(((ptr)>(end))?-1:0))

#endif /* _MARSHALL_H_INCLUDED_ */