/*******************************************/
/* Steamcast Distributed Multimedia Server */
/*******************************************/

About Steamcast
===================

Steamcast is designed to make handling and distributing
media content to users over the internet.  It will do this
while making it easy to adminstrate and control by the 
server's owner.

Steamcast is hevily tested and proven to work with
Oddcast and SHOUTcast DSP, NSVGui, and sc_nsv for live 
streaming using any of the following formats:

MP3, NSV, and OGG

It is also designed to make distributing static multimedia
files easy and with little consideration for configuration.

System Requirements
===================
Steamcast has been compiled to run in multiple environments,
including Windows, Linux, and FreeBSD.  If neither of these
Operating systems are available to you then you can consult
me about compiling a version that works in your system.

Before contacting me about a specific compilation for your system
you must be aware that I will only compile a version of steamcast
on a OS if:

 - The Operating System is something I can get to or download
   and install myself, or gain access to the Operating System
   through one of my friends.  I will not give the source code
   out to you nor will I use your system to compile Steamcast.
   IT MUST BE A TRUSTED SYSTEM!
 - If the first condition isn't met then you are free to send
   me a machine with the operating system in question installed
   and I will look into whether it is possible to compile Steamcast.
   If you opt to do this, I will NOT return the machine nor can
   I gurantee you will get anything back on your investment.
   Never-the-less it will still be appreciated. :)

Steamcast has been tested to perform on Windows 2000,
Windows XP Home/Professional, RedHat 7.3.  As I gain access.
All other versions or flavors of Windows and Unix are virtually
untested.  If you get it working in a specific OS not listed here
please let me know through our mailing list or forum.

Requirements:
 * 90Mhz or faster server running either Windows Vista, 7, 8,
   Linux with a C++11 support.
 * 16MB RAM
 * Bandwidth to supply the users you have configured your server
   for.  Steamcast will not automatically set the proper user
   max for the amount of bandwidth you have.  THIS MUST BE DONE
   BY YOU.  You can use the tool located at:
   www.radiotoolbox.com/online_tools/bandwidth.php for a quick way
   learn how many users you can use for your given connection.
 * If you want people on the internet to listen to your server
   then you must ensure that you are connected to the internet.
   Also that you are not behind a proxy, NAT device, web cache
   or Internet Sharing device.  If you are then you must consult
   The network administrator on what steps to take to secure an
   opening to the internet for your server.
   If you are just wanting to run this on a LAN then these steps
   are not neccessary.
 * If you are using Steamcast to broadcast live audio or video
   then you need to get the tools neccesary to send a source
   signal to the server.  Tools which have been testing and come
   highly recommended are.  Oddcast, SHOUTcast DSP, SAM Broadcaster, 
   sc_nsv, NSVGui.  Other broadcast tools designed to work for SHOUTcast
   or Icecast make work as well, your mileage may vary however.

WARNING
=======
This software is currently in a beta state.  Software which is
in a beta state has been tested to perform by it's author to
the best of his/her ability.  However, further testing is needed
to ensure that the software will operate properly on other environments
or situations.  This software is in a state that it could be 
a potential security risk for the system it runs on or cause
perminent damage to the equipment it runs on.  By using
this software you are agreeing that you are willing to take this
risk and that you will not hold the author or it's authorized distributors
liable for any and all consequences from it's use.

Known Issues
============
- Need Testing done on multiple variants of multimedia players
  Have only tested with winamp and VLC.  This is especially true with OGG.
- There may be memory or resource leaks further testing needed
  to varify the source of such leaks.
- The FreeBSD compiled version is virtually untested.
- Private Mounts do not have the ability to hide stats yet.
- All file serving features have been removed for the time being and may return in the future.
- Web interface playing has a lot of testing needs.

Motivation
==========

Why do this when so many others already have?

Why not?  It's a great learning experience for me and it
gives me an opportunity to explore different design capabilities
and features which may make distributing media better.

Steamcast combines features I liked from Icecast1/2 and
SHOUTcast 1.x as well as Mp3 Toolbox the parent project
to this more aggressive project.

Why Steamcast?
Because Steam melts Ice ;)

