1: /*
2: * Copyright (c) 1983 Regents of the University of California.
3: * All rights reserved. The Berkeley software License Agreement
4: * specifies the terms and conditions for redistribution.
5: */
6:
7: #ifndef lint
8: static char sccsid[] = "@(#)byteorder.c 2.4 (Berkeley) 5/20/86";
9: #endif not lint
10:
11: #include "globals.h"
12: #include <protocols/timed.h>
13:
14: /*
15: * Two routines to do the necessary byte swapping for timed protocol
16: * messages. Protocol is defined in /usr/include/protocols/timed.h
17: */
18:
19: bytenetorder(ptr)
20: struct tsp *ptr;
21: {
22: ptr->tsp_seq = htons((u_short)ptr->tsp_seq);
23: switch (ptr->tsp_type) {
24:
25: case TSP_SETTIME:
26: case TSP_ADJTIME:
27: case TSP_SETDATE:
28: case TSP_SETDATEREQ:
29: ptr->tsp_time.tv_sec = htonl((u_long)ptr->tsp_time.tv_sec);
30: ptr->tsp_time.tv_usec = htonl((u_long)ptr->tsp_time.tv_usec);
31: break;
32:
33: default:
34: break; /* nothing more needed */
35: }
36: }
37:
38: bytehostorder(ptr)
39: struct tsp *ptr;
40: {
41: ptr->tsp_seq = ntohs((u_short)ptr->tsp_seq);
42: switch (ptr->tsp_type) {
43:
44: case TSP_SETTIME:
45: case TSP_ADJTIME:
46: case TSP_SETDATE:
47: case TSP_SETDATEREQ:
48: ptr->tsp_time.tv_sec = ntohl((u_long)ptr->tsp_time.tv_sec);
49: ptr->tsp_time.tv_usec = ntohl((u_long)ptr->tsp_time.tv_usec);
50: break;
51:
52: default:
53: break; /* nothing more needed */
54: }
55: }
Defined functions
bytenetorder
defined in line
19; used 23 times
- in /usr/src/etc/timed/acksend.c line
55
- in /usr/src/etc/timed/candidate.c line
44
- in /usr/src/etc/timed/cmds.c line
26,
153,
241,
297
- in /usr/src/etc/timed/master.c line
84,
122,
484
- in /usr/src/etc/timed/readmsg.c line
285,
320,
356,
370,
383
- in /usr/src/etc/timed/slave.c line
34,
49,
135,
220,
238,
273,
306,
420,
486
Defined variables
sccsid
defined in line
8;
never used