+ int ret;
+ const char *designator[] = {SB_DESIGNATORS_ARRAY};
+
+ if (!sbb)
+ return 0;
+ if (sbb->band < NUM_SB_DESIGNATORS)
+ PARA_DEBUG_LOG("band: %s\n", designator[sbb->band]);
+
+ switch (sbb->band) {
+ case SBD_AWAITING_DATA:
+ ct->status = CL_SENDING;
+ ret = 1;
+ goto out;
+ case SBD_OUTPUT:
+ if (iov_valid(&sbb->iov))
+ btr_add_output(sbb->iov.iov_base, sbb->iov.iov_len,
+ ct->btrn[0]);
+ ret = 1;
+ goto out;
+ case SBD_DEBUG_LOG:
+ case SBD_INFO_LOG:
+ case SBD_NOTICE_LOG:
+ case SBD_WARNING_LOG:
+ case SBD_ERROR_LOG:
+ case SBD_CRIT_LOG:
+ case SBD_EMERG_LOG:
+ if (iov_valid(&sbb->iov)) {
+ int ll = sbb->band - SBD_DEBUG_LOG;
+ para_log(ll, "remote: %s", (char *)sbb->iov.iov_base);
+ }
+ ret = 1;
+ goto deallocate;
+ case SBD_EXIT__SUCCESS:
+ ret = -E_SERVER_CMD_SUCCESS;
+ goto deallocate;
+ case SBD_EXIT__FAILURE:
+ ret = -E_SERVER_CMD_FAILURE;
+ goto deallocate;
+ default:
+ PARA_ERROR_LOG("invalid band %d\n", sbb->band);
+ ret = -E_BAD_BAND;
+ goto deallocate;
+ }
+deallocate:
+ free(sbb->iov.iov_base);
+out:
+ sbb->iov.iov_base = NULL;
+ return ret;