You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by ganeshmurthy <gi...@git.apache.org> on 2016/12/12 21:32:56 UTC

[GitHub] qpid-dispatch pull request #125: DISPATCH-557 - Moved management of connecti...

GitHub user ganeshmurthy opened a pull request:

    https://github.com/apache/qpid-dispatch/pull/125

    DISPATCH-557 - Moved management of connections from python agent to r\u2026

    \u2026outer core

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/ganeshmurthy/qpid-dispatch DISPATCH-557-2

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/qpid-dispatch/pull/125.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #125
    
----
commit bd86e6d00f90822b6ac0b1814e2d8a757b741a6b
Author: Ganesh Murthy <gm...@redhat.com>
Date:   2016-12-12T21:30:38Z

    DISPATCH-557 - Moved management of connections from python agent to router core

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] qpid-dispatch pull request #125: DISPATCH-557 - Moved management of connecti...

Posted by ted-ross <gi...@git.apache.org>.
Github user ted-ross commented on a diff in the pull request:

    https://github.com/apache/qpid-dispatch/pull/125#discussion_r92234050
  
    --- Diff: include/qpid/dispatch/router_core.h ---
    @@ -23,6 +23,7 @@
     #include <qpid/dispatch/bitmask.h>
     #include <qpid/dispatch/compose.h>
     #include <qpid/dispatch/parse.h>
    +typedef struct qdr_core_t         qdr_core_t;
    --- End diff --
    
    Please move this back down with the other typedefs.  You can add this line into router.h to solve the compilation issue.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] qpid-dispatch pull request #125: DISPATCH-557 - Moved management of connecti...

Posted by ted-ross <gi...@git.apache.org>.
Github user ted-ross commented on a diff in the pull request:

    https://github.com/apache/qpid-dispatch/pull/125#discussion_r92234597
  
    --- Diff: src/router_core/agent_connection.c ---
    @@ -0,0 +1,344 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *   http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +
    +#include <qpid/dispatch/ctools.h>
    +#include "agent_connection.h"
    +#include <inttypes.h>
    +#include <stdio.h>
    +
    +#define QDR_CONNECTION_IDENTITY         0
    +#define QDR_CONNECTION_HOST             1
    +#define QDR_CONNECTION_ROLE             2
    +#define QDR_CONNECTION_DIR              3
    +#define QDR_CONNECTION_CONTAINER_ID     4
    +#define QDR_CONNECTION_SASL_MECHANISMS  5
    +#define QDR_CONNECTION_IS_AUTHENTICATED 6
    +#define QDR_CONNECTION_USER             7
    +#define QDR_CONNECTION_IS_ENCRYPTED     8
    +#define QDR_CONNECTION_SSLPROTO         9
    +#define QDR_CONNECTION_SSLCIPHER        10
    +#define QDR_CONNECTION_PROPERTIES       11
    +#define QDR_CONNECTION_SSLSSF           12
    +
    +const char *qdr_connection_columns[] =
    +    {"identity",
    +     "host",
    +     "role",
    +     "dir",
    +     "container",
    +     "sasl",
    +     "isAuthenticated",
    +     "user",
    +     "isEncrypted",
    +     "sslProto",
    +     "sslCipher",
    +     "properties",
    +     "sslSsf",
    +     0};
    +
    +const char *CONFIG_CONNECTION_TYPE = "org.apache.qpid.dispatch.connection";
    +
    +
    +static void qd_get_next_pn_data(pn_data_t **data, const char **d, int *d1)
    +{
    +    if (pn_data_next(*data)) {
    +        switch (pn_data_type(*data)) {
    +            case PN_STRING:
    +                *d = pn_data_get_string(*data).start;
    +                break;
    +            case PN_SYMBOL:
    +                *d = pn_data_get_symbol(*data).start;
    +                break;
    +            case PN_INT:
    +                *d1 = pn_data_get_int(*data);
    +                break;
    +            default:
    +                break;
    +        }
    +    }
    +    }
    +
    +
    +static void qdr_connection_insert_column_CT(qdr_connection_t *conn, int col, qd_composed_field_t *body, bool as_map)
    +{
    +    char id_str[100];
    +
    +    if (as_map)
    +        qd_compose_insert_string(body, qdr_connection_columns[col]);
    +
    +    switch(col) {
    +    case QDR_CONNECTION_IDENTITY: {
    +        snprintf(id_str, 100, "%"PRId64, conn->identity);
    +        qd_compose_insert_string(body, id_str);
    +        break;
    +    }
    +
    +    case QDR_CONNECTION_HOST:
    +        qd_compose_insert_string(body, conn->connection_info->host);
    +        break;
    +
    +    case QDR_CONNECTION_ROLE:
    +        qd_compose_insert_string(body, conn->connection_info->role);
    +        break;
    +
    +    case QDR_CONNECTION_DIR:
    +        qd_compose_insert_string(body, conn->connection_info->dir);
    +        break;
    +
    +    case QDR_CONNECTION_CONTAINER_ID:
    +        if (conn->connection_info->container)
    +            qd_compose_insert_string(body, conn->connection_info->container);
    +        else
    +            qd_compose_insert_null(body);
    +        break;
    +
    +    case QDR_CONNECTION_SASL_MECHANISMS:
    +        qd_compose_insert_string(body, conn->connection_info->sasl_mechanisms);
    --- End diff --
    
    sasl_mechanisms is 0 if not specified.  That causes a crash here (easily reproducible by starting the web console).  If it's not present, this should insert a NULL into the body.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] qpid-dispatch pull request #125: DISPATCH-557 - Moved management of connecti...

Posted by ted-ross <gi...@git.apache.org>.
Github user ted-ross commented on a diff in the pull request:

    https://github.com/apache/qpid-dispatch/pull/125#discussion_r92235068
  
    --- Diff: src/router_core/connections.c ---
    @@ -107,6 +130,61 @@ void qdr_connection_set_context(qdr_connection_t *conn, void *context)
             conn->user_context = context;
     }
     
    +qdr_connection_info_t *qdr_connection_info(bool             is_encrypted,
    +                                           bool             is_authenticated,
    +                                           bool             opened,
    +                                           char            *sasl_mechanisms,
    +                                           const char      *dir,
    --- End diff --
    
    There is an enumerated type for direction.  You should use this rather than passing strings around.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] qpid-dispatch pull request #125: DISPATCH-557 - Moved management of connecti...

Posted by ted-ross <gi...@git.apache.org>.
Github user ted-ross commented on a diff in the pull request:

    https://github.com/apache/qpid-dispatch/pull/125#discussion_r92235417
  
    --- Diff: src/router_core/router_core_private.h ---
    @@ -439,10 +439,28 @@ typedef struct qdr_connection_work_t {
     ALLOC_DECLARE(qdr_connection_work_t);
     DEQ_DECLARE(qdr_connection_work_t, qdr_connection_work_list_t);
     
    +struct qdr_connection_info_t {
    +    const  char                *container;
    +    char                       *sasl_mechanisms;
    +    char                       *host;
    +    bool                        is_encrypted;
    +    char                       *ssl_proto;
    +    char                       *ssl_cipher;
    +    char                       *user;
    +    bool                        is_authenticated;
    +    bool                        opened;
    +    const char                 *dir;
    --- End diff --
    
    I think dir and role should use the enumerated types rather than arbitrary strings.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] qpid-dispatch pull request #125: DISPATCH-557 - Moved management of connecti...

Posted by ganeshmurthy <gi...@git.apache.org>.
Github user ganeshmurthy closed the pull request at:

    https://github.com/apache/qpid-dispatch/pull/125


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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