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

« back to all changes in this revision

Viewing changes to term.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
 
 
27
void termIPServices(void) {
 
28
  int i;
 
29
  ProtocolsList *proto = myGlobals.ipProtosList;
 
30
 
 
31
  for(i=0; i<myGlobals.numActServices; i++) {
 
32
    if(myGlobals.udpSvc[i] != NULL) {
 
33
      free(myGlobals.udpSvc[i]->name);
 
34
      free(myGlobals.udpSvc[i]);
 
35
    }
 
36
 
 
37
    if(myGlobals.tcpSvc[i] != NULL) {
 
38
      if(myGlobals.tcpSvc[i]->name != NULL) {
 
39
        free(myGlobals.tcpSvc[i]->name);
 
40
      }
 
41
      free(myGlobals.tcpSvc[i]);
 
42
    }
 
43
  }
 
44
 
 
45
  free(myGlobals.udpSvc);
 
46
  free(myGlobals.tcpSvc);
 
47
 
 
48
  /* ****************************** */
 
49
 
 
50
  while(proto != NULL) {
 
51
    ProtocolsList *nextProto = proto->next;
 
52
 
 
53
    free(proto->protocolName);
 
54
    free(proto);
 
55
    proto = nextProto;
 
56
  }
 
57
}
 
58
 
 
59
/* ******************************* */
 
60
 
 
61
void termIPSessions(void) {
 
62
  int i, j;
 
63
 
 
64
  for(j=0; j<myGlobals.numDevices; j++) {
 
65
    if(myGlobals.device[j].tcpSession == NULL) continue;
 
66
  
 
67
    for(i=0; i<MAX_TOT_NUM_SESSIONS; i++) {
 
68
      IPSession *session = myGlobals.device[j].tcpSession[i];
 
69
 
 
70
      while(session != NULL) {
 
71
        IPSession *nextSession;
 
72
        nextSession = session->next;
 
73
        free(session);
 
74
        session = nextSession;
 
75
      }
 
76
    }
 
77
 
 
78
#ifdef PARM_USE_SESSIONS_CACHE
 
79
    for(i=0; i<myGlobals.sessionsCacheLen; i++)
 
80
      free(myGlobals.sessionsCache[i]);
 
81
#endif
 
82
 
 
83
    myGlobals.device[j].numTcpSessions = 0;
 
84
    
 
85
    while(myGlobals.device[j].fragmentList != NULL)
 
86
      deleteFragment(myGlobals.device[j].fragmentList, j);
 
87
  }
 
88
}
 
89
 
 
90
/* ************************************************ */
 
91
 
 
92
void termGdbm() {
 
93
    if(myGlobals.dnsCacheFile)     { gdbm_close(myGlobals.dnsCacheFile); myGlobals.dnsCacheFile = NULL;   }
 
94
    if(myGlobals.addressQueueFile) { gdbm_close(myGlobals.addressQueueFile); myGlobals.addressQueueFile = NULL; }
 
95
    if(myGlobals.pwFile)           { gdbm_close(myGlobals.pwFile); myGlobals.pwFile = NULL;               }
 
96
    if(myGlobals.prefsFile)        { gdbm_close(myGlobals.prefsFile); myGlobals.prefsFile = NULL;         }
 
97
    if(myGlobals.macPrefixFile)    { gdbm_close(myGlobals.macPrefixFile); myGlobals.macPrefixFile = NULL;         }
 
98
}