forked from aporeto-inc/trireme-lib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
packetprocessor.go
31 lines (24 loc) · 1.58 KB
/
packetprocessor.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package packetprocessor
import (
"github.com/aporeto-inc/trireme-lib/enforcer/connection"
"github.com/aporeto-inc/trireme-lib/enforcer/pucontext"
"github.com/aporeto-inc/trireme-lib/enforcer/utils/fqconfig"
"github.com/aporeto-inc/trireme-lib/enforcer/utils/packet"
"github.com/aporeto-inc/trireme-lib/enforcer/utils/secrets"
"github.com/aporeto-inc/trireme-lib/enforcer/utils/tokens"
)
// PacketProcessor is an interface implemented to stitch into our enforcer
type PacketProcessor interface {
// Initialize initializes the secrets of the processor
Initialize(s secrets.Secrets, fq *fqconfig.FilterQueue)
// Stop stops the packet processor
Stop() error
// PreProcessTCPAppPacket will be called for application packets and return value of false means drop packet.
PreProcessTCPAppPacket(p *packet.Packet, context *pucontext.PUContext, conn *connection.TCPConnection) bool
// PostProcessTCPAppPacket will be called for application packets and return value of false means drop packet.
PostProcessTCPAppPacket(p *packet.Packet, action interface{}, context *pucontext.PUContext, conn *connection.TCPConnection) bool
// PreProcessTCPNetPacket will be called for network packets and return value of false means drop packet
PreProcessTCPNetPacket(p *packet.Packet, context *pucontext.PUContext, conn *connection.TCPConnection) bool
// PostProcessTCPNetPacket will be called for network packets and return value of false means drop packet
PostProcessTCPNetPacket(p *packet.Packet, action interface{}, claims *tokens.ConnectionClaims, context *pucontext.PUContext, conn *connection.TCPConnection) bool
}