Configuring Steamcast
=====================
Configuration is fairly simple at this stage.  It is all done from a *.conf
file.  You can find a configuration template in your installation directory.
The file will be named steamcast.conf  Simply open this file in your favorite
text editor.  On windows I would suggest Notepad, and on Unix use vi, emacs or
pico (especially if you are a beginner to the world of unix).  Configuration
must be done before starting the server at this time.  At some future date
configuration will be done by file or at run-time.  At some point I plan to
provide a tool for Windows which will allow you to configure the server in an
extremely simple way.  Just in case the idea of editing files concerns you.

The LogFile configuration item has the capability to accept variables in order for
steamcast to dynamically generate log file names at run-time.  The full table of
variables available are as follows.

%a					Abbreviated weekday name

%A					Full weekday name

%b					Abbreviated month name

%B					Full month name

%c					Date and time representation appropriate for locale

%d					Day of month as decimal number (01  31)

%H					Hour in 24-hour format (00  23)

%I					Hour in 12-hour format (01  12)

%j					Day of year as decimal number (001  366)

%m					Month as decimal number (01  12)

%M					Minute as decimal number (00  59)

%p					Current locale's A.M./P.M. indicator for 12-hour clock

%S					Second as decimal number (00  59)

%U					Week of year as decimal number, with Sunday as first day of week (00  53)

%w					Weekday as decimal number (0  6; Sunday is 0)

%W					Week of year as decimal number, with Monday as first day of week (00  53)

%x					Date representation for current locale

%X					Time representation for current locale

%y					Year without century, as decimal number (00  99)

%Y					Year with century, as decimal number

%z, %Z				Either the time-zone name or time zone abbreviation, depending on operating system

%%					Percent sign

You can refer to your systems implementation for strftime for more information
about what types of variables may be available for modifying the date.

Some examples of usage:

	LogFile=%Y-%m-%d-steamcast.log

With this setting your log file will be rotated from day to day and easily chronologically
sorted.

	LogFile=%Y-steamcast.log

Log will be annual.  There are of course many variations of this technique to do log rotation
that logically suits your need.  Steamcast's default setting is to store everything in a single
log file.  Please note that steamcast will need to be running as a user who has permission
to create files in the log's directory


Starting Steamcast
==================
Steamcast can be start in two ways.  You can simply open or execute
the steamcast executable located in the installation directory.  This will
start steamcast up and have it load it's configuration from a default location.
This location is from the current directory you are located in it or by reference.
It will look for steamcast.conf to pull in it's configuration values.  If no
configuation file is found it assumes defaults.

You can also start steamcast in a console environment and add the location of the
configuration file as a parameter.  (i.e. ./steamcast steamcast.conf)  Steamcast
will look for the file through the location and name provided here.  If no
configuration file is found it assumes defaults.

In unix environments you can start the server and send it into the background
Typically the best way to do this is to issue the following command in a console
environment: ./steamcast > /dev/null &

This will start the server and discard it's output.  If you like to keep tabs
on what steamcast is doing you can place it into a screen environment instead
or you can tail the steamcast.log file, or whatever you log file is configured
to be.  A handy way would be running: tail -f steamcast.log

Stopping Steamcast
==================
In windows to stop steamcast simple go to the console window in which it is running
and use your keyboard to input (CTRL+C)

In unix you have several methods.  You can use CTRL+C if the active program in the window
is steamcast.  However if the program is in the background it will be neccessary to 
signal the server to quit.  You can use the PID which is generated in the log or in
the specified pid file (default: steamcast.pid)  This id can be used to tell steamcast
what to do.  At your console simply type: kill -s TERM pid
Wher pid is the Process ID stored in the pid file or log.  If you are sure that
there is only one instance of Steamcast running, or at least there should be.  You can
also use the killall command:  killall steamcast
This command is handy if for whatever reason steamcast is or could still be running
and you don't want it to be running and you don't know it's pid because you possibly
executed steamcast while one was already running and overwrote the pid file.

License
=======
1) You are hereby granted a revokable license to use this software in binary
   form for any purpse you see fit, for commerical or non-commerical reasons.

