154359Sroberto/*
2182007Sroberto * /src/NTP/ntp4-dev/include/binio.h,v 4.5 2005/04/16 17:32:10 kardel RELEASE_20050508_A
354359Sroberto *
4182007Sroberto * binio.h,v 4.5 2005/04/16 17:32:10 kardel RELEASE_20050508_A
5182007Sroberto *
654359Sroberto * $Created: Sun Jul 20 13:03:05 1997 $
754359Sroberto *
8182007Sroberto * Copyright (c) 1997-2005 by Frank Kardel <kardel <AT> ntp.org>
9182007Sroberto *
10182007Sroberto * Redistribution and use in source and binary forms, with or without
11182007Sroberto * modification, are permitted provided that the following conditions
12182007Sroberto * are met:
13182007Sroberto * 1. Redistributions of source code must retain the above copyright
14182007Sroberto *    notice, this list of conditions and the following disclaimer.
15182007Sroberto * 2. Redistributions in binary form must reproduce the above copyright
16182007Sroberto *    notice, this list of conditions and the following disclaimer in the
17182007Sroberto *    documentation and/or other materials provided with the distribution.
18182007Sroberto * 3. Neither the name of the author nor the names of its contributors
19182007Sroberto *    may be used to endorse or promote products derived from this software
20182007Sroberto *    without specific prior written permission.
21182007Sroberto *
22182007Sroberto * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
23182007Sroberto * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24182007Sroberto * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25182007Sroberto * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
26182007Sroberto * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27182007Sroberto * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28182007Sroberto * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29182007Sroberto * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30182007Sroberto * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31182007Sroberto * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32182007Sroberto * SUCH DAMAGE.
33182007Sroberto *
3454359Sroberto */
3554359Sroberto#ifndef BINIO_H
3654359Sroberto#define BINIO_H
3754359Sroberto
3854359Sroberto#include "ntp_stdlib.h"
3954359Sroberto
40280849Scylong get_lsb_short (unsigned char **);
41280849Scyvoid put_lsb_short (unsigned char **, long);
42280849Scylong get_lsb_long (unsigned char **);
43280849Scyvoid put_lsb_long (unsigned char **, long);
4454359Sroberto
45282408Scy#define get_lsb_int16( _x_ )   ((int16_t) get_lsb_short( _x_ ))
46282408Scy#define get_lsb_uint16( _x_ )  ((uint16_t) get_lsb_short( _x_ ))
47282408Scy#define get_lsb_int32( _x_ )   ((int32_t) get_lsb_long( _x_ ))
48282408Scy#define get_lsb_uint32( _x_ )  ((uint32_t) get_lsb_long( _x_ ))
49282408Scy
50280849Scylong get_msb_short (unsigned char **);
51280849Scyvoid put_msb_short (unsigned char **, long);
52280849Scylong get_msb_long (unsigned char **);
53280849Scyvoid put_msb_long (unsigned char **, long);
5454359Sroberto
55282408Scy#define get_msb_int16( _x_ )   ((int16_t) get_msb_short( _x_ ))
56282408Scy#define get_msb_uint16( _x_ )  ((uint16_t) get_msb_short( _x_ ))
57282408Scy#define get_msb_int32( _x_ )   ((int32_t) get_msb_long( _x_ ))
58282408Scy#define get_msb_uint32( _x_ )  ((uint32_t) get_msb_long( _x_ ))
59282408Scy
6054359Sroberto#endif
6154359Sroberto/*
62182007Sroberto * History:
63182007Sroberto *
6454359Sroberto * binio.h,v
65182007Sroberto * Revision 4.5  2005/04/16 17:32:10  kardel
66182007Sroberto * update copyright
67182007Sroberto *
68182007Sroberto * Revision 4.4  2004/11/14 15:29:41  kardel
69182007Sroberto * support PPSAPI, upgrade Copyright to Berkeley style
70182007Sroberto *
7154359Sroberto * Revision 4.2  1998/06/28 16:52:15  kardel
7254359Sroberto * added binio MSB prototypes for {get,put}_msb_{short,long}
7354359Sroberto *
7454359Sroberto * Revision 4.1  1998/06/12 15:07:40  kardel
7554359Sroberto * fixed prototyping
7654359Sroberto *
7754359Sroberto * Revision 4.0  1998/04/10 19:50:38  kardel
7854359Sroberto * Start 4.0 release version numbering
7954359Sroberto *
8054359Sroberto * Revision 1.1  1998/04/10 19:27:32  kardel
8154359Sroberto * initial NTP VERSION 4 integration of PARSE with GPS166 binary support
8254359Sroberto *
8354359Sroberto * Revision 1.1  1997/10/06 20:55:37  kardel
8454359Sroberto * new parse structure
8554359Sroberto *
8654359Sroberto */
87