home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / ip / ppp / dp-2.3 / dpd / callstat.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-12-22  |  1.8 KB  |  62 lines

  1. /*
  2.  * Copyright (c) 1992 Purdue University
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms are permitted
  6.  * provided that the above copyright notice and this paragraph are
  7.  * duplicated in all such forms and that any documentation,
  8.  * advertising materials, and other materials related to such
  9.  * distribution and use acknowledge that the software was developed
  10.  * by Purdue University.  The name of the University may not be used
  11.  * to endorse or promote products derived * from this software without
  12.  * specific prior written permission.
  13.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  14.  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  15.  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  16.  *
  17.  * Note: this copyright applies to portions of this software developed
  18.  * at Purdue beyond the software covered by the original copyright.
  19.  */
  20.  
  21. #include <sys/types.h>
  22. #include <sys/param.h>
  23. #include <sys/stream.h>
  24. #include <sys/ioctl.h>
  25. #include <sys/socket.h>
  26. #include <sys/wait.h>
  27. #include <sys/file.h>
  28. #include <sys/dir.h>
  29. #include <netinet/in.h>
  30. #include <netinet/in_systm.h>
  31. #include <netinet/ip.h>
  32. #include <net/if.h>
  33. #include "dp_str.h"
  34. #include "dpd.h"
  35. #include "dp.h"
  36.  
  37. /*
  38. **  Log that a call failed.
  39. */
  40. void
  41. if_callstat(rp, stat)
  42. REMOTE *rp;
  43. char stat;
  44. {
  45.     static char        WHERE[] = "if_callstat";
  46.     int            s;
  47.     struct ifreq    ifr;
  48.  
  49.     if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
  50.     d_log(DLOG_GENERAL, WHERE, "Can't create socket for \"%s\", %m",
  51.         rp->Device);
  52.     return;
  53.     }
  54.  
  55.     (void)strcpy(ifr.ifr_name, rp->Device);
  56.     ifr.ifr_data[0] = stat;
  57.     if (ioctl(s, SIOCICALLSTAT, (caddr_t)&ifr) < 0)
  58.     d_log(DLOG_GENERAL, WHERE, "Can't SIOCICALLSTAT on \"%s\", %m",
  59.         rp->Device);
  60.     (void)close(s);
  61. }
  62.