2) Unless explicitly stated in writing you are not granted permission to
   distribute Steamcast in any form, including but not limited to, 
   electronic information service distribution, bulletin board distribution, 
   and magnetic or optical medium distribution.

3) You are also not granted permission to alter Steamcast.  This includes
   but is not limited to, altering the name or version information or modifying
   the copyright marks within the program.

4) Radio Toolbox and it's authors/owners are not responsible for what is
   transmitted through Steamcast.

THIS SOFTWARE IS PROVIDED BY IT'S AUTHOR AND IT'S AUTHORIZED DISTRIBUTERS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL IT'S AUTHOR OR IT'S AUTHORIZED
DISTRIBUTERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.

By using Steamcast you agree to the above agreement.

Version History
===============
1.0.2 decennium
* Fixed Socket leaking in Linux.
* Fixed race condition in Receivers.
* Fixed inaccurate bytes sent/received count.
* Fixed metadata escaping issues.
* Fixed race condition in MountList.
+ Added handling of termination singals.


1.0.1 decennium
* Reworked Thread Pool to no longer be specific to Receivers.
* Sockets are now handled by a class.
* Better handling of chunked connections.
* Better processing of incoming stream.
* Graceful disconnect of kicked receivers.
* Fix hanging mounts.
* Fix hanging publications.
* Fix hanging Name Lookup Thread.
* Improved metadata management.
* Fix race conditions in publications.
* Fix race conditions in receivers.
* Fix relay retry messages displaying incorrect times.
* Mount is now more responsive to relay changes.
* Fix incorrectly identified receiver disconnect message.
+ ServIP can now have multiple definitions for listening to multiple IPs.
+ PortBase can now have multiple definitions for listening to multiple Ports.
+ Socket Timeout configurable via SocketTimeout.
+ Hostname is now configurable via Webpanel.


1.0.0 decennium
* Better build identification
* 64 bit compatibility on Windows (installer will auto detect and install the correct build for your system)
* Improved memory management of buffers
* Fix threading race conditions
* Improved logging capabilities
* Fix hanging publication threads
* Allow Client requests up to 10KB
* Better form and request management
* Better AJAX updating (Works much better in Chrome)
* Improvements to local socket binding for outgoing requests
* Use Flash only when Browser does not support format
* Improvements to string error conversion
* Memory management Improvements to ICY meta data support
* Config uses first item as default when only one item is needed but many exist
* Improvements to thread locking
* Effeciency improvments to client response code
* Bitrate information is now more real time
* Improvements to client booting when buffer size is not properly detected
* Effeciency improvements to buffer
* Fix indefinite source thread hangs due to poor network conditions from source side
* Fix memory leaks in SHOUTcast source socket
* GCC 4.8 is now required for all Steamcast builds (GLIBC 2.15)
* Improvements to shutdown performance
* Fix memory leak in W3C logging
* Graceful disconnects no longer show error string
* Improvements to Buffer long term stability
* Filter meta data from SHOUTcast 1 servers that might happen to relay Steamcast (fixes crashing on SHOUTcast)
* Proper reset of packet buffer and reader when sources drop
* Panel consistancy improvments and style fixes
+ Session List management
+ Allow multipart form message parsing
+ Addition of "UploadLimit" and "MaxRequestBufferSize" options
+ UTF8 aware and conversion capabilities from legacy sources using latin1
+ Clean and sanitize external inputs before displaying on web panel
+ JSON and JSONP support (addition of /status.json and /admin/status.json which mimics functionality in xml stats sheets)
+ Custom tags exposed to stats sheets
+ Hex display of internal data added to webpanel (support feature only)
+ Non-standard Icy meta data is now parsed into custom meta fields.
+ Mounts can now be restricted to IP and port
+ Addition of "Debug" configuration item to allow more detailed logging (may cause poor performance)
+ Additional checks done before a stream can be listed on SHOUTcast.
+ Use chunked encoding for all Steamcast Relaying where available (Meta data now passed in an HTTP/1.1 standards correct way)
+ PUT added to list of allowable methods in OPTIONs requests
+ Allow listeners to be safely migrated from one source to another.
+ Average Quarter Hour (AQH) stat added to all mounts.
+ Allow stats to be reset in web panel

