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[] = "@(#)broadcast.c 1.4 (Berkeley) 11/16/85"; 9 #endif not lint 10 11 #include "globals.h" 12 #include <protocols/timed.h> 13 14 extern int sock; 15 extern struct sockaddr_in server; 16 17 /* 18 * `broadcast' broadcasts the given message on the local network 19 * at the broadcast address set in main.c 20 */ 21 22 broadcast(msg) 23 struct tsp *msg; 24 { 25 extern struct in_addr broadcastaddr; 26 27 msg->tsp_vers = TSPVERSION; 28 server.sin_addr = broadcastaddr; 29 if (sendto(sock, (char *)msg, sizeof(struct tsp), 0, 30 &server, sizeof(struct sockaddr_in)) < 0) { 31 syslog(LOG_ERR, "sendto: %m"); 32 exit(1); 33 } 34 } 35