home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume20 / etherlib / part01 / src / dliself.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-10-24  |  1.4 KB  |  57 lines

  1. /* $Id: dliself.c,v 2.0 89/10/20 19:01:55 dupuy Exp $ */
  2.  
  3. #include <sys/param.h>            /* NOFILE */
  4. #include <sys/socket.h>            /* sockaddr_dl (sockaddr) */
  5.  
  6. #include <net/if.h>            /* (ether_header) (ifnet) */
  7. #include <netinet/in.h>            /* (ether_header) (in_addr) */
  8. #include <netinet/if_ether.h>        /* sockaddr_dl (ether_header) */
  9. #include <netdnet/dli_var.h>        /* sockaddr_dl */
  10.  
  11. extern struct sockaddr_dl _ether_sockaddrs[NOFILE];
  12.  
  13. #define sad (_ether_sockaddrs[fd])
  14.  
  15. /*
  16.  * Most, but not all, VAX interfaces, loopback packets.     The Ultrix drivers
  17.  * for the rest try (with varying degrees of success) to compensate for that
  18.  * as far as broadcast packets go.  The ec (3com) driver does it only for IP
  19.  * packets, and does not support multicast, and seems to be unsupported by
  20.  * DEC.
  21.  */
  22.  
  23. static char *softloops[] = {"ec", "qe", "se"};
  24.  
  25. int
  26. ether_send_self (fd)
  27. int fd;
  28. {
  29.     unsigned char *devname = sad.dli_device.dli_devname;
  30.     int i;
  31.  
  32.     for (i = 0; i < sizeof (softloops) / sizeof (softloops[0]); i++)
  33.     if (!strcmp ((char *) devname, softloops[i]))
  34.         return (0);
  35.  
  36.     return (1);                /* default to true */
  37. }
  38.  
  39. int
  40. ether_mcast_self (fd)
  41. int fd;
  42. {
  43.     return (ether_send_self (fd));
  44. }
  45.  
  46. int
  47. ether_bcast_self (fd)
  48. int fd;
  49. {
  50.     unsigned char *devname = sad.dli_device.dli_devname;
  51.  
  52.     if (!strcmp ((char *) devname, "ec"))
  53.     return (0);            /* the ec driver is broken... */
  54.  
  55.     return (1);                /* default to true */
  56. }
  57.