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

Defined variables

sccsid defined in line 8; never used
Last modified: 1986-05-20
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 595
Valid CSS Valid XHTML 1.0 Strict