Lines Matching +full:ep +full:- +full:side

1 /*-
2 * SPDX-License-Identifier: BSD-3-Clause
12 * to css-dist@cs.utah.edu any improvements that they make and grant
62 static int BpfFd = -1;
67 ** BpfOpen -- Open and initialize a BPF device.
75 ** Side Effects:
116 syslog(LOG_ERR,"bpf: %s: data-link type %d unsupported", in BpfOpen()
169 { BPF_LD|BPF_B|BPF_ABS, 0, 0, (long)&RMP->hp_llc.dsap }, in BpfOpen()
171 { BPF_LD|BPF_H|BPF_ABS, 0, 0, (long)&RMP->hp_llc.cntrl }, in BpfOpen()
173 { BPF_LD|BPF_H|BPF_ABS, 0, 0, (long)&RMP->hp_llc.dxsap }, in BpfOpen()
193 ** BPF GetIntfName -- Return the name of a network interface attached to
199 ** errmsg - if no network interface found, *errmsg explains why.
204 ** Side Effects:
215 static char device[sizeof(ifrp->ifr_name)]; in BpfGetIntfName()
248 if ((ifrp->ifr_flags & IFF_UP) == 0 || in BpfGetIntfName()
250 (ifrp->ifr_flags & IFF_LOOPBACK)) in BpfGetIntfName()
252 (strcmp(ifrp->ifr_name, "lo0") == 0)) in BpfGetIntfName()
256 for (cp = ifrp->ifr_name; !isdigit(*cp); ++cp) in BpfGetIntfName()
271 (void) strcpy(device, mp->ifr_name); in BpfGetIntfName()
276 ** BpfRead -- Read packets from a BPF device and fill in `rconn'.
279 ** rconn - filled in with next packet.
280 ** doread - is True if we can issue a read() syscall.
285 ** Side Effects:
292 static u_int8_t *bp = NULL, *ep = NULL; in BpfRead() local
305 ep = BpfPkt + cc; in BpfRead()
314 if (bp < ep) { in BpfRead()
315 datlen = bhp->bh_datalen; in BpfRead()
316 caplen = bhp->bh_caplen; in BpfRead()
317 hdrlen = bhp->bh_hdrlen; in BpfRead()
327 rconn->rmplen = caplen; in BpfRead()
328 memmove((char *)&rconn->tstamp, (char *)&bhp->bh_tstamp, in BpfRead()
330 memmove((char *)&rconn->rmp, (char *)bp + hdrlen, caplen); in BpfRead()
341 ** BpfWrite -- Write packet to BPF device.
344 ** rconn - packet to send.
349 ** Side Effects:
355 if (write(BpfFd, (char *)&rconn->rmp, rconn->rmplen) < 0) { in BpfWrite()
364 ** BpfClose -- Close a BPF device.
372 ** Side Effects:
385 if (BpfFd == -1) in BpfClose()
397 BpfFd = -1; in BpfClose()