~ubuntu-branches/ubuntu/natty/ntop/natty

« back to all changes in this revision

Viewing changes to pluginSkeleton.c

  • Committer: Bazaar Package Importer
  • Author(s): Ola Lundqvist
  • Date: 2005-01-30 21:59:13 UTC
  • mfrom: (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20050130215913-xc3ke963bw49b3k4
Tags: 2:3.0-5
* Updated README.Debian file so users will understand what to do at
  install, closes: #291794, #287802.
* Updated ntop init script to give better output.
* Also changed log directory from /var/lib/ntop to /var/log/ntop,
  closes: #252352.
* Quoted the interface list to allow whitespace, closes: #267248.
* Added a couple of logcheck ignores, closes: #269321, #269319.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  Copyright (C) 1998-2004 Luca Deri <deri@ntop.org>
 
3
 *                      
 
4
 *                          http://www.ntop.org/
 
5
 *                                      
 
6
 *  This program is free software; you can redistribute it and/or modify
 
7
 *  it under the terms of the GNU General Public License as published by
 
8
 *  the Free Software Foundation; either version 2 of the License, or
 
9
 *  (at your option) any later version.
 
10
 *
 
11
 *  This program is distributed in the hope that it will be useful,
 
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 *  GNU General Public License for more details.
 
15
 *
 
16
 *  You should have received a copy of the GNU General Public License
 
17
 *  along with this program; if not, write to the Free Software
 
18
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
19
 */
 
20
 
 
21
#include "ntop.h"
 
22
 
 
23
 
 
24
/* ***************************** */
 
25
 
 
26
static void handlePacket(const struct pcap_pkthdr *h,
 
27
                         const u_char *p) {
 
28
  /* 
 
29
     Put here the code for handling packets
 
30
     that match the specified BPF filter
 
31
  */
 
32
}
 
33
 
 
34
/* ****************************** */
 
35
 
 
36
static void initFunct() {
 
37
  /*
 
38
     Put here all the code that should be called when
 
39
     this plugin is started up
 
40
  */
 
41
  traceEvent(CONST_TRACE_ALWAYSDISPLAY, "XXXXXXXX: Welcome to ntop xxxxxxxx");
 
42
}
 
43
 
 
44
/* ****************************** */
 
45
 
 
46
static void termFunct() {
 
47
  /* 
 
48
     Put here all the code that should be called when 
 
49
     this plugin is terminated 
 
50
  */
 
51
  traceEvent(CONST_TRACE_INFO, "XXXXXXXX: Thanks for using ntop xxxxxxxx");
 
52
  traceEvent(CONST_TRACE_ALWAYSDISPLAY, "XXXXXXXX: Done");
 
53
}
 
54
 
 
55
/* ****************************** */
 
56
 
 
57
static void handlePluginHTTPrequest(char* url) {
 
58
  /* handle HTTP requests here */
 
59
}
 
60
 
 
61
/* ****************************** */
 
62
 
 
63
static PluginInfo pluginInfo[] = {
 
64
  { "put here the plugin name as it will appere",
 
65
    "describe what this plugin does",
 
66
    "1.0", /* plugin version */
 
67
    "Put here the author name", 
 
68
    "shortPluginName", /* http://<host>:<port>/plugins/shortPluginName */
 
69
    0, /* Active by default */
 
70
    1, /* Inactive setup */
 
71
    initFunction, /* InitFunc   */
 
72
    termFunction, /* TermFunc   */
 
73
    handlePacket, /* PluginFunc */
 
74
    handlePluginHTTPrequest,
 
75
    "<BPF filter>", /* BPF filter */
 
76
    NULL  /* no status */
 
77
  }
 
78
};
 
79
 
 
80
/* Plugin entry fctn */
 
81
#ifdef STATIC_PLUGIN
 
82
PluginInfo* myPluginEntryFctn() {
 
83
#else
 
84
  PluginInfo* PluginEntryFctn() {
 
85
#endif
 
86
  
 
87
    /* Put here the initialization functions */  
 
88
    return(pluginInfo);
 
89
  }