github.com/aporeto-inc/trireme-lib@v10.358.0+incompatible/controller/internal/enforcer/nfqdatapath/afinetrawsocket/afinetrawsocket_osx.go (about)

     1  // +build darwin
     2  
     3  package afinetrawsocket
     4  
     5  import "go.aporeto.io/enforcerd/trireme-lib/controller/pkg/packet"
     6  
     7  const (
     8  	// RawSocketMark is the mark asserted on all packet sent out of this socket
     9  	RawSocketMark = 0x63
    10  	// NetworkRawSocketMark is the mark on packet egressing
    11  	//the raw socket coming in from network
    12  	NetworkRawSocketMark = 0x40000063
    13  	//ApplicationRawSocketMark is the mark on packet egressing
    14  	//the raw socket coming from application
    15  	ApplicationRawSocketMark = 0x40000062
    16  )
    17  
    18  // SocketWriter interface exposes an interface to write and close sockets
    19  type SocketWriter interface {
    20  	WriteSocket(buf []byte, version packet.IPver, data packet.PlatformMetadata) error
    21  	CloseSocket() error
    22  }
    23  
    24  type rawsocket struct { // nolint
    25  }
    26  
    27  // CreateSocket returns a handle to SocketWriter interface
    28  func CreateSocket(mark int, deviceName string) (SocketWriter, error) {
    29  	return nil, nil
    30  }
    31  
    32  // WriteSocket writes data into raw socket.
    33  func (sock *rawsocket) WriteSocket(buf []byte, version packet.IPver, data packet.PlatformMetadata) error {
    34  	//This is an IP frame dest address at byte[16]
    35  
    36  	return nil
    37  }
    38  
    39  // CloseSocket closes the raw socket.
    40  func (sock *rawsocket) CloseSocket() error {
    41  	return nil
    42  }