Transport now directly used to send response packets instead of searching based on...
authorJustin Sobota <jsobota@ti.com>
Thu, 25 Apr 2013 18:44:50 +0000 (14:44 -0400)
committerJustin Sobota <jsobota@ti.com>
Thu, 25 Apr 2013 18:44:50 +0000 (14:44 -0400)
include/rm_loc.h
include/rm_transportloc.h
rm.h
rm_transport.h
src/rm.c
src/rm_services.c
src/rm_transport.c
test/rm_transport_setup.c
test/src/rm_mem_test.c
test/src/rm_test.c

index a2b919f884bdabd77236ac103e18b6cd4c863621..dd6539ff6f938771ad989acc9ba25a64e3ae7964 100644 (file)
@@ -68,12 +68,13 @@ typedef struct Rm_Transaction_s {
      * The RM instance that receives the response will 
      * match the response packet with the originating request using the ID */
     uint32_t                 remoteOriginatingId;
-    /* Name of the RM instance that generated the packet that resulted
-     * in the creation of the service transaction.  Used to send the response
-     * packet. */
-    char                     pktSrcInstName[RM_NAME_MAX_CHARS];
-    /* Transaction service callback function */
-    Rm_ServiceCallback       callback;
+    /* Transaction response mechanism union */
+    union {
+        /* Service callback function if received locally via Service API */
+        Rm_ServiceCallback   callback;
+        /* Transport handle to send response packet on if received via Transport rcv API */
+        Rm_Transport        *respTrans;
+    } u;
     /* Transaction state.  The codes are defined in rm.h */
     int32_t                  state;
     /* Transaction has been forwarded to CD or Server instance.  Waiting for response */
index 2106b259f665a6ac52f813a3263e096aa21f1d57..74e064daa0e63b69dc1b858d98ef17c1a4d4c582 100644 (file)
@@ -78,8 +78,6 @@ typedef struct Rm_Transport_s {
     Rm_AppTransportHandle  appTransportHandle;
     /* Remote RM instance type */
     Rm_InstType            remoteInstType;
-    /* Remote RM instance name */
-    char                   remoteInstName[RM_NAME_MAX_CHARS];
     /* Transport callout functions provided by application during transport
      * registration */
     Rm_TransportCallouts   callouts;    
@@ -176,7 +174,6 @@ typedef struct {
     int32_t  requestState;
 } Rm_NsResponsePkt;
 
-Rm_Transport *rmTransportFindRemoteName(Rm_Transport *transports, const char *remoteName);
 Rm_Transport *rmTransportFindRemoteInstType(Rm_Transport *transports, Rm_InstType remoteInstType);
 
 #ifdef __cplusplus
diff --git a/rm.h b/rm.h
index f61840c2904a90428fd6ee5ea41597b06867ca88..91947c78aa9bc74868f6dc3ddef8940075dba594 100644 (file)
--- a/rm.h
+++ b/rm.h
@@ -323,40 +323,37 @@ extern "C" {
 #define RM_ERROR_TRANSPORT_ALLOC_PKT_NOT_REGD      RM_ERROR_BASE-37
 /** RM attempted to send a packet but the rmSendPkt callout was not registered */
 #define RM_ERROR_TRANSPORT_SEND_NOT_REGD           RM_ERROR_BASE-38
-/** RM attempted to send a response packet but the transport to the remote instance that sent
- *  the request packet is not registered */
-#define RM_ERROR_TRANSPORT_REMOTE_HNDL_NOT_REGD    RM_ERROR_BASE-39
 /** RM instance cannot be deleted with transports still registered */
-#define RM_ERROR_CANT_DELETE_WITH_REGD_TRANSPORT   RM_ERROR_BASE-40
+#define RM_ERROR_CANT_DELETE_WITH_REGD_TRANSPORT   RM_ERROR_BASE-39
 /** RM instance cannot be deleted with open service handle */
-#define RM_ERROR_CANT_DELETE_WITH_OPEN_SERV_HNDL   RM_ERROR_BASE-41
+#define RM_ERROR_CANT_DELETE_WITH_OPEN_SERV_HNDL   RM_ERROR_BASE-40
 /** RM instance cannot be deleted when there are transactions pending and the 
  *  ignorePendingServices parameter is set to false */
-#define RM_ERROR_CANT_DELETE_PENDING_TRANSACTIONS  RM_ERROR_BASE-42
+#define RM_ERROR_CANT_DELETE_PENDING_TRANSACTIONS  RM_ERROR_BASE-41
 /** Only the Server instance can be used to return resource status via the
  *  Rm_resourceStatus API */
-#define RM_ERROR_INVALID_RES_STATUS_INSTANCE       RM_ERROR_BASE-43
+#define RM_ERROR_INVALID_RES_STATUS_INSTANCE       RM_ERROR_BASE-42
 /** RM Shared Server and Client instances should always return a finished request since 
  *  the instance has access to the resource structures no matter what core the service
  *  is requested from */
-#define RM_ERROR_SHARED_INSTANCE_UNFINISHED_REQ    RM_ERROR_BASE-44
+#define RM_ERROR_SHARED_INSTANCE_UNFINISHED_REQ    RM_ERROR_BASE-43
 /** RM Shared Server and Client instances cannot register transports */
-#define RM_ERROR_SHARED_INSTANCE_CANNOT_REG_TRANS  RM_ERROR_BASE-45
+#define RM_ERROR_SHARED_INSTANCE_CANNOT_REG_TRANS  RM_ERROR_BASE-44
 /** RM Shared Client handle was provided an invalid Shared Server handle.  The shared
  *  server handle was either NULL or was not an instance of type Rm_instType_SHARED_SERVER */
-#define RM_ERROR_INVALID_SHARED_SERVER_HANDLE      RM_ERROR_BASE-46
+#define RM_ERROR_INVALID_SHARED_SERVER_HANDLE      RM_ERROR_BASE-45
 /** A RM Client failed to create a new transaction to request data from the Server in order
  *  to potentially process a transaction on a Client Delegate */
-#define RM_ERROR_TRANS_REQ_TO_SERVER_NOT_CREATED   RM_ERROR_BASE-47
+#define RM_ERROR_TRANS_REQ_TO_SERVER_NOT_CREATED   RM_ERROR_BASE-46
 /** Service request required a policy check but instance was not initialized with a policy */
-#define RM_ERROR_INSTANCE_HAS_NO_POLICY            RM_ERROR_BASE-48
+#define RM_ERROR_INSTANCE_HAS_NO_POLICY            RM_ERROR_BASE-47
 /** RM Client Delegate was not provided a policy at initialization */
-#define RM_ERROR_INVALID_CD_CONFIGURATION          RM_ERROR_BASE-49
+#define RM_ERROR_INVALID_CD_CONFIGURATION          RM_ERROR_BASE-48
 /** RM CD freed local resources which allowed a free request of local request to be sent to
  *  the Server.  The Server free failed so the CD tried to realloc the local resources 
  *  that were originally freed.  The re-allocate operation failed causing a resource loss
  *  on the CD */
-#define RM_ERROR_LOST_RESOURCES_ON_CD              RM_ERROR_BASE-50 
+#define RM_ERROR_LOST_RESOURCES_ON_CD              RM_ERROR_BASE-49 
 
 /** 
  * @brief Maximum number of characters allowed for RM instance, resource, and
index f530a7fcad942a0f54dd0fc5256da1bed0aa8476..03e3b93356e1925bc78e87b0451fe76f588e3a35 100644 (file)
@@ -207,9 +207,6 @@ typedef struct {
     /** Remote RM instance type at other end of the application transport 
      *  "pipe". */
     Rm_InstType            remoteInstType;
-    /** Pointer to the remote RM instance name at other end of the 
-     *  application transport "pipe". */
-    const char            *remoteInstName;
     /** Pointers to application implemented transport APIs.  The APIs for the
      *  provided functions must match the prototypes defined in the
      *  #Rm_TransportCallouts structure.  Callouts need to be defined
@@ -221,6 +218,27 @@ typedef struct {
     Rm_TransportCallouts   transportCallouts;   
 } Rm_TransportCfg;
 
+/** 
+ * @brief RM transport reconfiguration structure
+ */
+typedef struct {
+    /** Application transport handle associated with the registered
+     *  transport.  This value can be anything that helps the application
+     *  identify the application transport "pipe" for which a RM packet
+     *  should be sent on.  For example, a QMSS queue number, network
+     *  port data structure, etc. */
+    Rm_AppTransportHandle  appTransportHandle;
+    /** Pointers to application implemented transport APIs.  The APIs for the
+     *  provided functions must match the prototypes defined in the
+     *  #Rm_TransportCallouts structure.  Callouts need to be defined
+     *  for each registered transport.  However, based on the application's
+     *  implementation of transport code the same function can be provided
+     *  for each transport registration.  In these cases, the transport
+     *  must mux/demux the packets it receives from RM based on the 
+     *  #Rm_TransportHandle. */
+    Rm_TransportCallouts   transportCallouts;   
+} Rm_TransportReCfg;
+
 /**
  *  @b Description
  *  @n  
@@ -256,6 +274,26 @@ typedef struct {
  */
 Rm_TransportHandle Rm_transportRegister(const Rm_TransportCfg *transportCfg, int32_t *result);
 
+/**
+ *  @b Description
+ *  @n  
+ *      This function reconfigures an existing transport handle using the
+ *      provided transport configurations
+ *
+ *  @param[in]  transportHandle
+ *      Transport handle to unregister.  The RM instance that the handle will
+ *      be unregistered from is contained within the transportHandle.
+ *
+ *  @param[in]  transportReCfg
+ *      Pointer to the transport registration configuration structure.
+ *
+ *  @retval
+ *      Success - #RM_OK
+ *  @retval
+ *      Failure - #RM_ERROR_TRANSPORT_HANDLE_DOES_NOT_EXIST
+ */
+int32_t Rm_transportReconfig (Rm_TransportHandle transportHandle, const Rm_TransportReCfg *transportReCfg);
+
 /**
  *  @b Description
  *  @n  
index c19695b058a4b322902193fd67aed75c29251fbb..f6abbd6c48d262ed5670a9b69554946c12891171 100644 (file)
--- a/src/rm.c
+++ b/src/rm.c
@@ -237,9 +237,9 @@ static void serviceResponder (Rm_Inst *rmInst, Rm_Transaction *transaction)
         serviceResponse.resourceLength = transaction->resourceInfo.length;
     }
 
-    if (transaction->callback.serviceCallback) {
+    if (transaction->u.callback.serviceCallback) {
         /* Issue the callback to the requesting component with the response information */
-        transaction->callback.serviceCallback(&serviceResponse);
+        transaction->u.callback.serviceCallback(&serviceResponse);
         /* Delete the transaction from the transaction queue */
         rmTransactionQueueDelete(rmInst, transaction->localId);
     }
@@ -259,44 +259,40 @@ static void serviceResponder (Rm_Inst *rmInst, Rm_Transaction *transaction)
  */
 static void transactionResponder (Rm_Inst *rmInst, Rm_Transaction *transaction)
 {
-    Rm_Transport    *dstTransport = NULL;
+    Rm_Transport    *dstTransport = transaction->u.respTrans;
     Rm_Packet       *rmPkt = NULL;
     Rm_PacketHandle  pktHandle = NULL;
 
-    if (dstTransport = rmTransportFindRemoteName(rmInst->transports, transaction->pktSrcInstName)) {
-        rmPkt = dstTransport->callouts.rmAllocPkt(dstTransport->appTransportHandle, 
-                                                  sizeof(Rm_Packet), &pktHandle);
-        if (!rmPkt || !pktHandle) {
-            transaction->state = RM_ERROR_TRANSPORT_ALLOC_PKT_ERROR;
-            goto errorExit;
-        }
+    rmPkt = dstTransport->callouts.rmAllocPkt(dstTransport->appTransportHandle, 
+                                              sizeof(Rm_Packet), &pktHandle);
+    if (!rmPkt || !pktHandle) {
+        transaction->state = RM_ERROR_TRANSPORT_ALLOC_PKT_ERROR;
+        goto errorExit;
+    }
 
-        switch (transaction->type) {
-            case Rm_service_RESOURCE_ALLOCATE_INIT:
-            case Rm_service_RESOURCE_ALLOCATE_USE:
-            case Rm_service_RESOURCE_STATUS:
-            case Rm_service_RESOURCE_FREE:
-            case Rm_service_RESOURCE_GET_BY_NAME:
-                createResourceResponsePkt(rmPkt, transaction);
-                break;
-            case Rm_service_RESOURCE_MAP_TO_NAME:
-            case Rm_service_RESOURCE_UNMAP_NAME:
-                createNsResponsePkt(rmPkt, transaction);
-                break;
-        }
-        if (dstTransport->callouts.rmSendPkt(dstTransport->appTransportHandle, pktHandle) < RM_OK) {
-            transaction->state = RM_ERROR_TRANSPORT_SEND_ERROR;
-            goto errorExit;
-        }
-        
-        /* Response packet sent: Delete transaction from queue */
-        rmTransactionQueueDelete(rmInst, transaction->localId);
+    switch (transaction->type) {
+        case Rm_service_RESOURCE_ALLOCATE_INIT:
+        case Rm_service_RESOURCE_ALLOCATE_USE:
+        case Rm_service_RESOURCE_STATUS:
+        case Rm_service_RESOURCE_FREE:
+        case Rm_service_RESOURCE_GET_BY_NAME:
+            createResourceResponsePkt(rmPkt, transaction);
+            break;
+        case Rm_service_RESOURCE_MAP_TO_NAME:
+        case Rm_service_RESOURCE_UNMAP_NAME:
+            createNsResponsePkt(rmPkt, transaction);
+            break;
     }
-    else {
-        transaction->state = RM_ERROR_TRANSPORT_REMOTE_HNDL_NOT_REGD;
+    if (dstTransport->callouts.rmSendPkt(dstTransport->appTransportHandle, pktHandle) < RM_OK) {
+        transaction->state = RM_ERROR_TRANSPORT_SEND_ERROR;
+        goto errorExit;
     }
+    
+    /* Response packet sent: Delete transaction from queue */
+    rmTransactionQueueDelete(rmInst, transaction->localId);
+
 errorExit:
-    /* Do not delete transaction on transport error.  Transport rrror transactions should be visible
+    /* Do not delete transaction on transport error.  Transport error transactions should be visible
      * from Rm_printInstanceStatus() */
     return;
 }
@@ -1380,7 +1376,6 @@ void Rm_instanceStatus(Rm_Handle rmHandle)
         Rm_osalLog("\nRegistered Transports:\n");
         while (transportList) {
             RM_SS_OBJ_INV(transportList, Rm_Transport);
-            Rm_osalLog("    Remote instName:    %s\n", transportList->remoteInstName);
             if (transportList->remoteInstType == Rm_instType_SERVER) {
                 Rm_osalLog("    Remote instType:    Server\n");
             }
index d0036f82ee3fe4455642c09f82cdae3061bb089e..2b0355f2fb3ee4c91028101d7adbe7cf31fe94e4 100644 (file)
@@ -122,7 +122,7 @@ void Rm_serviceHandler (void *rmHandle, const Rm_ServiceReqInfo *serviceRequest,
     if (transaction) {
         transaction->type = serviceRequest->type;
         strncpy(transaction->serviceSrcInstName, instanceName, RM_NAME_MAX_CHARS);
-        transaction->callback.serviceCallback = serviceRequest->callback.serviceCallback;
+        transaction->u.callback.serviceCallback = serviceRequest->callback.serviceCallback;
         transaction->state = RM_SERVICE_PROCESSING;
         if (serviceRequest->resourceName) {
             strncpy(transaction->resourceInfo.name, serviceRequest->resourceName, RM_NAME_MAX_CHARS);
@@ -148,7 +148,7 @@ void Rm_serviceHandler (void *rmHandle, const Rm_ServiceReqInfo *serviceRequest,
         }
         else {
             if ((transaction->state == RM_SERVICE_PROCESSING) && 
-                (transaction->callback.serviceCallback == NULL)) {
+                (transaction->u.callback.serviceCallback == NULL)) {
                 /* Block until response is received.  Response will be received in transaction. */
                 Rm_osalTaskBlock(rmInst->blockHandle);
             }
index 18502da772d8850b6cbad3f4b4db4541588dfe54..38126d229f9288d7b02fa217d6dbea857ddeab8e 100644 (file)
@@ -76,7 +76,6 @@ static Rm_Transport *transportAdd(const Rm_TransportCfg *transportCfg)
         newTransport->rmHandle = transportCfg->rmHandle;\r
         newTransport->appTransportHandle = transportCfg->appTransportHandle;\r
         newTransport->remoteInstType = transportCfg->remoteInstType;\r
-        strncpy(newTransport->remoteInstName, transportCfg->remoteInstName, RM_NAME_MAX_CHARS);\r
         newTransport->callouts.rmAllocPkt = transportCfg->transportCallouts.rmAllocPkt;\r
         newTransport->callouts.rmSendPkt = transportCfg->transportCallouts.rmSendPkt;\r
         newTransport->nextTransport = NULL;\r
@@ -147,24 +146,6 @@ static void transportDelete(Rm_Transport *transport)
  ********************** Internal Functions ****************************\r
  **********************************************************************/\r
 \r
-/* FUNCTION PURPOSE: Finds a transport based on remote inst name\r
- ***********************************************************************\r
- * DESCRIPTION: Returns a pointer to the transport within an instance's\r
- *              transport list that matches the provided remote\r
- *              instance name.  NULL is returned if no transports in \r
- *              the list match the remote instance name.\r
- */\r
-Rm_Transport *rmTransportFindRemoteName(Rm_Transport *transports, const char *remoteName)\r
-{\r
-    while (transports) {\r
-        if (strncmp(transports->remoteInstName, remoteName, RM_NAME_MAX_CHARS) == 0) {\r
-            break;             \r
-        }\r
-        transports = transports->nextTransport;\r
-    }\r
-    return (transports);\r
-}\r
-\r
 /* FUNCTION PURPOSE: Finds a transport based on remote inst type\r
  ***********************************************************************\r
  * DESCRIPTION: Returns a pointer to the transport within an instance's\r
@@ -216,58 +197,86 @@ Rm_TransportHandle Rm_transportRegister (const Rm_TransportCfg *transportCfg, in
         goto errorExit;\r
     }\r
 \r
-    if (transport = rmTransportFindRemoteName(rmInst->transports, transportCfg->remoteInstName)) {\r
-        /* Reconfigure existing transport's appTransportHandle.  Used in cases where instances\r
-         * running on same core connected by function call. */\r
-        transport->appTransportHandle = transportCfg->appTransportHandle;\r
+    /* No one can connect to a shared server\r
+     * RM Servers cannot connect to other Servers.  \r
+     * RM Client Delegates cannot connect to other Client Delegates.\r
+     * RM Clients cannot connect to other Clients */\r
+    if ((transportCfg->remoteInstType == Rm_instType_SHARED_SERVER) ||\r
+        ((rmInst->instType == Rm_instType_SERVER) &&\r
+         (transportCfg->remoteInstType == Rm_instType_SERVER)) ||\r
+        ((rmInst->instType == Rm_instType_CLIENT_DELEGATE) &&\r
+         (transportCfg->remoteInstType == Rm_instType_CLIENT_DELEGATE)) ||\r
+        ((rmInst->instType == Rm_instType_CLIENT) &&\r
+         (transportCfg->remoteInstType == Rm_instType_CLIENT))) {\r
+        *result = RM_ERROR_INVALID_REMOTE_INST_TYPE;\r
+        goto errorExit;\r
     }\r
-    else {\r
-        /* No one can connect to a shared server\r
-         * RM Servers cannot connect to other Servers.  \r
-         * RM Client Delegates cannot connect to other Client Delegates.\r
-         * RM Clients cannot connect to other Clients */\r
-        if ((transportCfg->remoteInstType == Rm_instType_SHARED_SERVER) ||\r
-            ((rmInst->instType == Rm_instType_SERVER) &&\r
-             (transportCfg->remoteInstType == Rm_instType_SERVER)) ||\r
-            ((rmInst->instType == Rm_instType_CLIENT_DELEGATE) &&\r
-             (transportCfg->remoteInstType == Rm_instType_CLIENT_DELEGATE)) ||\r
-            ((rmInst->instType == Rm_instType_CLIENT) &&\r
-             (transportCfg->remoteInstType == Rm_instType_CLIENT))) {\r
-            *result = RM_ERROR_INVALID_REMOTE_INST_TYPE;\r
-            goto errorExit;\r
-        }\r
 \r
-        /* Verify Clients are not registering with more than one Client Delegate or Server. And\r
-         * that Client Delegate is not registering with more than one Server. */\r
-        if (rmInst->registeredWithDelegateOrServer &&\r
-            (((rmInst->instType == Rm_instType_CLIENT) &&\r
-              (transportCfg->remoteInstType == Rm_instType_CLIENT_DELEGATE)) || \r
-             ((rmInst->instType == Rm_instType_CLIENT_DELEGATE) &&\r
-              (transportCfg->remoteInstType == Rm_instType_SERVER)))) {\r
-            *result = RM_ERROR_ALREADY_REGD_SERVER_OR_CD;\r
-            goto errorExit;\r
-        }         \r
-        \r
-        if (!transportCfg->transportCallouts.rmAllocPkt) {\r
-            *result = RM_ERROR_TRANSPORT_ALLOC_PKT_NOT_REGD;\r
-            goto errorExit;\r
-        }\r
-        else if (!transportCfg->transportCallouts.rmSendPkt) {\r
-            *result = RM_ERROR_TRANSPORT_SEND_NOT_REGD;\r
-            goto errorExit;\r
-        }\r
+    /* Verify Clients are not registering with more than one Client Delegate or Server. And\r
+     * that Client Delegate is not registering with more than one Server. */\r
+    if (rmInst->registeredWithDelegateOrServer &&\r
+        (((rmInst->instType == Rm_instType_CLIENT) &&\r
+          (transportCfg->remoteInstType == Rm_instType_CLIENT_DELEGATE)) || \r
+         ((rmInst->instType == Rm_instType_CLIENT_DELEGATE) &&\r
+          (transportCfg->remoteInstType == Rm_instType_SERVER)))) {\r
+        *result = RM_ERROR_ALREADY_REGD_SERVER_OR_CD;\r
+        goto errorExit;\r
+    }         \r
+    \r
+    if (!transportCfg->transportCallouts.rmAllocPkt) {\r
+        *result = RM_ERROR_TRANSPORT_ALLOC_PKT_NOT_REGD;\r
+        goto errorExit;\r
+    }\r
+    else if (!transportCfg->transportCallouts.rmSendPkt) {\r
+        *result = RM_ERROR_TRANSPORT_SEND_NOT_REGD;\r
+        goto errorExit;\r
+    }\r
 \r
-        transport = transportAdd(transportCfg);\r
-        if ((transport->remoteInstType == Rm_instType_CLIENT_DELEGATE) ||\r
-            (transport->remoteInstType == Rm_instType_SERVER)) {\r
-            rmInst->registeredWithDelegateOrServer = RM_TRUE;\r
-        }\r
+    transport = transportAdd(transportCfg);\r
+    if ((transport->remoteInstType == Rm_instType_CLIENT_DELEGATE) ||\r
+        (transport->remoteInstType == Rm_instType_SERVER)) {\r
+        rmInst->registeredWithDelegateOrServer = RM_TRUE;\r
     }\r
 errorExit:\r
     RM_SS_INST_WB_EXIT_CS(key);    \r
     return ((Rm_TransportHandle) transport);\r
 }\r
 \r
+/* FUNCTION PURPOSE: Reconfigures an instance's transport handle\r
+ ***********************************************************************\r
+ * DESCRIPTION: Reconfigures a transport handle based on the provided\r
+ *              configuration parameters if it exists within the \r
+ *              instance.\r
+ */\r
+int32_t Rm_transportReconfig (Rm_TransportHandle transportHandle, const Rm_TransportReCfg *reCfg)\r
+{\r
+    Rm_Transport *transport = (Rm_Transport *)transportHandle;\r
+    Rm_Inst      *rmInst = (Rm_Inst *)transport->rmHandle;\r
+    void         *key;\r
+    int32_t       retVal = RM_OK;\r
+\r
+    RM_SS_INST_INV_ENTER_CS(key);\r
+\r
+    if (transportIsRegistered(transport->rmHandle, transport)) {\r
+        /* Reconfigure existing transport's appTransportHandle.  Used in cases where instances\r
+         * running on same core connected by function call. */\r
+        transport->appTransportHandle = reCfg->appTransportHandle;\r
+\r
+        if (reCfg->transportCallouts.rmAllocPkt) {\r
+            transport->callouts.rmAllocPkt = reCfg->transportCallouts.rmAllocPkt;\r
+        }\r
+        if (reCfg->transportCallouts.rmSendPkt) {\r
+            transport->callouts.rmSendPkt = reCfg->transportCallouts.rmSendPkt;\r
+        }\r
+    }\r
+    else {\r
+        retVal = RM_ERROR_TRANSPORT_HANDLE_DOES_NOT_EXIST;\r
+    }        \r
+\r
+    RM_SS_INST_WB_EXIT_CS(key);    \r
+    return (retVal);\r
+}\r
+\r
 /* FUNCTION PURPOSE: Unregisters an app transport from a RM instance\r
  ***********************************************************************\r
  * DESCRIPTION: Deletes a registered transport from the transport\r
@@ -320,6 +329,7 @@ int32_t Rm_receivePacket(Rm_TransportHandle transportHandle, const Rm_Packet *pk
 \r
             transaction = rmTransactionQueueAdd(rmInst);\r
             transaction->remoteOriginatingId = resourceReqPkt->requestId;\r
+            transaction->u.respTrans = transport;\r
             if (resourceReqPkt->resourceReqType == Rm_resReqPktType_ALLOCATE_INIT) {\r
                 transaction->type = Rm_service_RESOURCE_ALLOCATE_INIT;\r
             }\r
@@ -335,7 +345,6 @@ int32_t Rm_receivePacket(Rm_TransportHandle transportHandle, const Rm_Packet *pk
             else if (resourceReqPkt->resourceReqType == Rm_resReqPktType_GET_NAMED) {\r
                 transaction->type = Rm_service_RESOURCE_GET_BY_NAME;\r
             }            \r
-            strncpy(transaction->pktSrcInstName, resourceReqPkt->pktSrcInstName, RM_NAME_MAX_CHARS);\r
             strncpy(transaction->serviceSrcInstName, resourceReqPkt->serviceSrcInstName, RM_NAME_MAX_CHARS);\r
             transaction->state = RM_SERVICE_PROCESSING;\r
             memcpy ((void *)&(transaction->resourceInfo), (void *)&(resourceReqPkt->resourceInfo),\r
@@ -380,6 +389,7 @@ int32_t Rm_receivePacket(Rm_TransportHandle transportHandle, const Rm_Packet *pk
 \r
             transaction = rmTransactionQueueAdd(rmInst);\r
             transaction->remoteOriginatingId = nsRequestPkt->requestId;\r
+            transaction->u.respTrans = transport;\r
 \r
             if (nsRequestPkt->nsRequestType == Rm_nsReqPktType_MAP_RESOURCE) {\r
                 transaction->type = Rm_service_RESOURCE_MAP_TO_NAME;\r
@@ -388,7 +398,6 @@ int32_t Rm_receivePacket(Rm_TransportHandle transportHandle, const Rm_Packet *pk
                 transaction->type = Rm_service_RESOURCE_UNMAP_NAME;\r
             }\r
 \r
-            strncpy(transaction->pktSrcInstName, nsRequestPkt->pktSrcInstName, RM_NAME_MAX_CHARS);\r
             strncpy(transaction->serviceSrcInstName, nsRequestPkt->serviceSrcInstName, RM_NAME_MAX_CHARS);\r
             transaction->state = RM_SERVICE_PROCESSING;\r
             memcpy ((void *)&(transaction->resourceInfo), (void *)&(nsRequestPkt->resourceInfo),\r
index 0071bfad00ac5ad76a580ee9c104bbeb706fa153..9f858270de226171bd0549d453461d26392bfedb 100644 (file)
@@ -336,8 +336,6 @@ void configRmTransportTsk(UArg arg0, UArg arg1)
             rmTransportCfg.rmHandle = rmHandle;
             rmTransportCfg.appTransportHandle = (Rm_AppTransportHandle) remoteRcvQId;
             rmTransportCfg.remoteInstType = Rm_instType_CLIENT;
-            System_sprintf (name, "RM_Client%d", i);
-            rmTransportCfg.remoteInstName = name;
             rmTransportCfg.transportCallouts.rmAllocPkt = rmTransPktAlloc;
             rmTransportCfg.transportCallouts.rmSendPkt = rmTransPktSend;
             rmTransportMap[i].transportHandle = Rm_transportRegister(&rmTransportCfg, &result);  
@@ -373,8 +371,6 @@ void configRmTransportTsk(UArg arg0, UArg arg1)
             rmTransportCfg.rmHandle = rmHandle;
             rmTransportCfg.appTransportHandle = (Rm_AppTransportHandle) remoteRcvQId;
             rmTransportCfg.remoteInstType = Rm_instType_SERVER;
-            System_sprintf (name, "RM_Server");
-            rmTransportCfg.remoteInstName = name;
             rmTransportCfg.transportCallouts.rmAllocPkt = rmTransPktAlloc;
             rmTransportCfg.transportCallouts.rmSendPkt = rmTransPktSend;
             rmTransportMap[i].transportHandle = Rm_transportRegister(&rmTransportCfg, &result);   
index 4ab57257a7ccb98116c1331b0ee778e9f8ce4514..c1ff7900ce765ccce1f2eba3af52964a4de18c81 100644 (file)
@@ -919,6 +919,7 @@ void testServerCdClient(void)
     char                clientName[RM_NAME_MAX_CHARS];
     Rm_Handle           serverHandle, cdHandle, clientHandle;
     Rm_TransportCfg     transCfg;
+    Rm_TransportReCfg   transReCfg;
     Rm_TransportHandle  serverToCd, cdToServer, cdToClient, clientToCd;
     Rm_ServiceHandle   *serviceHandle;
     Rm_ServiceReqInfo   request;
@@ -965,7 +966,6 @@ void testServerCdClient(void)
     memset((void *)&transCfg, 0, sizeof(transCfg));
     transCfg.rmHandle = serverHandle;
     transCfg.remoteInstType = Rm_instType_CLIENT_DELEGATE;
-    transCfg.remoteInstName = cdName;
     transCfg.appTransportHandle = NULL;
     transCfg.transportCallouts.rmAllocPkt = rmLocalPktAlloc;
     transCfg.transportCallouts.rmSendPkt = rmLocalPktSendRcv;
@@ -974,33 +974,27 @@ void testServerCdClient(void)
     /* Connect Client transports */
     transCfg.rmHandle = clientHandle;
     transCfg.remoteInstType = Rm_instType_CLIENT_DELEGATE;
-    transCfg.remoteInstName = cdName;
     clientToCd = Rm_transportRegister(&transCfg, &rmResult);
     ERROR_CHECK(RM_OK, rmResult, clientName, "Client Delegate transport registration failed");     
     /* Connect CD transports */
     transCfg.rmHandle = cdHandle;
     transCfg.remoteInstType = Rm_instType_SERVER;
-    transCfg.remoteInstName = serverName;
     transCfg.appTransportHandle = (Rm_AppTransportHandle) serverToCd;
     cdToServer = Rm_transportRegister(&transCfg, &rmResult);
     ERROR_CHECK(RM_OK, rmResult, cdName, "Server transport registration failed");
     transCfg.rmHandle = cdHandle;
     transCfg.remoteInstType = Rm_instType_CLIENT;
-    transCfg.remoteInstName = clientName;
     transCfg.appTransportHandle = (Rm_AppTransportHandle) clientToCd;
     cdToClient = Rm_transportRegister(&transCfg, &rmResult);
     ERROR_CHECK(RM_OK, rmResult, cdName, "Client transport registration failed");
     /* Reconfigure the Server and Client transports to CD with the CD transport handles for proper routing
      * in the rmLocalPktSendRcv function */
-    transCfg.rmHandle = serverHandle;
-    transCfg.remoteInstName = cdName;
-    transCfg.appTransportHandle =(Rm_AppTransportHandle) cdToServer;
-    Rm_transportRegister(&transCfg, &rmResult);
+    memset((void*)&transReCfg, 0, sizeof(transReCfg));
+    transReCfg.appTransportHandle =(Rm_AppTransportHandle) cdToServer;
+    rmResult = Rm_transportReconfig(serverToCd, &transReCfg);
     ERROR_CHECK(RM_OK, rmResult, serverName, "Client Delegate transport registration failed");
-    transCfg.rmHandle = clientHandle;
-    transCfg.remoteInstName = cdName;
-    transCfg.appTransportHandle = (Rm_AppTransportHandle) cdToClient;
-    Rm_transportRegister(&transCfg, &rmResult);
+    transReCfg.appTransportHandle = (Rm_AppTransportHandle) cdToClient;
+    rmResult = Rm_transportReconfig(clientToCd, &transReCfg);
     ERROR_CHECK(RM_OK, rmResult, clientName, "Client Delegate transport registration failed");    
 
     /* Open service handle on Client to send requests to Server via Client Delegate */
index 0c47e1665532b07c33c1d01f5ab2d13da6d8dde6..a2880436e6e9f5564e4bc65b9826e530fe2946e3 100644 (file)
@@ -1291,7 +1291,6 @@ void rmStartupTsk(UArg arg0, UArg arg1)
         rmTransportCfg.rmHandle = rmServerHandle;
         rmTransportCfg.appTransportHandle = (Rm_AppTransportHandle) serverToCdQId;
         rmTransportCfg.remoteInstType = Rm_instType_CLIENT_DELEGATE;
-        rmTransportCfg.remoteInstName = &rmCdName[0];
         rmTransportCfg.transportCallouts.rmAllocPkt = transportAlloc;
         rmTransportCfg.transportCallouts.rmSendPkt = transportSend;
         serverCdHandle = Rm_transportRegister(&rmTransportCfg, &result);
@@ -1319,7 +1318,6 @@ void rmStartupTsk(UArg arg0, UArg arg1)
         rmTransportCfg.rmHandle = rmCdHandle;
         rmTransportCfg.appTransportHandle = (Rm_AppTransportHandle) cdToServerQId;
         rmTransportCfg.remoteInstType = Rm_instType_SERVER;
-        rmTransportCfg.remoteInstName = &rmServerName[0];
         rmTransportCfg.transportCallouts.rmAllocPkt = transportAlloc;
         rmTransportCfg.transportCallouts.rmSendPkt = transportSend;
         cdServerHandle = Rm_transportRegister(&rmTransportCfg, &result);
@@ -1345,7 +1343,6 @@ void rmStartupTsk(UArg arg0, UArg arg1)
         /* Register the Client with the RM Client Delegate Instance */
         rmTransportCfg.appTransportHandle = (Rm_AppTransportHandle) cdToClientQId;
         rmTransportCfg.remoteInstType = Rm_instType_CLIENT;
-        rmTransportCfg.remoteInstName = &rmClientName[0];
         rmTransportCfg.transportCallouts.rmAllocPkt = transportAlloc;
         rmTransportCfg.transportCallouts.rmSendPkt = transportSend;
         cdClientHandle = Rm_transportRegister(&rmTransportCfg, &result);
@@ -1372,7 +1369,6 @@ void rmStartupTsk(UArg arg0, UArg arg1)
         rmTransportCfg.rmHandle = rmClientHandle;
         rmTransportCfg.appTransportHandle = (Rm_AppTransportHandle) clientToCdQId;
         rmTransportCfg.remoteInstType = Rm_instType_CLIENT_DELEGATE;
-        rmTransportCfg.remoteInstName = &rmCdName[0];
         rmTransportCfg.transportCallouts.rmAllocPkt = transportAlloc;
         rmTransportCfg.transportCallouts.rmSendPkt = transportSend;
         clientCdHandle = Rm_transportRegister(&rmTransportCfg, &result);