/*
	ZNetUtil.hpp
	Author: Patrick Baggett	<ptbaggett@762studios.com>
	Created: 6/5/2013

	Purpose:

	ZNet utility functions

	License:
	
	Copyright 2013, 762 Studios
*/

#pragma once

#ifndef _ZNETUTIL_HPP
#define _ZNETUTIL_HPP

#include <ZUtil/ZBinaryBufferReader.hpp>
#include <ZUtil/ZBinaryBufferWriter.hpp>
#include <ZNet/ZNetPacket.hpp>

namespace ZNetUtil
{
	/*
		ZNetUtil::ReaderForPacket

		Constructs a ZBinaryBufferReader for the given packet to read it.

		@param packet - The packet to read
		@return (ZBinaryBufferReader) - The reader class
	*/
	inline ZBinaryBufferReader ReaderForPacket(ZNetPacket* packet) { return ZBinaryBufferReader(packet->data, packet->dataSize, ZNET_BYTEORDER); }

	/*
		ZNetUtil::WriterForPacket

		Constructs a ZBinaryBufferWriter for the given packet to read it.

		@param packet - The packet to read
		@return (ZBinaryBufferWriter) - The writer class
	*/
	inline ZBinaryBufferWriter WriterForPacket(ZNetPacket* packet) { return ZBinaryBufferWriter(packet->data, packet->dataSize, ZNET_BYTEORDER); }
}

#endif


