<commit_before>/************************************************************************
*
* Flood Project  (2008-201x)
* Licensed under the simplified BSD license. All rights reserved.
*
************************************************************************/

#pragma once

#include "Core/API.h"
#include "Core/Network/Session.h"
#include "Core/References.h"
#include "Core/String.h"
#include "Core/Event.h"

struct _ENetPeer;
typedef _ENetPeer ENetPeer;

FWD_DECL_INTRUSIVE(Host)
FWD_DECL_INTRUSIVE(Packet)

NAMESPACE_CORE_BEGIN

class PacketProcessor;
class PacketProcessors;

//-----------------------------------//

enum class PeerState
{
	Disconnected,
	Connecting,
	Connected,
	Disconnecting,
};

//-----------------------------------//

// Peers are representations of network entities.
 class API_CORE Peer : public ReferenceCounted
{
public:

	Peer();

	// Asks for a normal disconnect.
	void disconnect();

	// Forces a disconnect.
	void forceDisconnect();

	// Gets the peer hostname.
	String getHostName() const;

	// Gets the peer IP address.
	String getHostIP() const;

	// Queues a packet to be sent to the peer.
	void queuePacket(const PacketPtr& packet, uint8 channel);

	FLD_IGNORE bool processInPacket(const PacketPtr& packet, uint8 channel);

	FLD_IGNORE void addProcessor(PacketProcessor* processor);

	FLD_IGNORE ACCESSOR(Peer, ENetPeer*, peer)

	FLD_IGNORE ACCESSOR(Host, Host*, host)

	GETTER(State, PeerState, state);
	FLD_IGNORE void setState(PeerState state);
	Event1<PeerState> onStateChanged;

	GETTER(Session, Session*, session)
	FLD_IGNORE SETTER(Session, Session*, session)

private:

	ENetPeer* peer;
	Host* host;
	Session* session;

	PeerState state;

	PacketProcessors* processors;<commit_msg>Added missing semicolon.<commit_after>/************************************************************************
*
* Flood Project  (2008-201x)
* Licensed under the simplified BSD license. All rights reserved.
*
************************************************************************/

#pragma once

#include "Core/API.h"
#include "Core/Network/Session.h"
#include "Core/References.h"
#include "Core/String.h"
#include "Core/Event.h"

struct _ENetPeer;
typedef _ENetPeer ENetPeer;

FWD_DECL_INTRUSIVE(Host)
FWD_DECL_INTRUSIVE(Packet)

NAMESPACE_CORE_BEGIN

class PacketProcessor;
class PacketProcessors;

//-----------------------------------//

enum class PeerState
{
	Disconnected,
	Connecting,
	Connected,
	Disconnecting,
};

//-----------------------------------//

// Peers are representations of network entities.
 class API_CORE Peer : public ReferenceCounted
{
public:

	Peer();

	// Asks for a normal disconnect.
	void disconnect();

	// Forces a disconnect.
	void forceDisconnect();

	// Gets the peer hostname.
	String getHostName() const;

	// Gets the peer IP address.
	String getHostIP() const;

	// Queues a packet to be sent to the peer.
	void queuePacket(const PacketPtr& packet, uint8 channel);

	FLD_IGNORE bool processInPacket(const PacketPtr& packet, uint8 channel);

	FLD_IGNORE void addProcessor(PacketProcessor* processor);

	FLD_IGNORE ACCESSOR(Peer, ENetPeer*, peer)

	FLD_IGNORE ACCESSOR(Host, Host*, host)

	GETTER(State, PeerState, state);
	FLD_IGNORE void setState(PeerState state);
	Event1<PeerState> onStateChanged;

	GETTER(Session, Session*, session)
	FLD_IGNORE SETTER(Session, Session*, session);

private:

	ENetPeer* peer;
	Host* host;
	Session* session;

	PeerState state;

	PacketProcessors* processors;
{'fraction_non_alphanumeric': 0.21301093839953944, 'fraction_numerical': 0.0057570523891767415, 'mean_word_length': 4.233433734939759, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '625700', 'n_tokens_mistral': 1123, 'n_tokens_neox': 1005, 'n_words': 291}