/* apesend.c */ /* Send a file to a particular lc */ #include #include #include #include "atmdd.h" char buf[XB_SIZE]; main( int argc, char **argv) { int in; int fd; int len; int vci; int rc; int blk; int lc; int psr = 1; blk = 1024 - 40; fd = open("/dev/ape25", O_RDWR); if (fd < 0) { printf("Fd = %d errno = %d \n", fd, errno); exit(1); } if (argc < 2) { printf("This sends stdin to the vci specified. \n"); printf("You must give vci number in decimal as parm 1. \n"); printf("You may give frame size in decimal as parm 2. \n"); printf("You may give the psr in decimal as parm 3. \n"); exit(1); } sscanf(argv[1], "%d", &vci); if (argc > 2) sscanf(argv[2], "%d", &blk); if (argc > 3) sscanf(argv[3], "%d", &psr); lc = ape_createlc(fd, vci); ape_lccfg(fd, vci, psr, 4096); printf("Sending to vci %d \n", vci); printf("Frame size %d bytes \n", blk); printf("PSR is %d \n", psr); while ((len = read(0, buf, blk)) > 0) { rc = ape_send(fd, vci, buf, len); if (rc) { printf("Send returned %d \n", rc); break; } } }