<commit_before>//
// Copyright (c) 2016 Intel Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

package ssntp

import (
	"sync"
)

// ForwardDecision tells SSNTP how it should forward a frame.
// Callers set that value as part of the ForwardDestination
// structure.
type ForwardDecision uint8

const (
	// Forward the frame. The recipients are defined by the ForwardDecision
	// UUIDs field.
	Forward ForwardDecision = iota

	// Discard the frame. The frame will be discarded by SSNTP.
	Discard

	// Queue the frame. SSNTP will queue the frame and the caller will have to call
	// into the SSNTP Server queueing API to fetch it back.
	Queue
)

// ForwardDestination is returned by the forwading interfaces
// and allows the interface implementer to let SSNTP know what
// to do next with a received frame.
// The interface implementer needs to specify if the frame
// should be forwarded, discarded or queued (Decision).
// If the implementer decision is to forward the frame, it
// should also provide a list of recipients to forward it to (UUIDs)
type ForwardDestination struct {
	decision       ForwardDecision
	recipientUUIDs []string
}

// AddRecipient adds a recipient to a ForwardDestination structure.
// AddRecipient implicitly sets the forwarding decision to Forward
// since adding a recipient means the frame must be forwarded.
func (d *ForwardDestination) AddRecipient(uuid string) {
	d.decision = Forward
	d.recipientUUIDs = append(d.recipientUUIDs, uuid)
}

// SetDecision is a helper for setting the ForwardDestination Decision field.
func (d *ForwardDestination) SetDecision(decision ForwardDecision) {
	d.decision = decision
}<commit_msg>ssntp: add ForwardDestination accessor functions<commit_after>//
// Copyright (c) 2016 Intel Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

package ssntp

import (
	"sync"
)

// ForwardDecision tells SSNTP how it should forward a frame.
// Callers set that value as part of the ForwardDestination
// structure.
type ForwardDecision uint8

const (
	// Forward the frame. The recipients are defined by the ForwardDecision
	// UUIDs field.
	Forward ForwardDecision = iota

	// Discard the frame. The frame will be discarded by SSNTP.
	Discard

	// Queue the frame. SSNTP will queue the frame and the caller will have to call
	// into the SSNTP Server queueing API to fetch it back.
	Queue
)

// ForwardDestination is returned by the forwading interfaces
// and allows the interface implementer to let SSNTP know what
// to do next with a received frame.
// The interface implementer needs to specify if the frame
// should be forwarded, discarded or queued (Decision).
// If the implementer decision is to forward the frame, it
// should also provide a list of recipients to forward it to (UUIDs)
type ForwardDestination struct {
	decision       ForwardDecision
	recipientUUIDs []string
}

// Decision is a simple accessor for the ForwardDecision.decision field
func (d *ForwardDestination) Decision() ForwardDecision {
	return d.decision
}

// Recipients is a simple accessor for the ForwardDecision.recipientUUIDs field
func (d *ForwardDestination) Recipients() []string {
	return d.recipientUUIDs
}

// AddRecipient adds a recipient to a ForwardDestination structure.
// AddRecipient implicitly sets the forwarding decision to Forward
// since adding a recipient means the frame must be forwarded.
func (d *ForwardDestination) AddRecipient(uuid string) {
	d.decision = Forward
	d.recipientUUIDs = append(d.recipientUUIDs, uuid)
}

// SetDecision is a helper for setting the ForwardDestination Decision field.
func (d *ForwardDestination) SetDecision(decision ForwardDecision) {
	d.decision = decision
}
{'fraction_non_alphanumeric': 0.06939728353140917, 'fraction_numerical': 0.0038200339558573855, 'mean_word_length': 3.8140960163432074, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '62146', 'n_tokens_mistral': 1307, 'n_tokens_neox': 1242, 'n_words': 606}