mirror of
git://git.code.sf.net/p/xtables-addons/xtables-addons
synced 2025-09-09 14:14:58 +02:00
ipp2p: adhere to codingstyle
This commit is contained in:
@@ -7,26 +7,25 @@
|
|||||||
#include <xtables.h>
|
#include <xtables.h>
|
||||||
#include "xt_ipp2p.h"
|
#include "xt_ipp2p.h"
|
||||||
|
|
||||||
static void
|
static void ipp2p_mt_help(void)
|
||||||
help(void)
|
|
||||||
{
|
{
|
||||||
printf(
|
printf(
|
||||||
"IPP2P v%s options:\n"
|
"IPP2P v%s options:\n"
|
||||||
" --ipp2p Grab all known p2p packets\n"
|
" --ipp2p Grab all known p2p packets\n"
|
||||||
" --edk [TCP&UDP] All known eDonkey/eMule/Overnet packets\n"
|
" --edk [tcp,udp] All known eDonkey/eMule/Overnet packets\n"
|
||||||
" --dc [TCP] All known Direct Connect packets\n"
|
" --dc [tcp] All known Direct Connect packets\n"
|
||||||
" --kazaa [TCP&UDP] All known KaZaA packets\n"
|
" --kazaa [tcp,udp] All known KaZaA packets\n"
|
||||||
" --gnu [TCP&UDP] All known Gnutella packets\n"
|
" --gnu [tcp,udp] All known Gnutella packets\n"
|
||||||
" --bit [TCP&UDP] All known BitTorrent packets\n"
|
" --bit [tcp,udp] All known BitTorrent packets\n"
|
||||||
" --apple [TCP] All known AppleJuice packets\n"
|
" --apple [tcp] All known AppleJuice packets\n"
|
||||||
" --winmx [TCP] All known WinMX\n"
|
" --winmx [tcp] All known WinMX\n"
|
||||||
" --soul [TCP] All known SoulSeek\n"
|
" --soul [tcp] All known SoulSeek\n"
|
||||||
" --ares [TCP] All known Ares\n\n"
|
" --ares [tcp] All known Ares\n\n"
|
||||||
" EXPERIMENTAL protocols (please send feedback to: ipp2p@ipp2p.org) :\n"
|
"EXPERIMENTAL protocols (please send feedback to: ipp2p@ipp2p.org) :\n"
|
||||||
" --mute [TCP] All known Mute packets\n"
|
" --mute [tcp] All known Mute packets\n"
|
||||||
" --waste [TCP] All known Waste packets\n"
|
" --waste [tcp] All known Waste packets\n"
|
||||||
" --xdcc [TCP] All known XDCC packets (only xdcc login)\n\n"
|
" --xdcc [tcp] All known XDCC packets (only xdcc login)\n\n"
|
||||||
" DEBUG SUPPPORT, use only if you know why\n"
|
"DEBUG SUPPPORT, use only if you know why\n"
|
||||||
" --debug Generate kernel debug output, THIS WILL SLOW DOWN THE FILTER\n"
|
" --debug Generate kernel debug output, THIS WILL SLOW DOWN THE FILTER\n"
|
||||||
"\nNote that the follwing options will have the same meaning:\n"
|
"\nNote that the follwing options will have the same meaning:\n"
|
||||||
" '--ipp2p' is equal to '--edk --dc --kazaa --gnu --bit --apple --winmx --soul --ares'\n"
|
" '--ipp2p' is equal to '--edk --dc --kazaa --gnu --bit --apple --winmx --soul --ares'\n"
|
||||||
@@ -40,7 +39,7 @@ help(void)
|
|||||||
, IPP2P_VERSION);
|
, IPP2P_VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct option opts[] = {
|
static struct option ipp2p_mt_opts[] = {
|
||||||
{ "ipp2p", 0, 0, '1' },
|
{ "ipp2p", 0, 0, '1' },
|
||||||
{ "edk", 0, 0, '2' },
|
{ "edk", 0, 0, '2' },
|
||||||
{ "dc", 0, 0, '7' },
|
{ "dc", 0, 0, '7' },
|
||||||
@@ -55,13 +54,11 @@ static struct option opts[] = {
|
|||||||
{ "waste", 0, 0, 'h' },
|
{ "waste", 0, 0, 'h' },
|
||||||
{ "xdcc", 0, 0, 'i' },
|
{ "xdcc", 0, 0, 'i' },
|
||||||
{ "debug", 0, 0, 'j' },
|
{ "debug", 0, 0, 'j' },
|
||||||
{0}
|
{0},
|
||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static int ipp2p_mt_parse(int c, char **argv, int invert, unsigned int *flags,
|
||||||
parse(int c, char **argv, int invert, unsigned int *flags,
|
const void *entry, struct xt_entry_match **match)
|
||||||
const void *entry,
|
|
||||||
struct xt_entry_match **match)
|
|
||||||
{
|
{
|
||||||
struct ipt_p2p_info *info = (struct ipt_p2p_info *)(*match)->data;
|
struct ipt_p2p_info *info = (struct ipt_p2p_info *)(*match)->data;
|
||||||
|
|
||||||
@@ -279,8 +276,7 @@ parse(int c, char **argv, int invert, unsigned int *flags,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void ipp2p_mt_check(unsigned int flags)
|
||||||
final_check(unsigned int flags)
|
|
||||||
{
|
{
|
||||||
if (!flags)
|
if (!flags)
|
||||||
exit_error(PARAMETER_PROBLEM,
|
exit_error(PARAMETER_PROBLEM,
|
||||||
@@ -288,77 +284,121 @@ final_check(unsigned int flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print(const void *ip,
|
ipp2p_mt_print(const void *entry, const struct xt_entry_match *match,
|
||||||
const struct xt_entry_match *match,
|
|
||||||
int numeric)
|
int numeric)
|
||||||
{
|
{
|
||||||
struct ipt_p2p_info *info = (struct ipt_p2p_info *)match->data;
|
struct ipt_p2p_info *info = (struct ipt_p2p_info *)match->data;
|
||||||
|
|
||||||
printf("ipp2p v%s", IPP2P_VERSION);
|
printf("ipp2p v%s", IPP2P_VERSION);
|
||||||
if ((info->cmd & SHORT_HAND_IPP2P) == SHORT_HAND_IPP2P) printf(" --ipp2p");
|
if ((info->cmd & SHORT_HAND_IPP2P) == SHORT_HAND_IPP2P)
|
||||||
// if ((info->cmd & SHORT_HAND_DATA) == SHORT_HAND_DATA) printf(" --ipp2p-data");
|
printf(" --ipp2p");
|
||||||
if ((info->cmd & IPP2P_KAZAA) == IPP2P_KAZAA) printf(" --kazaa");
|
/*
|
||||||
// if ((info->cmd & IPP2P_DATA_KAZAA) == IPP2P_DATA_KAZAA) printf(" --kazaa-data");
|
if ((info->cmd & SHORT_HAND_DATA) == SHORT_HAND_DATA)
|
||||||
// if ((info->cmd & IPP2P_DATA_GNU) == IPP2P_DATA_GNU) printf(" --gnu-data");
|
printf(" --ipp2p-data");
|
||||||
|
*/
|
||||||
|
if ((info->cmd & IPP2P_KAZAA) == IPP2P_KAZAA)
|
||||||
|
printf(" --kazaa");
|
||||||
|
/*
|
||||||
|
if ((info->cmd & IPP2P_DATA_KAZAA) == IPP2P_DATA_KAZAA)
|
||||||
|
printf(" --kazaa-data");
|
||||||
|
if ((info->cmd & IPP2P_DATA_GNU) == IPP2P_DATA_GNU)
|
||||||
|
printf(" --gnu-data");
|
||||||
|
*/
|
||||||
if ((info->cmd & IPP2P_GNU) == IPP2P_GNU) printf(" --gnu");
|
if ((info->cmd & IPP2P_GNU) == IPP2P_GNU) printf(" --gnu");
|
||||||
if ((info->cmd & IPP2P_EDK) == IPP2P_EDK) printf(" --edk");
|
if ((info->cmd & IPP2P_EDK) == IPP2P_EDK) printf(" --edk");
|
||||||
// if ((info->cmd & IPP2P_DATA_EDK) == IPP2P_DATA_EDK) printf(" --edk-data");
|
/*
|
||||||
// if ((info->cmd & IPP2P_DATA_DC) == IPP2P_DATA_DC) printf(" --dc-data");
|
if ((info->cmd & IPP2P_DATA_EDK) == IPP2P_DATA_EDK)
|
||||||
if ((info->cmd & IPP2P_DC) == IPP2P_DC) printf(" --dc");
|
printf(" --edk-data");
|
||||||
if ((info->cmd & IPP2P_BIT) == IPP2P_BIT) printf(" --bit");
|
if ((info->cmd & IPP2P_DATA_DC) == IPP2P_DATA_DC)
|
||||||
if ((info->cmd & IPP2P_APPLE) == IPP2P_APPLE) printf(" --apple");
|
printf(" --dc-data");
|
||||||
if ((info->cmd & IPP2P_SOUL) == IPP2P_SOUL) printf(" --soul");
|
*/
|
||||||
if ((info->cmd & IPP2P_WINMX) == IPP2P_WINMX) printf(" --winmx");
|
if ((info->cmd & IPP2P_DC) == IPP2P_DC)
|
||||||
if ((info->cmd & IPP2P_ARES) == IPP2P_ARES) printf(" --ares");
|
printf(" --dc");
|
||||||
if ((info->cmd & IPP2P_MUTE) == IPP2P_MUTE) printf(" --mute");
|
if ((info->cmd & IPP2P_BIT) == IPP2P_BIT)
|
||||||
if ((info->cmd & IPP2P_WASTE) == IPP2P_WASTE) printf(" --waste");
|
printf(" --bit");
|
||||||
if ((info->cmd & IPP2P_XDCC) == IPP2P_XDCC) printf(" --xdcc");
|
if ((info->cmd & IPP2P_APPLE) == IPP2P_APPLE)
|
||||||
if (info->debug != 0) printf(" --debug");
|
printf(" --apple");
|
||||||
|
if ((info->cmd & IPP2P_SOUL) == IPP2P_SOUL)
|
||||||
|
printf(" --soul");
|
||||||
|
if ((info->cmd & IPP2P_WINMX) == IPP2P_WINMX)
|
||||||
|
printf(" --winmx");
|
||||||
|
if ((info->cmd & IPP2P_ARES) == IPP2P_ARES)
|
||||||
|
printf(" --ares");
|
||||||
|
if ((info->cmd & IPP2P_MUTE) == IPP2P_MUTE)
|
||||||
|
printf(" --mute");
|
||||||
|
if ((info->cmd & IPP2P_WASTE) == IPP2P_WASTE)
|
||||||
|
printf(" --waste");
|
||||||
|
if ((info->cmd & IPP2P_XDCC) == IPP2P_XDCC)
|
||||||
|
printf(" --xdcc");
|
||||||
|
if (info->debug != 0)
|
||||||
|
printf(" --debug");
|
||||||
printf(" ");
|
printf(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void ipp2p_mt_save(const void *entry, const struct xt_entry_match *match)
|
||||||
save(const void *ip, const struct xt_entry_match *match)
|
|
||||||
{
|
{
|
||||||
struct ipt_p2p_info *info = (struct ipt_p2p_info *)match->data;
|
struct ipt_p2p_info *info = (struct ipt_p2p_info *)match->data;
|
||||||
|
|
||||||
if ((info->cmd & SHORT_HAND_IPP2P) == SHORT_HAND_IPP2P) printf("--ipp2p ");
|
if ((info->cmd & SHORT_HAND_IPP2P) == SHORT_HAND_IPP2P)
|
||||||
// if ((info->cmd & SHORT_HAND_DATA) == SHORT_HAND_DATA) printf("--ipp2p-data ");
|
printf("--ipp2p ");
|
||||||
if ((info->cmd & IPP2P_KAZAA) == IPP2P_KAZAA) printf("--kazaa ");
|
/*
|
||||||
// if ((info->cmd & IPP2P_DATA_KAZAA) == IPP2P_DATA_KAZAA) printf("--kazaa-data ");
|
if ((info->cmd & SHORT_HAND_DATA) == SHORT_HAND_DATA)
|
||||||
// if ((info->cmd & IPP2P_DATA_GNU) == IPP2P_DATA_GNU) printf("--gnu-data ");
|
printf("--ipp2p-data ");
|
||||||
if ((info->cmd & IPP2P_GNU) == IPP2P_GNU) printf("--gnu ");
|
*/
|
||||||
if ((info->cmd & IPP2P_EDK) == IPP2P_EDK) printf("--edk ");
|
if ((info->cmd & IPP2P_KAZAA) == IPP2P_KAZAA)
|
||||||
// if ((info->cmd & IPP2P_DATA_EDK) == IPP2P_DATA_EDK) printf("--edk-data ");
|
printf("--kazaa ");
|
||||||
// if ((info->cmd & IPP2P_DATA_DC) == IPP2P_DATA_DC) printf("--dc-data ");
|
/* if ((info->cmd & IPP2P_DATA_KAZAA) == IPP2P_DATA_KAZAA)
|
||||||
if ((info->cmd & IPP2P_DC) == IPP2P_DC) printf("--dc ");
|
printf("--kazaa-data ");
|
||||||
if ((info->cmd & IPP2P_BIT) == IPP2P_BIT) printf("--bit ");
|
if ((info->cmd & IPP2P_DATA_GNU) == IPP2P_DATA_GNU)
|
||||||
if ((info->cmd & IPP2P_APPLE) == IPP2P_APPLE) printf("--apple ");
|
printf("--gnu-data ");
|
||||||
if ((info->cmd & IPP2P_SOUL) == IPP2P_SOUL) printf("--soul ");
|
*/
|
||||||
if ((info->cmd & IPP2P_WINMX) == IPP2P_WINMX) printf("--winmx ");
|
if ((info->cmd & IPP2P_GNU) == IPP2P_GNU)
|
||||||
if ((info->cmd & IPP2P_ARES) == IPP2P_ARES) printf("--ares ");
|
printf("--gnu ");
|
||||||
if ((info->cmd & IPP2P_MUTE) == IPP2P_MUTE) printf(" --mute");
|
if ((info->cmd & IPP2P_EDK) == IPP2P_EDK)
|
||||||
if ((info->cmd & IPP2P_WASTE) == IPP2P_WASTE) printf(" --waste");
|
printf("--edk ");
|
||||||
if ((info->cmd & IPP2P_XDCC) == IPP2P_XDCC) printf(" --xdcc");
|
/* if ((info->cmd & IPP2P_DATA_EDK) == IPP2P_DATA_EDK)
|
||||||
if (info->debug != 0) printf("--debug ");
|
printf("--edk-data ");
|
||||||
|
if ((info->cmd & IPP2P_DATA_DC) == IPP2P_DATA_DC)
|
||||||
|
printf("--dc-data ");
|
||||||
|
*/
|
||||||
|
if ((info->cmd & IPP2P_DC) == IPP2P_DC)
|
||||||
|
printf("--dc ");
|
||||||
|
if ((info->cmd & IPP2P_BIT) == IPP2P_BIT)
|
||||||
|
printf("--bit ");
|
||||||
|
if ((info->cmd & IPP2P_APPLE) == IPP2P_APPLE)
|
||||||
|
printf("--apple ");
|
||||||
|
if ((info->cmd & IPP2P_SOUL) == IPP2P_SOUL)
|
||||||
|
printf("--soul ");
|
||||||
|
if ((info->cmd & IPP2P_WINMX) == IPP2P_WINMX)
|
||||||
|
printf("--winmx ");
|
||||||
|
if ((info->cmd & IPP2P_ARES) == IPP2P_ARES)
|
||||||
|
printf("--ares ");
|
||||||
|
if ((info->cmd & IPP2P_MUTE) == IPP2P_MUTE)
|
||||||
|
printf(" --mute");
|
||||||
|
if ((info->cmd & IPP2P_WASTE) == IPP2P_WASTE)
|
||||||
|
printf(" --waste");
|
||||||
|
if ((info->cmd & IPP2P_XDCC) == IPP2P_XDCC)
|
||||||
|
printf(" --xdcc");
|
||||||
|
if (info->debug != 0)
|
||||||
|
printf("--debug ");
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static struct xtables_match ipp2p_mt_reg = {
|
||||||
struct xtables_match ipp2p=
|
|
||||||
{
|
|
||||||
.name = "ipp2p",
|
|
||||||
.version = XTABLES_VERSION,
|
.version = XTABLES_VERSION,
|
||||||
|
.name = "ipp2p",
|
||||||
|
.revision = 0,
|
||||||
|
.family = AF_INET,
|
||||||
.size = XT_ALIGN(sizeof(struct ipt_p2p_info)),
|
.size = XT_ALIGN(sizeof(struct ipt_p2p_info)),
|
||||||
.userspacesize = XT_ALIGN(sizeof(struct ipt_p2p_info)),
|
.userspacesize = XT_ALIGN(sizeof(struct ipt_p2p_info)),
|
||||||
.help = &help,
|
.help = ipp2p_mt_help,
|
||||||
.parse = &parse,
|
.parse = ipp2p_mt_parse,
|
||||||
.final_check = &final_check,
|
.final_check = ipp2p_mt_check,
|
||||||
.print = &print,
|
.print = ipp2p_mt_print,
|
||||||
.save = &save,
|
.save = ipp2p_mt_save,
|
||||||
.extra_opts = opts
|
.extra_opts = ipp2p_mt_opts,
|
||||||
};
|
};
|
||||||
|
|
||||||
void _init(void)
|
void _init(void)
|
||||||
{
|
{
|
||||||
xtables_register_match(&ipp2p);
|
xtables_register_match(&ipp2p_mt_reg);
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user