qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@apache.org
Subject svn commit: r1625119 - in /qpid/proton/trunk/proton-c: CMakeLists.txt include/proton/event.h src/engine/engine.c src/engine/event.c src/engine/event.h src/events/ src/events/event.c src/transport/transport.c
Date Mon, 15 Sep 2014 19:19:16 GMT
Author: rhs
Date: Mon Sep 15 19:19:16 2014
New Revision: 1625119

URL: http://svn.apache.org/r1625119
Log:
moved event code into its own directory; made pn_collector_put public

Added:
    qpid/proton/trunk/proton-c/src/events/
    qpid/proton/trunk/proton-c/src/events/event.c
      - copied, changed from r1625048, qpid/proton/trunk/proton-c/src/engine/event.c
Removed:
    qpid/proton/trunk/proton-c/src/engine/event.c
    qpid/proton/trunk/proton-c/src/engine/event.h
Modified:
    qpid/proton/trunk/proton-c/CMakeLists.txt
    qpid/proton/trunk/proton-c/include/proton/event.h
    qpid/proton/trunk/proton-c/src/engine/engine.c
    qpid/proton/trunk/proton-c/src/transport/transport.c

Modified: qpid/proton/trunk/proton-c/CMakeLists.txt
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/CMakeLists.txt?rev=1625119&r1=1625118&r2=1625119&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/CMakeLists.txt (original)
+++ qpid/proton/trunk/proton-c/CMakeLists.txt Mon Sep 15 19:19:16 2014
@@ -280,7 +280,7 @@ set (qpid-proton-core
 
   src/dispatcher/dispatcher.c
   src/engine/engine.c
-  src/engine/event.c
+  src/events/event.c
   src/transport/transport.c
   src/message/message.c
   src/sasl/sasl.c

Modified: qpid/proton/trunk/proton-c/include/proton/event.h
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/include/proton/event.h?rev=1625119&r1=1625118&r2=1625119&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/include/proton/event.h (original)
+++ qpid/proton/trunk/proton-c/include/proton/event.h Mon Sep 15 19:19:16 2014
@@ -257,6 +257,25 @@ PN_EXTERN pn_collector_t *pn_collector(v
 PN_EXTERN void pn_collector_free(pn_collector_t *collector);
 
 /**
+ * Place a new event on a collector.
+ *
+ * This operation will create a new event of the given type and
+ * context and return a pointer to the newly created event. In some
+ * cases an event of the given type and context can be elided. When
+ * this happens, this operation will return a NULL pointer.
+ *
+ * @param[in] collector a collector object
+ * @param[in] type the event type
+ * @param[in] context the event context
+ *
+ * @return a pointer to the newly created event or NULL if the event
+ *         was elided
+ */
+
+pn_event_t *pn_collector_put(pn_collector_t *collector, pn_event_type_t type,
+                             void *context);
+
+/**
  * Access the head event contained by a collector.
  *
  * This operation will continue to return the same event until it is

Modified: qpid/proton/trunk/proton-c/src/engine/engine.c
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/src/engine/engine.c?rev=1625119&r1=1625118&r2=1625119&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/src/engine/engine.c (original)
+++ qpid/proton/trunk/proton-c/src/engine/engine.c Mon Sep 15 19:19:16 2014
@@ -33,7 +33,6 @@
 #include "../platform.h"
 #include "../platform_fmt.h"
 #include "../transport/transport.h"
-#include "../engine/event.h"
 
 // endpoints
 
@@ -332,8 +331,6 @@ void pn_endpoint_tini(pn_endpoint_t *end
   pn_condition_tini(&endpoint->condition);
 }
 
-#include "event.h"
-
 static bool pni_post_final(pn_endpoint_t *endpoint, pn_event_type_t type)
 {
   pn_connection_t *conn = pn_ep_get_connection(endpoint);
@@ -1734,3 +1731,77 @@ int pn_condition_redirect_port(pn_condit
   pn_data_rewind(data);
   return port;
 }
+
+pn_connection_t *pn_event_connection(pn_event_t *event)
+{
+  pn_session_t *ssn;
+  pn_transport_t *transport;
+
+  switch (pn_event_category(event)) {
+  case PN_EVENT_CATEGORY_CONNECTION:
+    return (pn_connection_t *) pn_event_context(event);
+  case PN_EVENT_CATEGORY_TRANSPORT:
+    transport = pn_event_transport(event);
+    if (transport)
+      return transport->connection;
+    return NULL;
+  default:
+    ssn = pn_event_session(event);
+    if (ssn)
+     return pn_session_connection(ssn);
+  }
+  return NULL;
+}
+
+pn_session_t *pn_event_session(pn_event_t *event)
+{
+  pn_link_t *link;
+  switch (pn_event_category(event)) {
+  case PN_EVENT_CATEGORY_SESSION:
+    return (pn_session_t *) pn_event_context(event);
+  default:
+    link = pn_event_link(event);
+    if (link)
+      return pn_link_session(link);
+  }
+  return NULL;
+}
+
+pn_link_t *pn_event_link(pn_event_t *event)
+{
+  pn_delivery_t *dlv;
+  switch (pn_event_category(event)) {
+  case PN_EVENT_CATEGORY_LINK:
+    return (pn_link_t *) pn_event_context(event);
+  default:
+    dlv = pn_event_delivery(event);
+    if (dlv)
+      return pn_delivery_link(dlv);
+  }
+  return NULL;
+}
+
+pn_delivery_t *pn_event_delivery(pn_event_t *event)
+{
+  switch (pn_event_category(event)) {
+  case PN_EVENT_CATEGORY_DELIVERY:
+    return (pn_delivery_t *) pn_event_context(event);
+  default:
+    return NULL;
+  }
+}
+
+pn_transport_t *pn_event_transport(pn_event_t *event)
+{
+  switch (pn_event_category(event)) {
+  case PN_EVENT_CATEGORY_TRANSPORT:
+    return (pn_transport_t *) pn_event_context(event);
+  default:
+    {
+      pn_connection_t *conn = pn_event_connection(event);
+      if (conn)
+        return pn_connection_transport(conn);
+      return NULL;
+    }
+  }
+}

Copied: qpid/proton/trunk/proton-c/src/events/event.c (from r1625048, qpid/proton/trunk/proton-c/src/engine/event.c)
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/src/events/event.c?p2=qpid/proton/trunk/proton-c/src/events/event.c&p1=qpid/proton/trunk/proton-c/src/engine/event.c&r1=1625048&r2=1625119&rev=1625119&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/src/engine/event.c (original)
+++ qpid/proton/trunk/proton-c/src/events/event.c Mon Sep 15 19:19:16 2014
@@ -1,6 +1,6 @@
-#include <proton/engine.h>
+#include <proton/object.h>
+#include <proton/event.h>
 #include <assert.h>
-#include "engine-internal.h"
 
 struct pn_collector_t {
   pn_event_t *head;
@@ -221,80 +221,6 @@ void *pn_event_context(pn_event_t *event
   return event->context;
 }
 
-pn_connection_t *pn_event_connection(pn_event_t *event)
-{
-  pn_session_t *ssn;
-  pn_transport_t *transport;
-
-  switch (pn_event_category(event)) {
-  case PN_EVENT_CATEGORY_CONNECTION:
-    return (pn_connection_t *)event->context;
-  case PN_EVENT_CATEGORY_TRANSPORT:
-    transport = pn_event_transport(event);
-    if (transport)
-      return transport->connection;
-    return NULL;
-  default:
-    ssn = pn_event_session(event);
-    if (ssn)
-     return pn_session_connection(ssn);
-  }
-  return NULL;
-}
-
-pn_session_t *pn_event_session(pn_event_t *event)
-{
-  pn_link_t *link;
-  switch (pn_event_category(event)) {
-  case PN_EVENT_CATEGORY_SESSION:
-    return (pn_session_t *)event->context;
-  default:
-    link = pn_event_link(event);
-    if (link)
-      return pn_link_session(link);
-  }
-  return NULL;
-}
-
-pn_link_t *pn_event_link(pn_event_t *event)
-{
-  pn_delivery_t *dlv;
-  switch (pn_event_category(event)) {
-  case PN_EVENT_CATEGORY_LINK:
-    return (pn_link_t *)event->context;
-  default:
-    dlv = pn_event_delivery(event);
-    if (dlv)
-      return pn_delivery_link(dlv);
-  }
-  return NULL;
-}
-
-pn_delivery_t *pn_event_delivery(pn_event_t *event)
-{
-  switch (pn_event_category(event)) {
-  case PN_EVENT_CATEGORY_DELIVERY:
-    return (pn_delivery_t *)event->context;
-  default:
-    return NULL;
-  }
-}
-
-pn_transport_t *pn_event_transport(pn_event_t *event)
-{
-  switch (pn_event_category(event)) {
-  case PN_EVENT_CATEGORY_TRANSPORT:
-    return (pn_transport_t *)event->context;
-  default:
-    {
-      pn_connection_t *conn = pn_event_connection(event);
-      if (conn)
-        return pn_connection_transport(conn);
-      return NULL;
-    }
-  }
-}
-
 const char *pn_event_type_name(pn_event_type_t type)
 {
   switch (type) {

Modified: qpid/proton/trunk/proton-c/src/transport/transport.c
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/src/transport/transport.c?rev=1625119&r1=1625118&r2=1625119&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/src/transport/transport.c (original)
+++ qpid/proton/trunk/proton-c/src/transport/transport.c Mon Sep 15 19:19:16 2014
@@ -30,8 +30,6 @@
 #include <stdarg.h>
 #include <stdio.h>
 
-#include "../engine/event.h"
-
 #include "../sasl/sasl-internal.h"
 #include "../ssl/ssl-internal.h"
 #include "../platform.h"



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message