| 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 nft |
| 21 | |
| 22 | import "github.com/networkplumbing/go-nft/nft/schema" |
| 23 | |
| 24 | type AddressFamily string |
| 25 | |
| 26 | // Address Families |
| 27 | const ( |
| 28 | FamilyIP AddressFamily = schema.FamilyIP |
| 29 | FamilyIP6 AddressFamily = schema.FamilyIP6 |
| 30 | FamilyINET AddressFamily = schema.FamilyINET |
| 31 | FamilyARP AddressFamily = schema.FamilyARP |
| 32 | FamilyBridge AddressFamily = schema.FamilyBridge |
| 33 | FamilyNETDEV AddressFamily = schema.FamilyNETDEV |
| 34 | ) |
| 35 | |
| 36 | type TableAction string |
| 37 | |
| 38 | // Table Actions |
| 39 | const ( |
| 40 | TableADD TableAction = "add" |
| 41 | TableDELETE TableAction = "delete" |
| 42 | TableFLUSH TableAction = "flush" |
| 43 | ) |
| 44 | |
| 45 | // NewTable returns a new schema table structure. |
| 46 | func NewTable(name string, family AddressFamily) *schema.Table { |
| 47 | return &schema.Table{ |
| 48 | Name: name, |
| 49 | Family: string(family), |
| 50 | } |
| 51 | } |