0.9.9 beta:
* Complete rework of core handles over 10K listeners at 128kbps on a Windows 8 system with 4 cores
* Ogg continuation packets are now properly handled for metadata and first packet.
* Ogg incoming Buffer increased to the largest possible packet size.
* Better threading model for all internal services
* Better ICY protocol detection
* Fixed many race conditions
* Higher performance thread locking
* Better Unique id associated with every request.
* Fixes to stat counters.
* Performance enhancements in Log
* Tweak panel for HTML5 validation
* Kick all listeners when Steamcast is shutting down.
* Better memory management
* Many small fixes to improve performance and stability
+ "?icy=y" locks mount to ICY protocol
+ "?http=y" locks mount to HTTP protocol
+ All new User Management panel
+ Configure all aspects of the server from within Webpanel
+ Default Mount settings added.  Use either Default<OptionName> in config or in the panel tab while logged in as an admin.
+ Multiple source user definitions using the Web Panel
+ Tabbed interface
+ Mount Manager user definition one user can maintain multiple mounts.
+ Ban/Connection filtering based on CIDR as well as IP
+ Add Mounts in Realtime.
+ External Steamcast links added
+ Build date is friendlier to read.
+ Version information added to About page.
+ Metadata pass through to XML sheet on supported formats.
+ Authentication of listeners readded.
+ Notify options allow authentication scripts to be notified of new connections based on Icecast2 notify capabilities.
+ Publication list details tab for each mount
+ Mount specific user management.
+ Backup mount feature added back in.  (Still must be of similar encoding or it won't work)
+ HTTP/1.1 Protocol server supports all current HTTP 1.1 features including keep-alive
+ Source from HTTP PUT request (Falls back to ICE/1.0 source)
+ Transfer-Encoding chunked supported for indefinite streaming to a HTTP/1.1 based client.
+ Basic Windows service support
+ Linux Daemon capability with -k flag
+ IPv6 support. (Experiemental)
+ Digest Authentication for all HTTP/1.1 connections (more secure than basic)
+ Listener table sort
+ Basic Session management (requires client accept cookie)
+ Configureless mode.  Command window will provide link to follow to login to panel and configure from there.
+ Steamcast will now auto save it's config 5 secs after last change.
- steamcast.ban is no longer needed, use steamcast-users.xml or User Management panel to configure

0.9.8 beta:
* REBOOT!!! Complete and Total rewrite of all aspects of Steamcast.
* Fixed Security vulnerabilities reported on the web and by users.
* Better Memory management to make Steamcast far more stable then it ever was.
* Utilizing newer C++ standards.  All old C code is being phased out.  Buffer overruns will be a thing of the past.
* Limits moved into per Mount configuration
+ Source Configuration requires appended number to designate ownership (makes for easier reading by the user)
+ Mount Buffers are Format smart for certain supported audio formats (MP3, AAC, OGG)
+ FLV, HTML 5 support
+ Web Panel updates and refresh.  So many things were removed and/or changed, added.
* Log handling Threaded out, increases performance.
* Many threading improvements to prevent deadlocks/memory thrashing.
* Configuration changes, please review them in stemacast-default.conf file.  Configuration files from 0.9.75 or earlier will not work properly.
- Removed OnDemand support (for now).  This needs to be written to be better.

0.9.75 beta:
* Fixed various internal thread hanging issues.
* Fixed session seperation issues in the web interface.
* Fixed tail log, more accurately includes event line.
+ Added multiple targets for actions in Client list.
+ Added ability to move listeners to different sources.
* Fixed pre-packaged files for *nix usage.

0.9.74 beta:
* Load config now parses more correctly, whitespace at the beginning of lines is ignored,
  however the line will not be.  This should make configuration less confusing.
+ SourceRelay can now be set to multiple locations, on failure the server will iterate
  through the list until it finds a working relay.
+ On Demand capability added, read new configuration for more details.
+ On Demand File Index added to view mount page.
+ Added Mime Types file, please use this file to properly configure steamcast
  for file extension to mime type mapping in on demand.
+ Added Auto Extension mapping for mount names without extensions.  First extension
  used from mime.types file for virtual mapping.
* SHOUTcast ice directory protocal handler updated to fix many minor logical problems which
  caused listing session to end prematurely.
+ Added more logging to connection activity for debug purposes.  Try not to be paranoid!
  The internet is full of request attempts that fail for various reasons.
+ Steamcast's default configuration name is now derived from the binary's name passed via
  the command line.  This allowed for greater flexibility with Windows services.
+ WIN32 Services Support, you can install Steamcast as a Service with the -k switch, use
  -k install to install or -k remove to remove. (very beta)
* Fixed Mathmatical Error in Formatted Time displays.  Hours should no longer switch to days.
* Fixed buffer read overflow on Source invalid password errors
* Fixed various client syncronization issues.
+ Can now edit mounts from web interface
* MetaInterval is now handled in a more correct way.  (this one was a big one)  Relays can
  now be any metadata interval and steamcast will work.  (PLEASE TEST THIS WITH MANY RELAYS!!!)
+ MetaInterval config item added which will manipulate the steamcast meta data interval for all
  sources.  This should also fix some issues with the SourceBackup feature.
+ SourceDisconnectWait added to source config, you can now select how long Steamcast will wait
  to try reconnecting to the source when in Relay mode.
+ LogFile config item has been updated to include new variable entry capabilities.  Read the
  LogFile variables section of this document.
* Fixed some core issues with listener data locking and reverse DNS.
+ Added support for the HTTP POST, HEAD and TRACE methods.
+ Added support for wildcards in ban control, use * to mask a block of text and use ? for
  single characters.  Ex: SomeAgent* would block SomeAgent/1.2 and SomeAgent/3.4 etc.
  IP net masks are now wild card based as well.  192.168.* would block everything from this
  class B block.  All pre-0.9.74 subnet bans will need to be updated to include wildcards.
* Fixed issues relating to invalid socket error testing
* Linux: Made linux build statically compile against libcstd++ for wider binary compatibility
* Various stability improvements with regards to the web interface.
+ Windows Installer created.

0.9.73 beta:
* Fixed issue with multiple directory entries not being seen in config files on Linux.
+ Internal buffer fixed at 1MB, use SourceBuffUtil to adjust usage as neccessary.
* Client streams now start quicker by sending audio data on connect rather then waiting
  for source thread to take care of the new client.
* Configuration file now mentions the need to have different passwords for admin from
  encoders in SHOUTcast compatibility mode.
+ SourceAvgBitrateLimit now chokes sources exceeding the limit, better way to do this
  then the old kick source method.  Read the sample config file for more information on 
  how it works.  NEEDS LOTS OF TESTING!!!
* FreeBSD Crash bugs fixed.

0.9.72 beta:
* Threading model adjusted, no more spawning threads to handle connections.
  Steamcast uses a thread pool now, this needs fairly extensive testing.
  See configuration item ThreadPool for more information.
* Unix build split into identifying branches for builds (Linux, FreeBSD), for debug purposes as
  well as stack size differences.
* Bitrate detection now uses last 15sec average which is a little safer.  Remember to set your
  bitrate limits a little higher then what you really want due to data spikes.
  Bitrate detection now applied to client list as well as the Total Bandwidth usage of the
  Server
+ Added MaxBandwidth, which allows one to apply a soft restriction on concurrent bandwidth usage.
* Fixed crash condition in password feedback on SHOUTcast sources.
+ New Admin protected XML document encompassing more statistical details.
+ New src parameter handling for XML content, you can pass the mount name in a 
  GET request and retrieve only that source.
+ Added Authentication capability to url parsers/connection capabilities. (EX: http://user:pass@host)
+ Steamcast now tracks meta data changes for reporting purposes. (see next entry)
+ Last Played Interface added as well as ShowLastPlayed Configuration Item
* Instances of 'Mount' replaced with the actual mount name in logging.
+ Inactive Source table added to admin interface.
* Authentication for web pages and admin features now follows source definitions.
+ Sources can now be disabled/enabled on the fly.
* Fixed ogg playback in players who pass icy-metadata in headers even though they don't
  use it.  Tisk tisk those lazy programmers. :p
* Fixed issue with source encoders passing invalid ogg pages causing weirdness in Steamcast.
* Truncation on hostnames in tables are now done to the front rather then end of string.
* Listener/Source Counts pulled from trees rather then using old silly count methods.
* Flash compatibility added.  See Configuration file for details.
* Silly RealTime Display bugs fixed.  I suck.

0.9.71 beta:
* statistical data storage re-examined and changed
* unique listener counts added for yp.shoutcast.com compatibility
+ SourceAuthMax added, allows you to specify the amount of connections
  allowed for each individual user. (Works only when SourceAuth is enabled)
* Fixed the premature No Data Flow Timeout problem in some unix systems.
* Some features of the log found to not be thread safe (duh!) Mutex locking added.
+ Added unique listener counts, mainly for complete alignment with yp.shoutcast.com
  guidlines. (plus it's a nifty stat to have anyhow ;)
* Admin pages and functions are now exempt from UserAgent checks for more complete compatibility
  with Icecast2 tools.
* Icecast2 Style YP updates are now using the POST method.
* Fixed an issue where an extra carriage return, line feed pair was causing steamcast servers
  not to be listed on steamcast.com or any other webserver that might find that confusing.

0.9.7 beta:
+ Network Interface Management Code, can now specify which IP's Steamcast should bind to.
+ Network Interface Management Code, can now specify SourceIP under Source Mounts to make
  that source the default for the specified SourceIP.  (allows multiple mounts to list at
  shoutcast.com)  SourceIsDefault is disabled when using SourceIP.
* Repaired source counter when relaying, dropped mounts would sometimes cause inaccurate
  counts to occur.
* Cleaned a little code, starting to polish off the live stream features.
+ Interface to HTTP Authentication for live streams added, see SourceAuth and
  steamauth.txt
* Removed Administrative privileges from Encoder User's admin Panel.
+ Client timeouts for data flow loss (keeps people from staying connected while paused)
+ Source timeouts for data flow loss (keeps sources from staying connected while no
  data flows)
+ bans and vips are now saved and loaded.
+ SourceBackup added to configuration to send clients connected to a disconnected source
  to an active source while primary source is down (works only in non-OGG streams). This 
  is experimental.
+ /listen.asx virtual file added to steamcast's playlist generation capabilities for those
  who would like to have more direct ways to your stream for Windows Media Player.
* Fixed Icecast2 Source Support (broken in 0.9.61 oopsy)
+ Added Icecast2 Mpeg metadata support (which means we now officially support both protocols
  fully :)
* Fixed Some Statistical Integer Issues.

0.9.61 beta:
+ Added status.xml document (Encoding is iso-8859-1)
* Fixed buffer overflows in HTTP Response Header (affected some unix systems)
* Fixed potential buffer overflow issues in Request Header Handling (more secure now)
* Updated ice yp module to include new params for Max Listeners, Content Type, Sub Type, Average Listening Time, Long Tuneins, Tuneins
* Updated name lookup now a service thread.
+ SHOUTcast.com YP code now clusters and honors icy-backup
* Rewrote some of the yp coding for more efficiency in managing code
* Cleaned up WSA code for WIN32 version
* SHOUTcast Meta StreamUrl is now handled fully backup's are also honored
+ Added Realtime status display and Configuration option RealtimeLog to enable/disable it
+ Added ScreenLog configuration option to enable/disable screen log
+ Relaying supports ogg/vorbis (still some bugs related to mp3 meta data though)
* Unix shutdown re-examined and recoded

0.9.6 beta:
+ ice-audio-info is now honored and passed transparently to Icecast2 directories as well as the stream
+ Better Ogg Support, OGG receiving capabilities better tuned.  Some aspects still need work
+ Added PidFile configuration variable
+ Added ClientTimeout configuration variable
+ Added SourceBuffUtil configuration variable
+ Added YPLog configuration variable
+ Updated Startup header to mention the existence of this file and the Steamcast license
+ Added SourceRelay configuration variable and relaying support (not complete on yp end yet) No OGG support yet.
* Client Dead locking fixed on heavy traffic servers
* Various Code Optimizations
- Removed Sleep code which could cause heavy traffic servers to have problems in unix. (may cause lockups at source)
* Threading model optimized. (still many things to do)
+ Added version description
* Fixed Crash Bug in updinfo
* Socket Reuse is enabled so you can now restart your server without waiting on TCP WAIT signals
TODO: There is a problem with compiled linux versions which allows DNS resolution to cause crashing, if you
experience this problem then please disable YP code.  I am still hunting this one.  Me thinks gethostbyaddr is not
thread safe.

0.9.5 beta:
+ initial beta release


/*********************************/
/* Third party Software Licenses */
/*********************************/

RapidJSON https://github.com/Tencent/rapidjson
==============================================

Tencent is pleased to support the open source community by making RapidJSON available. 
 
Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip.  All rights reserved.

If you have downloaded a copy of the RapidJSON binary from Tencent, please note that the RapidJSON binary is licensed under the MIT License.
If you have downloaded a copy of the RapidJSON source code from Tencent, please note that RapidJSON source code is licensed under the MIT License, except for the third-party components listed below which are subject to different license terms.  Your integration of RapidJSON into your own projects may require compliance with the MIT License, as well as the other licenses applicable to the third-party components included within RapidJSON. To avoid the problematic JSON license in your own projects, it's sufficient to exclude the bin/jsonchecker/ directory, as it's the only code under the JSON license.
A copy of the MIT License is included in this file.

Other dependencies and licenses:

Open Source Software Licensed Under the BSD License:
--------------------------------------------------------------------

The msinttypes r29 
Copyright (c) 2006-2013 Alexander Chemeris 
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of  copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Open Source Software Licensed Under the JSON License:
--------------------------------------------------------------------

json.org 
Copyright (c) 2002 JSON.org
All Rights Reserved.

JSON_checker
Copyright (c) 2002 JSON.org
All Rights Reserved.

	
Terms of the JSON License:
---------------------------------------------------

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

The Software shall be used for Good, not Evil.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


Terms of the MIT License:
--------------------------------------------------------------------

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


TinyXML2 https://github.com/leethomason/tinyxml2
================================================
Original code by Lee Thomason (www.grinninglizard.com)

This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
damages arising from the use of this software.

Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation
would be appreciated but is not required.

2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.

3. This notice may not be removed or altered from any source
distribution.


OpenSSL https://github.com/openssl/openssl/
===========================================

  OpenSSL License
  ---------------

/* ====================================================================
 * Copyright (c) 1998-2019 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. All advertising materials mentioning features or use of this
 *    software must display the following acknowledgment:
 *    "This product includes software developed by the OpenSSL Project
 *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
 *
 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
 *    endorse or promote products derived from this software without
 *    prior written permission. For written permission, please contact
 *    openssl-core@openssl.org.
 *
 * 5. Products derived from this software may not be called "OpenSSL"
 *    nor may "OpenSSL" appear in their names without prior written
 *    permission of the OpenSSL Project.
 *
 * 6. Redistributions of any form whatsoever must retain the following
 *    acknowledgment:
 *    "This product includes software developed by the OpenSSL Project
 *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
 *
 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 * ====================================================================
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */

 Original SSLeay License
 -----------------------

/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
 * This library is free for commercial and non-commercial use as long as
 * the following conditions are aheared to.  The following conditions
 * apply to all code found in this distribution, be it the RC4, RSA,
 * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
 * included with this distribution is covered by the same copyright terms
 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
 *
 * Copyright remains Eric Young's, and as such any Copyright notices in
 * the code are not to be removed.
 * If this package is used in a product, Eric Young should be given attribution
 * as the author of the parts of the library used.
 * This can be in the form of a textual message at program startup or
 * in documentation (online or textual) provided with the package.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *    "This product includes cryptographic software written by
 *     Eric Young (eay@cryptsoft.com)"
 *    The word 'cryptographic' can be left out if the rouines from the library
 *    being used are not cryptographic related :-).
 * 4. If you include any Windows specific code (or a derivative thereof) from
 *    the apps directory (application code) you must include an acknowledgement:
 *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
 *
 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 * The licence and distribution terms for any publically available version or
 * derivative of this code cannot be changed.  i.e. this code cannot simply be
 * copied and put under another distribution licence
 * [including the GNU Public Licence.]
 */