ZeroMQ Json Output

This is a complete patch that will allow the outputing of all alerts
to a zeromq PUB socket in JSON format.

New Config:
<ossec>
  <global>
      <zeromq_output>yes|no</zeromq_output>
          <zeromq_uri>tcp://localhost:11111</zeromq_uri>

Somethings had to change to allow this to work.  Based on the
preprossor defines
- WINDOWS was redefined by OSSEC and is used by GCC changed
  the define to to DECODER_WINDOWS
- __name was redefinied by OSSEC and is used by GCC changed
  the defeine to be __ossec_name
strcmp test was incorrect and would not correctly add the data
agent_config profiles for windows
fix openssl operations on non blocking socket
Fix potential infinite loop when adding new agent using file input

When adding a new agent using the -f option provided by manage_agents
there is a possibility that it loops infinitely if you have used up all
of the potential IDs. It will say that the ID needs to be unique since
the last ID checked is already in use. This commit adds a new message
stating the problem and prevents the infinite loop. It also increases
the amount of IDs manage_agents will look at when adding new agents both
in the interactive mode and when using the -f option.
Add remove agent cmd line option to manage_agents
Add TimeGenerated to the output of Windows Event Logs

Updated read_win_el.c to include TimeGenerated from an EVENTLOGRECORD
formatted into a human readable format for better logging. Also updated
the decoder to handle this change.
Fix the removal of start menu shortcuts for windows agent

Refer to
http://nsis.sourceforge.net/Shortcuts_removal_fails_on_Windows_Vista.
This fixes issues on machines that run Vista or newer.
Made the command line debug level take precedence over what is specified
in internal_options.conf.
Fixed agent.debug option in internal_options.conf

Doesn't look like agent.debug in the internal_options.conf ever worked.
This patch changes the behavior of the NIX agent to use whatever debeug
level is specified on the command line first. If no debug level was set
it will then look at the debug level set in the internal_options.conf.
Declare debug_level to 0 in ossec-agentd for NIX
Move debug determination logic so it happens before first debug
statement
Make syscheck.debug in internal_options.conf work

This should allow the user to specify a debug level for the syscheck
daemon on NIX machines using the syscheck.debug option in the
internal_options.conf. The debug level specified on the command line
takes precedence. Also, added starting up messages to match what some of
the daemons do.
Allow NIX agent to use "-f" option and run in foreground
Fix timeout comment in receiver-win.c
Make analysisd.debug in internal_options.conf work

This should allow the user to specify a debug level for the analysisd
daemon using the analysisd.debug option in the internal_options.conf.
The debug level specified on the command line takes precedence.
HandleClient should try to open the m_queue in WRITE mode instead of
READ after an error on SendMSG.
Add pid files for ossec-remoted children so they get cleaned up
on restart or stop
HandleClient should try to open the m_queue in WRITE mode instead of
READ

HandleClient does not ever exit after ossec is stopped or restarted
because the call to StartMQ on line 146 is for READ mode instead of
WRITE. When changed to WRITE, the StartMQ call fails and ossec-remoted
exits.
Validate if a file is readable text when report_changes is set

Syscheckd will save (in <ossec>/queue/diff/) any file with report_changes
option, e.g. /chroot/dev/urandom, iso, mp3. This patch integrates libmagic
to validate mime type. Only mime type beginning with 'text/', e.g. text/html,
text/plain, will be copied and reported by diff.