AVIS: Refactoring avis middleware and payload bridges.

Summary:
Most of this work was conducted before QPID was fully implemented,
but this might be useful to make Avis a viable alternative (or as a
second reference bridge for testing purposes).

Primary changes :-

- Significant rewrite of how the transport bridge operates and also
  allow more than one transport to run at once (e.g. for separate pub
  dict_pub transports, similar to qpid).

- Add support for inbox-to-inbox functionality.  Details on this to
  follow in a separate patch for Mama.  This can be applied without
  support being "active" there yet.  Essentially it uses a new meta-
  attribute on an Avis payload to achieve it.

- Add support for enqueue callback functionality.  Avis also now
  utilises Mama queue for message processing rather than Wombat queue
  so that things like enqueue callbacks are properly invoked.

- Add support for payload wrapping (i.e. form of agnosticism) in the
  capability to send any payload through Avis.  This also enables the
  use of a payload that supports field names to allow Mama dictionary
  support.

- Fix for onDestroy not being invoked for subscription cleanup.

- Various fixes for memory leaks and some race conditions between
  receiving and sending messages.

- Build fix to allow avis to build against the payload bridge.

- Add support to copy attributes between Avis messages properly to
  avoid memory leaks and half-copies.

- Cleanup memory for attributes in Avis messages when destroying.

Notes :-

- Latest development snapshots of Avis required for the opaque
  functionality to work correctly.  Might work on latest release but it
  was buggy in the previous suggested version of Avis.

Signed-off-by: Lee Skillen <lskillen@vulcanft.com>

Test Plan: Run test applications, and check unit tests continue to pass.

Reviewers: frank

Differential Revision: http://review.openmama.org/D16
Merge branch 'next' of vulcanft.com:openmama-nyse into next

Conflicts:
	mama/c_cpp/src/c/bridge/avis/avisdefs.h
	mama/c_cpp/src/c/bridge/avis/publisher.c
	mama/c_cpp/src/c/bridge/avis/sub.c
	mama/c_cpp/src/c/payload/avismsg/SConscript
Fix conflict.
Merge branch 'next' of vulcanft.com:openmama-nyse into next
mamaDateTime_getAsString improvement when date only.

Summary:
mamaDateTime_getAsString improvement when date and time populated. There
is now one call to strftime instead of two. The strftime call on default
RH5.7 does various system calls underneath, hurting performance, so the
fewer calls is better. Tested also on RH6.2 where it does not do the
same system calls (change to strftime since 5.7), so has much less of an
effect and is similar to before change.
Should not change functionality.

Signed-off-by: Simon Shanks <simonshanksdev@gmail.com>

Test Plan:
Check builds and unit tests, prepare new tests, check with capturereplay
and mama/mamda test apps.

Reviewers: frank

Reviewed By: frank

Differential Revision: http://review.openmama.org/D22
COMMON: Fix memory leaks in common-based timers.

Summary:
- When destroying the timers heap, the dispatching thread is now joined
  and the socket pair (pipe) is closed, freeing the resources for both.

- When creating a timer, if the timer that has been passed in has been
  created before (which is usual in the onTimer/destroy/create chain of
  events), the existing timer is destroyed first to free its resources.

- Added CommonTestTimerC.createDestroySameTimer to test the above.

- QPid: Let the common code destroy the timer on resets.

Signed-off-by: Lee Skillen <lskillen@vulcanft.com>

Test Plan:
Validate unit tests, check build, and ensure unit tests run
successfully

Reviewers: frank

Reviewed By: frank

Differential Revision: http://review.openmama.org/D4
COMMON: Fix race condition in common-based queue unblocking.

Summary:
The queue in common code now uses an atomic (wInterlockedInt) variable
for tracking whether or not the queue is being unblocked (which is often
as a result of requiring to shut the queue down).

A race condition was observed when calling wombatQueue_unblock() in
which it was possible for the semaphore to be posted and the dispatch
thread to resume before the unblocking variable was set. This was seen
in helgrind, valgrind and in practice (middleware queue hanging).

This would result in a dispatch happening (regardless of whether there
is an item or not) and the dispatch thread continues to block. Prior
to the empty queue fix made in commit c985f942 this would have caused a
crash if the queue was empty.

The fix from commit c985f942 has been left in but it could probably be
taken out now that the unblocking variable is protected (we shouldn't
ever get into the body of dispatch now without an item actually being
available to dispatch).

No other changes - CommonQueueTestC.* unit tests executed successfully.

Signed-off-by: Lee Skillen <lskillen@vulcanft.com>

Test Plan: Check build and common queue unit tests.

Reviewers: frank

Reviewed By: frank

Differential Revision: http://review.openmama.org/D5
UNITTEST: Added missing payload and middleware enumerations to structure used in MamaEnumTestC tests.

Signed-off-by: Matt Mulhern <mmulhern@nyx.com>
Refresh acknowledgement processing broken on client side

Summary:
Refresh acks processing was broken on the client side resulting in extra refresh
traffic when multiple clients were subscribed to the same symbol

Signed-off-by: Gary Molloy <gmolloy@nyx.com>

Test Plan: Check details on BZ42

Reviewers: frank

Reviewed By: frank

Differential Revision: http://review.openmama.org/D7
Merge branch 'next' of vulcanft.com:openmama-nyse into next