File: pluginSkeleton.c

package info (click to toggle)
ntop 3:3.3-11
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 12,772 kB
  • ctags: 7,534
  • sloc: ansic: 71,427; sh: 16,772; awk: 1,504; perl: 792; makefile: 782; php: 123; python: 23; sql: 13; sed: 11
file content (89 lines) | stat: -rw-r--r-- 2,523 bytes parent folder | download | duplicates (2)
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
/*
 *  Copyright (C) 1998-2005 Luca Deri <deri@ntop.org>
 *                      
 *  			    http://www.ntop.org/
 *  					
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

#include "ntop.h"


/* ***************************** */

static void handlePacket(const struct pcap_pkthdr *h,
			 const u_char *p) {
  /* 
     Put here the code for handling packets
     that match the specified BPF filter
  */
}

/* ****************************** */

static void initFunct() {
  /*
     Put here all the code that should be called when
     this plugin is started up
  */
  traceEvent(CONST_TRACE_ALWAYSDISPLAY, "XXXXXXXX: Welcome to ntop xxxxxxxx");
}

/* ****************************** */

static void termFunct() {
  /* 
     Put here all the code that should be called when 
     this plugin is terminated 
  */
  traceEvent(CONST_TRACE_INFO, "XXXXXXXX: Thanks for using ntop xxxxxxxx");
  traceEvent(CONST_TRACE_ALWAYSDISPLAY, "XXXXXXXX: Done");
}

/* ****************************** */

static void handlePluginHTTPrequest(char* url) {
  /* handle HTTP requests here */
}

/* ****************************** */

static PluginInfo pluginInfo[] = {
  { "put here the plugin name as it will appere",
    "describe what this plugin does",
    "1.0", /* plugin version */
    "Put here the author name", 
    "shortPluginName", /* http://<host>:<port>/plugins/shortPluginName */
    0, /* Active by default */
    1, /* Inactive setup */
    initFunction, /* InitFunc   */
    termFunction, /* TermFunc   */
    handlePacket, /* PluginFunc */
    handlePluginHTTPrequest,
    "<BPF filter>", /* BPF filter */
    NULL  /* no status */
  }
};

/* Plugin entry fctn */
#ifdef STATIC_PLUGIN
PluginInfo* myPluginEntryFctn() {
#else
  PluginInfo* PluginEntryFctn() {
#endif
  
    /* Put here the initialization functions */  
    return(pluginInfo);
  }