pf_mtag.h revision 284571
10SN/A/*	$FreeBSD: stable/10/sys/netpfil/pf/pf_mtag.h 284571 2015-06-18 20:34:39Z kp $	*/
2379SN/A/*
30SN/A * Copyright (c) 2001 Daniel Hartmeier
40SN/A * All rights reserved.
50SN/A *
60SN/A * Redistribution and use in source and binary forms, with or without
7157SN/A * modification, are permitted provided that the following conditions
80SN/A * are met:
9157SN/A *
100SN/A *    - Redistributions of source code must retain the above copyright
110SN/A *      notice, this list of conditions and the following disclaimer.
120SN/A *    - Redistributions in binary form must reproduce the above
130SN/A *      copyright notice, this list of conditions and the following
140SN/A *      disclaimer in the documentation and/or other materials provided
150SN/A *      with the distribution.
160SN/A *
170SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
180SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
190SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
200SN/A * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21157SN/A * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22157SN/A * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23157SN/A * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
240SN/A * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
250SN/A * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
260SN/A * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
270SN/A * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
280SN/A * POSSIBILITY OF SUCH DAMAGE.
290SN/A *
300SN/A */
310SN/A
320SN/A#ifndef _NET_PF_MTAG_H_
330SN/A#define _NET_PF_MTAG_H_
340SN/A
350SN/A#ifdef _KERNEL
360SN/A
370SN/A#define	PF_TAG_GENERATED		0x01
380SN/A#define	PF_TAG_FRAGCACHE		0x02
390SN/A#define	PF_TAG_TRANSLATE_LOCALHOST	0x04
400SN/A#define	PF_PACKET_LOOPED		0x08
410SN/A#define	PF_FASTFWD_OURS_PRESENT		0x10
420SN/A#define	PF_REASSEMBLED			0x20
430SN/A
440SN/Astruct pf_mtag {
450SN/A	void		*hdr;		/* saved hdr pos in mbuf, for ECN */
460SN/A	u_int32_t	 qid;		/* queue id */
470SN/A	u_int16_t	 tag;		/* tag id */
480SN/A	u_int8_t	 flags;
490SN/A	u_int8_t	 routed;
500SN/A};
510SN/A
520SN/Astatic __inline struct pf_mtag *
530SN/Apf_find_mtag(struct mbuf *m)
540SN/A{
550SN/A	struct m_tag	*mtag;
560SN/A
570SN/A	if ((mtag = m_tag_find(m, PACKET_TAG_PF, NULL)) == NULL)
580SN/A		return (NULL);
590SN/A
600SN/A	return ((struct pf_mtag *)(mtag + 1));
610SN/A}
620SN/A#endif /* _KERNEL */
630SN/A#endif /* _NET_PF_MTAG_H_ */
640SN/A