+ int rc;
+ TID_RESP *resp;
+
+ /* Check that this is a valid TID Request. If not, send an error return. */
+ if ((!mreq->tid_req) ||
+ (!mreq->tid_req->rp_realm) ||
+ (!mreq->tid_req->realm) ||
+ (!mreq->tid_req->comm)) {
+ printf("tids_handle_request():Not a valid TID Request.\n");
+ (*mresp)->tid_resp->result = TID_ERROR;
+ (*mresp)->tid_resp->err_msg = tr_new_name("Bad request format");
+ return -1;
+ }
+
+ /* Call the caller's request handler */
+ /* TBD -- Handle different error returns/msgs */
+ resp = (*mresp)->tid_resp;
+ if (0 > (rc = (*tids->req_handler)(tids, mreq->tid_req, &resp, tids->cookie))) {
+ /* set-up an error response */
+ (*mresp)->tid_resp->result = TID_ERROR;
+ if (!(*mresp)->tid_resp->err_msg) /* Use msg set by handler, if any */
+ (*mresp)->tid_resp->err_msg = tr_new_name("Internal processing error");
+ }
+ else {
+ /* set-up a success response */
+ (*mresp)->tid_resp->result = TID_SUCCESS;
+ (*mresp)->tid_resp->err_msg = NULL; /* No msg on successful return */
+ }
+
+ return rc;