// This Test Port skeleton header file was generated by the
// TTCN-3 Compiler of the TTCN-3 Test Executor version CRL 113 200/6 R5A
// for Harald Welte (laforge@nataraja) on Sun Jan  6 18:08:12 2019

// Copyright (c) 2000-2018 Ericsson Telecom AB

// You may modify this file. Add your attributes and prototypes of your
// member functions here.

#ifndef AF__PACKET__PT_HH
#define AF__PACKET__PT_HH

#include <TTCN3.hh>
#include <stdint.h>
#include "AF_PACKET_PortTypes.hh"

// Note: Header file AF_PACKET_PortType.hh must not be included into this file!
// (because it includes this file)
// Please add the declarations of message types manually.
//

namespace AF__PACKET__PortType {

using namespace AF__PACKET__PortTypes;

class AF__PACKET__PT_PROVIDER : public PORT {
public:
	AF__PACKET__PT_PROVIDER(const char *par_port_name);
	~AF__PACKET__PT_PROVIDER();

	void set_parameter(const char *parameter_name, const char *parameter_value);

private:
	void Handle_Fd_Event(int fd, boolean is_readable, boolean is_writable, boolean is_error);
	/* void Handle_Timeout(double time_since_last_call); */

protected:
	void user_map(const char *system_port, Map_Params& params);
	void user_unmap(const char *system_port, Map_Params& params);

	void user_start();
	void user_stop();

	void outgoing_send(const AF__PACKET__PortTypes::AF__PACKET__Unitdata&);

	virtual void incoming_message(const AF__PACKET__Unitdata& incoming_par) = 0;

public:
	void log(const char *fmt, ...);

private:
	char *mNetdev_name;		/* name of the network interface */
	int mSleepUsOnEnobufs;		/* how many us to sleep on ENOBUFS */
	int mIfindex;			/* interface index of the network device */
	int mSocket;			/* socket/file descriptor of the AF_PACKET socket */
	uint8_t mRxBuf[2048];		/* read buffer */

}; // class AF__PACKET__PORT_PROVIDER

} /* end of namespace */

#endif
