HP rp5450 HP DLPI Programmer's Guide - Page 185
operation = GET_MTU
View all HP rp5450 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 185 highlights
Sample Programs ioctl Example dl_attach_req_tdl_attach_req; /* Do validations on the parameters that are are passed by the user. */ if (argc < 3) { printf("USAGE: %s [get_mtu | set_mtu ] PPA \n", argv[0]); exit(1); } if (!strcmp("set_mtu", argv[1])) { if(argc != 4) { printf("USAGE: %s [get_mtu | set_mtu ] PPA \n", argv[0]); exit(1); } else { set_mtu_value = atoi(argv[2]); ppa = atoi(argv[3]); } operation = SET_MTU; } else if (!strcmp("get_mtu", argv[1])) { ppa = atoi(argv[2]); operation = GET_MTU; } /* Open the DLPI device file */ if((fd = open("/dev/dlpi", O_RDWR)) == -1) { printf("error:open failed, errno = %d\n", errno); exit(1); } /* Attach to the PPA */ dl_attach_req.dl_primitive = DL_ATTACH_REQ; dl_attach_req.dl_ppa = ppa; ctlbuf.len = sizeof (dl_attach_req); ctlbuf.buf = (char *) &dl_attach_req; flags = RS_HIPRI; printf("Sending a DL_ATTACH_REQ primitive\n"); if (putmsg(fd, &ctlbuf, (struct strbuf*) NULL, flags) < 0) perror("main: putmsg"); ctlbuf.buf = buf_ctl; ctlbuf.maxlen = 1000; /* Get the acknowledgement */ Appendix A 185