xref: /freebsd/sys/net/bpf_zerocopy.h (revision a7a91e6592c9ea0d730b460af5753ea82f572843)
14d621040SChristian S.J. Peron /*-
24d621040SChristian S.J. Peron  * Copyright (c) 2007 Seccuris Inc.
34d621040SChristian S.J. Peron  * All rights reserved.
44d621040SChristian S.J. Peron  *
54d621040SChristian S.J. Peron  * This sofware was developed by Robert N. M. Watson under contract to
64d621040SChristian S.J. Peron  * Seccuris Inc.
74d621040SChristian S.J. Peron  *
84d621040SChristian S.J. Peron  * Redistribution and use in source and binary forms, with or without
94d621040SChristian S.J. Peron  * modification, are permitted provided that the following conditions
104d621040SChristian S.J. Peron  * are met:
114d621040SChristian S.J. Peron  * 1. Redistributions of source code must retain the above copyright
124d621040SChristian S.J. Peron  *    notice, this list of conditions and the following disclaimer.
134d621040SChristian S.J. Peron  * 2. Redistributions in binary form must reproduce the above copyright
144d621040SChristian S.J. Peron  *    notice, this list of conditions and the following disclaimer in the
154d621040SChristian S.J. Peron  *    documentation and/or other materials provided with the distribution.
164d621040SChristian S.J. Peron  *
174d621040SChristian S.J. Peron  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
184d621040SChristian S.J. Peron  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
194d621040SChristian S.J. Peron  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
204d621040SChristian S.J. Peron  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
214d621040SChristian S.J. Peron  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
224d621040SChristian S.J. Peron  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
234d621040SChristian S.J. Peron  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
244d621040SChristian S.J. Peron  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
254d621040SChristian S.J. Peron  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
264d621040SChristian S.J. Peron  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
274d621040SChristian S.J. Peron  * SUCH DAMAGE.
284d621040SChristian S.J. Peron  *
294d621040SChristian S.J. Peron  * $FreeBSD$
304d621040SChristian S.J. Peron  */
314d621040SChristian S.J. Peron 
324d621040SChristian S.J. Peron #ifndef _NET_BPF_ZEROCOPY_H_
334d621040SChristian S.J. Peron #define	_NET_BPF_ZEROCOPY_H_
344d621040SChristian S.J. Peron 
354d621040SChristian S.J. Peron #ifndef _KERNEL
364d621040SChristian S.J. Peron #error "no user-serviceable parts inside"
374d621040SChristian S.J. Peron #endif
384d621040SChristian S.J. Peron 
394d621040SChristian S.J. Peron void	bpf_zerocopy_append_bytes(struct bpf_d *d, caddr_t buf, u_int offset,
404d621040SChristian S.J. Peron 	    void *src, u_int len);
414d621040SChristian S.J. Peron void	bpf_zerocopy_append_mbuf(struct bpf_d *d, caddr_t buf, u_int offset,
424d621040SChristian S.J. Peron 	    void *src, u_int len);
43a7a91e65SRobert Watson void	bpf_zerocopy_buffull(struct bpf_d *);
444d621040SChristian S.J. Peron void	bpf_zerocopy_bufheld(struct bpf_d *);
454d621040SChristian S.J. Peron int	bpf_zerocopy_canfreebuf(struct bpf_d *);
46a7a91e65SRobert Watson int	bpf_zerocopy_canwritebuf(struct bpf_d *);
474d621040SChristian S.J. Peron void	bpf_zerocopy_free(struct bpf_d *d);
484d621040SChristian S.J. Peron int	bpf_zerocopy_ioctl_getzmax(struct thread *td, struct bpf_d *d,
494d621040SChristian S.J. Peron 	    size_t *i);
504d621040SChristian S.J. Peron int	bpf_zerocopy_ioctl_rotzbuf(struct thread *td, struct bpf_d *d,
514d621040SChristian S.J. Peron 	    struct bpf_zbuf *bz);
524d621040SChristian S.J. Peron int	bpf_zerocopy_ioctl_setzbuf(struct thread *td, struct bpf_d *d,
534d621040SChristian S.J. Peron 	    struct bpf_zbuf *bz);
544d621040SChristian S.J. Peron 
554d621040SChristian S.J. Peron #endif /* !_NET_BPF_ZEROCOPY_H_ */
56