/usr/src/nat-rtsp-0.7+1.g2ea3cb6/netfilter_mime.h is in nat-rtsp-dkms 0.7+1.g2ea3cb6-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | /*
* MIME functions for netfilter modules. This file provides implementations
* for basic MIME parsing. MIME headers are used in many protocols, such as
* HTTP, RTSP, SIP, etc.
*
* gcc will warn for defined but unused functions, so we only include the
* functions requested. The following macros are used:
* NF_NEED_MIME_NEXTLINE nf_mime_nextline()
*/
#ifndef _NETFILTER_MIME_H
#define _NETFILTER_MIME_H
/* Only include these functions for kernel code. */
#ifdef __KERNEL__
#include <linux/ctype.h>
/*
* Given a buffer and length, advance to the next line and mark the current
* line. If the current line is empty, *plinelen will be set to zero. If
* not, it will be set to the actual line length (including CRLF).
*
* 'line' in this context means logical line (includes LWS continuations).
* Returns 1 on success, 0 on failure.
*/
#ifdef NF_NEED_MIME_NEXTLINE
static int
nf_mime_nextline(char* p, uint len, uint* poff, uint* plineoff, uint* plinelen)
{
uint off = *poff;
uint physlen = 0;
int is_first_line = 1;
if (off >= len)
{
return 0;
}
do
{
while (p[off] != '\n')
{
if (len-off <= 1)
{
return 0;
}
physlen++;
off++;
}
/* if we saw a crlf, physlen needs adjusted */
if (physlen > 0 && p[off] == '\n' && p[off-1] == '\r')
{
physlen--;
}
/* advance past the newline */
off++;
/* check for an empty line */
if (physlen == 0)
{
break;
}
/* check for colon on the first physical line */
if (is_first_line)
{
is_first_line = 0;
if (memchr(p+(*poff), ':', physlen) == NULL)
{
return 0;
}
}
}
while (p[off] == ' ' || p[off] == '\t');
*plineoff = *poff;
*plinelen = (physlen == 0) ? 0 : (off - *poff);
*poff = off;
return 1;
}
#endif /* NF_NEED_MIME_NEXTLINE */
#endif /* __KERNEL__ */
#endif /* _NETFILTER_MIME_H */
|