1*c15d59edSmickey /* $OpenBSD: extract.h,v 1.4 1996/07/13 11:01:09 mickey Exp $ */ 2df930be7Sderaadt 3df930be7Sderaadt /* 4*c15d59edSmickey * Copyright (c) 1992, 1993, 1994, 1995, 1996 5df930be7Sderaadt * The Regents of the University of California. All rights reserved. 6df930be7Sderaadt * 7df930be7Sderaadt * Redistribution and use in source and binary forms, with or without 8df930be7Sderaadt * modification, are permitted provided that: (1) source code distributions 9df930be7Sderaadt * retain the above copyright notice and this paragraph in its entirety, (2) 10df930be7Sderaadt * distributions including binary code include the above copyright notice and 11df930be7Sderaadt * this paragraph in its entirety in the documentation or other materials 12df930be7Sderaadt * provided with the distribution, and (3) all advertising materials mentioning 13df930be7Sderaadt * features or use of this software display the following acknowledgement: 14df930be7Sderaadt * ``This product includes software developed by the University of California, 15df930be7Sderaadt * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of 16df930be7Sderaadt * the University nor the names of its contributors may be used to endorse 17df930be7Sderaadt * or promote products derived from this software without specific prior 18df930be7Sderaadt * written permission. 19df930be7Sderaadt * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED 20df930be7Sderaadt * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 21df930be7Sderaadt * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 22df930be7Sderaadt * 23*c15d59edSmickey * @(#) Header: extract.h,v 1.12 96/06/20 18:48:42 leres Exp (LBL) 24df930be7Sderaadt */ 25df930be7Sderaadt 26*c15d59edSmickey #ifdef LBL_ALIGN 27df930be7Sderaadt #define EXTRACT_SHORT(p)\ 28df930be7Sderaadt ((u_short)\ 29*c15d59edSmickey ((u_short)*((u_char *)(p)+0)<<8|\ 30*c15d59edSmickey (u_short)*((u_char *)(p)+1)<<0)) 31df930be7Sderaadt #define EXTRACT_LONG(p)\ 32*c15d59edSmickey ((u_int32_t)*((u_char *)(p)+0)<<24|\ 33*c15d59edSmickey (u_int32_t)*((u_char *)(p)+1)<<16|\ 34*c15d59edSmickey (u_int32_t)*((u_char *)(p)+2)<<8|\ 35*c15d59edSmickey (u_int32_t)*((u_char *)(p)+3)<<0) 36df930be7Sderaadt #else 37*c15d59edSmickey #define EXTRACT_SHORT(p) ((u_short)ntohs(*(u_short *)(p))) 38*c15d59edSmickey #define EXTRACT_LONG(p) (ntohl(*(u_int32_t *)(p))) 39df930be7Sderaadt #endif 40