2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
24 * COMPONENT_NAME: austext
39 * (C) COPYRIGHT International Business Machines Corp. 1996
41 * Licensed Materials - Property of IBM
42 * US Government Users Restricted Rights - Use, duplication or
43 * disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
45 /********************* DBSWAB.H **********************************
46 * $XConsortium: dbswab.h /main/2 1996/10/28 14:00:06 drk $
48 * Header file for all internal vista byte swap modifications.
49 * The mods byte swap vista cache pages, dbd tables, etc,
50 * to ensure that database files are maintained in a canonical
51 * format no matter what machine they are used on.
52 * The DtSearch data records are byte swapped in code at the
53 * DtSearch level (dtsrswab.c, defns in SearchP.h).
54 * Byte swap is performed with the standard htonl, htons, ntohl,
55 * and ntohs network conversion functions for byte order neutrality.
56 * Canonical integer length is enforced with the typedefs
57 * LONG and INT in vista.h
58 * The external database files are in big-endian ("network") order.
59 * So that they can be defined as "null" macros on big endian machines,
60 * new functions (1) always byte swap in place, and (2) always succeed.
62 * An #include "vista.h" and #include "dbtype.h" must precede this include.
69 #include <sys/types.h>
70 #include <netinet/in.h>
72 /* Record number for OR_MISCREC DtSearch record */
73 #define MISCREC_RECNO 3
75 /* Direction of io to indicate correct byte swap function.
76 * HTON is host to network, internal RAM to external database file.
77 * NTOH is network to host, file to RAM.
79 typedef enum {HTON=1, NTOH} SWABDIR;
81 extern void swab_page (char *pgbuf, FILE_ENTRY *file_ptr, SWABDIR direction);
83 #ifdef BYTE_SWAP /* ie (BYTE_ORDER != BIG_ENDIAN) */
85 #define HTONL(x) x = htonl(x)
86 #define HTONS(x) x = htons(x)
87 #define NTOHL(x) x = ntohl(x)
88 #define NTOHS(x) x = ntohs(x)
90 #else /* !BYTE_SWAP, ie (BYTE_ORDER == BIG_ENDIAN) */
97 #endif /* BYTE_SWAP */
99 /******** debug stuff *******/
100 extern char *debug_keyslot_ptr;
101 extern void snap_dump (char *label, void *ptr, int len);
103 /********************* DBSWAB.H **********************************/
104 #endif /* _H_DBSWAB */