Debian Codegraph @

nft/config/table.go

raw symbols SCIP
1 /*
2 * This file is part of the go-nft project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 * Copyright 2021 Red Hat, Inc.
17 *
18 */
19
20 package configscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config`/
21
22 import (
23 "github.com/networkplumbing/go-nft/nft/schemascip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/"
24 )
25
26 // AddTable appends the given table to the nftable config.
27 // The table is added without an explicit action (`add`).
28 // Adding multiple times the same table has no effect when the config is applied.
29 func (c *Configscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config`/Config#) AddTablescip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config`/Config#AddTable().(table *schemascip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/.Tablescip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/Table#) {
30 nftable := schemascip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/.Nftablescip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/Nftable#{Tablescip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/Nftable#Table.: table}
31 c.Nftablesscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/Root#Nftables. = append(c.Nftablesscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/Root#Nftables., nftable)
32 }
33
34 // DeleteTable appends a given table to the nftable config
35 // with the `delete` action.
36 // Attempting to delete a non-existing table, results with a failure when the config is applied.
37 // All chains and rules under the table are removed as well (when applied).
38 func (c *Configscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config`/Config#) DeleteTablescip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config`/Config#DeleteTable().(table *schemascip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/.Tablescip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/Table#) {
39 nftable := schemascip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/.Nftablescip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/Nftable#{Deletescip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/Nftable#Delete.: &schemascip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/.Objectsscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/Objects#{Tablescip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/Objects#Table.: table}}
40 c.Nftablesscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/Root#Nftables. = append(c.Nftablesscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/Root#Nftables., nftable)
41 }
42
43 // FlushTable appends a given table to the nftable config
44 // with the `flush` action.
45 // All chains and rules under the table are removed (when applied).
46 // Attempting to flush a non-existing table, results with a failure when the config is applied.
47 func (c *Configscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config`/Config#) FlushTablescip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config`/Config#FlushTable().(table *schemascip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/.Tablescip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/Table#) {
48 nftable := schemascip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/.Nftablescip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/Nftable#{Flushscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/Nftable#Flush.: &schemascip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/.Objectsscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/Objects#{Tablescip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/Objects#Table.: table}}
49 c.Nftablesscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/Root#Nftables. = append(c.Nftablesscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/Root#Nftables., nftable)
50 }
51
52 // LookupTable searches the configuration for a matching table and returns it.
53 // Mutating the returned table will result in mutating the configuration.
54 func (c *Configscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config`/Config#) LookupTablescip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config`/Config#LookupTable().(toFind *schemascip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/.Tablescip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/Table#) *schemascip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/.Tablescip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/Table# {
55 for _, nftable := range c.Nftablesscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/Root#Nftables. {
56 if t := nftable.Tablescip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/Nftable#Table.; t != nil {
57 if t.Namescip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/Table#Name. == toFind.Namescip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/Table#Name. && t.Familyscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/Table#Family. == toFind.Familyscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/Table#Family. {
58 return t
59 }
60 }
61 }
62 return nil
63 }