Dss-networks C5468 Instrukcja Użytkownika Strona 38

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 46
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 37
GigMAC-CPCI-3U Network Interface Cards
Gig-CPCI-3U Gigabit Ethernet Switches Board and Driver Users Manual
DSS NETWORKS, INC. DocVersion: 1.2 Page: 38
A. Opening a socket for management API
int s;
s = socket (PF_INET, SOCK_STREAM, 0);
B. Create request block for driver ioctl
struct ifreq ifr;
int subCmd;
NpkUserCtl myIoc;
char myDataBuf[MAX_LINES * MAX_LINE_LEN];
/* set interface name */
strcpy (ifr.ifr_name, “eth1”);
/* set ioctl sub-type */
subCmd = DM_IOCTL_GET_STATS;
/* set command argument */
myIoc.arg1 = 0;
myIoc.dataItm = (u_int) myDataBuf;
ifr.ifr_data = (char *) &myIoc;
C. Issue ioctl command
/* issue ioctl to network driver */
err = ioctl (s, SIOCDEVPRIVATE + subCmd, &ifr);
D. Check and print results
if (err < 0)
{
/* perror (errno); */
usage ();
exit (1);
}
if (subCmd == DM_IOCTL_GET_TRC)
{
print_trace();
}
else
{
if ((subCmd != DM_IOCTL_SET_LOOP_MODE) &&
(subCmd != DM_IOCTL_PROG_EEPROM))
printf ("\n%s\n", myDataBuf);
}
IOCTL COMMAND SUB-TYPES
Przeglądanie stron 37
1 2 ... 33 34 35 36 37 38 39 40 41 42 43 44 45 46

Komentarze do niniejszej Instrukcji

Brak uwag