Lines Matching +full:ps +full:- +full:hold

2  * This code is derived from code formerly in pcap-dlpi.c, originally
5 * Mark Pizzolato <List-tcpdump-workers@subscriptions.pizzolato.net>,
11 * by pcap-[dlpi,libdlpi].c.
31 * large enough to hold a chunk.
39 * what the value used to be - there's no particular reason why it
67 #include "pcap-int.h"
78 pcap_stats_dlpi(pcap_t *p, struct pcap_stat *ps) in pcap_stats_dlpi() argument
80 struct pcap_dlpi *pd = p->priv; in pcap_stats_dlpi()
93 * the received-packet count). in pcap_stats_dlpi()
105 *ps = pd->stat; in pcap_stats_dlpi()
110 ps->ps_recv += ps->ps_drop; in pcap_stats_dlpi()
136 struct pcap_dlpi *pd = p->priv; in pcap_process_pkts()
160 * If so, return immediately - if we haven't read any in pcap_process_pkts()
161 * packets, clear the flag and return -2 to indicate in pcap_process_pkts()
167 if (p->break_loop) { in pcap_process_pkts()
169 p->break_loop = 0; in pcap_process_pkts()
170 return (-2); in pcap_process_pkts()
172 p->bp = bufp; in pcap_process_pkts()
173 p->cc = ep - bufp; in pcap_process_pkts()
184 pd->stat.ps_drop = sbp->sbh_drops; in pcap_process_pkts()
186 bufp += sbp->sbh_totlen; in pcap_process_pkts()
187 origlen = sbp->sbh_origlen; in pcap_process_pkts()
188 caplen = sbp->sbh_msglen; in pcap_process_pkts()
191 caplen = min(p->snapshot, len); in pcap_process_pkts()
195 ++pd->stat.ps_recv; in pcap_process_pkts()
196 if (pcapint_filter(p->fcode.bf_insns, pk, origlen, caplen)) { in pcap_process_pkts()
198 pkthdr.ts.tv_sec = sbp->sbh_timestamp.tv_sec; in pcap_process_pkts()
199 pkthdr.ts.tv_usec = sbp->sbh_timestamp.tv_usec; in pcap_process_pkts()
206 if (pkthdr.caplen > (bpf_u_int32)p->snapshot) in pcap_process_pkts()
207 pkthdr.caplen = (bpf_u_int32)p->snapshot; in pcap_process_pkts()
210 p->cc = ep - bufp; in pcap_process_pkts()
211 p->bp = bufp; in pcap_process_pkts()
218 p->cc = 0; in pcap_process_pkts()
223 * Process the mac type. Returns -1 if no matching mac type found, otherwise 0.
234 p->linktype = DLT_EN10MB; in pcap_process_mactype()
235 p->offset = 2; in pcap_process_mactype()
238 * link-layer-type list with DLT_EN10MB and DLT_DOCSIS, so in pcap_process_mactype()
243 * DOCSIS frames out on the wire inside the low-level in pcap_process_mactype()
246 p->dlt_list = (u_int *)malloc(sizeof(u_int) * 2); in pcap_process_mactype()
247 if (p->dlt_list == NULL) { in pcap_process_mactype()
248 pcapint_fmt_errmsg_for_errno(p->errbuf, PCAP_ERRBUF_SIZE, in pcap_process_mactype()
250 return (-1); in pcap_process_mactype()
252 p->dlt_list[0] = DLT_EN10MB; in pcap_process_mactype()
253 p->dlt_list[1] = DLT_DOCSIS; in pcap_process_mactype()
254 p->dlt_count = 2; in pcap_process_mactype()
258 p->linktype = DLT_FDDI; in pcap_process_mactype()
259 p->offset = 3; in pcap_process_mactype()
263 /* XXX - what about DL_TPB? Is that Token Bus? */ in pcap_process_mactype()
264 p->linktype = DLT_IEEE802; in pcap_process_mactype()
265 p->offset = 2; in pcap_process_mactype()
270 p->linktype = DLT_SUNATM; in pcap_process_mactype()
271 p->offset = 0; /* works for LANE and LLC encapsulation */ in pcap_process_mactype()
277 p->linktype = DLT_IPV4; in pcap_process_mactype()
278 p->offset = 0; in pcap_process_mactype()
284 p->linktype = DLT_IPV6; in pcap_process_mactype()
285 p->offset = 0; in pcap_process_mactype()
292 * XXX - DL_IPNET devices default to "raw IP" rather than in pcap_process_mactype()
300 p->linktype = DLT_RAW; in pcap_process_mactype()
301 p->offset = 0; in pcap_process_mactype()
306 snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "unknown mactype 0x%x", in pcap_process_mactype()
308 retv = -1; in pcap_process_mactype()
316 * Push and configure the buffer module. Returns -1 for error, otherwise 0.
324 /* Non-standard call to get the data nicely buffered. */ in pcap_conf_bufmod()
325 if (ioctl(p->fd, I_PUSH, "bufmod") != 0) { in pcap_conf_bufmod()
326 pcap_stream_err("I_PUSH bufmod", errno, p->errbuf); in pcap_conf_bufmod()
327 return (-1); in pcap_conf_bufmod()
332 strioctl(p->fd, SBIOCSSNAP, sizeof(ss), (char *)&ss) != 0) { in pcap_conf_bufmod()
333 pcap_stream_err("SBIOCSSNAP", errno, p->errbuf); in pcap_conf_bufmod()
334 return (-1); in pcap_conf_bufmod()
337 if (p->opt.immediate) { in pcap_conf_bufmod()
341 if (strioctl(p->fd, SBIOCSTIME, sizeof(to), (char *)&to) != 0) { in pcap_conf_bufmod()
342 pcap_stream_err("SBIOCSTIME", errno, p->errbuf); in pcap_conf_bufmod()
343 return (-1); in pcap_conf_bufmod()
347 if (p->opt.timeout != 0) { in pcap_conf_bufmod()
348 to.tv_sec = p->opt.timeout / 1000; in pcap_conf_bufmod()
349 to.tv_usec = (p->opt.timeout * 1000) % 1000000; in pcap_conf_bufmod()
350 if (strioctl(p->fd, SBIOCSTIME, sizeof(to), (char *)&to) != 0) { in pcap_conf_bufmod()
351 pcap_stream_err("SBIOCSTIME", errno, p->errbuf); in pcap_conf_bufmod()
352 return (-1); in pcap_conf_bufmod()
358 if (strioctl(p->fd, SBIOCSCHUNK, sizeof(chunksize), (char *)&chunksize) in pcap_conf_bufmod()
360 pcap_stream_err("SBIOCSCHUNKP", errno, p->errbuf); in pcap_conf_bufmod()
361 return (-1); in pcap_conf_bufmod()
370 * Allocate data buffer. Returns -1 if memory allocation fails, else 0.
375 p->bufsize = PKTBUFSIZE; in pcap_alloc_databuf()
376 p->buffer = malloc(p->bufsize + p->offset); in pcap_alloc_databuf()
377 if (p->buffer == NULL) { in pcap_alloc_databuf()
378 pcapint_fmt_errmsg_for_errno(p->errbuf, PCAP_ERRBUF_SIZE, in pcap_alloc_databuf()
380 return (-1); in pcap_alloc_databuf()
387 * Issue a STREAMS I_STR ioctl. Returns -1 on error, otherwise
397 str.ic_timout = -1; in strioctl()