~ubuntu-branches/ubuntu/natty/libvirt/natty-proposed

« back to all changes in this revision

Viewing changes to src/conf/domain_nwfilter.c

  • Committer: Bazaar Package Importer
  • Author(s): Laurent Léonard
  • Date: 2010-07-06 12:14:33 UTC
  • mto: (3.4.17 sid) (1.2.6 upstream) (0.3.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 93.
  • Revision ID: james.westby@ubuntu.com-20100706121433-94utbax9zjvmkcsj
Tags: upstream-0.8.2
Import upstream version 0.8.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * domain_nwfilter.c:
 
3
 *
 
4
 * Copyright (C) 2010 IBM Corporation
 
5
 *
 
6
 * This library is free software; you can redistribute it and/or
 
7
 * modify it under the terms of the GNU Lesser General Public
 
8
 * License as published by the Free Software Foundation; either
 
9
 * version 2.1 of the License, or (at your option) any later version.
 
10
 *
 
11
 * This library 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 GNU
 
14
 * Lesser General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU Lesser General Public
 
17
 * License along with this library; if not, write to the Free Software
 
18
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
 
19
 *
 
20
 * Author: Stefan Berger <stefanb@us.ibm.com>
 
21
 */
 
22
 
 
23
#include <config.h>
 
24
 
 
25
#include "internal.h"
 
26
 
 
27
#include "datatypes.h"
 
28
#include "domain_conf.h"
 
29
#include "domain_nwfilter.h"
 
30
 
 
31
static virDomainConfNWFilterDriverPtr nwfilterDriver;
 
32
 
 
33
void
 
34
virDomainConfNWFilterRegister(virDomainConfNWFilterDriverPtr driver) {
 
35
    nwfilterDriver = driver;
 
36
}
 
37
 
 
38
int
 
39
virDomainConfNWFilterInstantiate(virConnectPtr conn,
 
40
                                 virDomainNetDefPtr net) {
 
41
    if (nwfilterDriver != NULL)
 
42
        return nwfilterDriver->instantiateFilter(conn, net);
 
43
    /* driver module not available -- don't indicate failure */
 
44
    return 0;
 
45
}
 
46
 
 
47
void
 
48
virDomainConfNWFilterTeardown(virDomainNetDefPtr net) {
 
49
    if (nwfilterDriver != NULL)
 
50
        nwfilterDriver->teardownFilter(net);
 
51
}
 
52
 
 
53
void
 
54
virDomainConfVMNWFilterTeardown(virDomainObjPtr vm) {
 
55
    int i;
 
56
 
 
57
    if (nwfilterDriver != NULL) {
 
58
        for (i = 0; i < vm->def->nnets; i++)
 
59
            virDomainConfNWFilterTeardown(vm->def->nets[i]);
 
60
    }
 
61
}