113
RpcInPingCallback(char const **result, // OUT
114
size_t *resultLen, // OUT
115
const char *name, // IN
116
const char *args, // IN
117
size_t argsSize, // IN
118
void *clientData) // IN
123
RpcInPingCallback(RpcInData *data) // IN
120
return RpcIn_SetRetVals(result, resultLen, "", TRUE);
125
return RPCIN_SETRETVALS(data, "", TRUE);
393
status = cb->function(&result, &resultLen, cb->name,
394
reply + cb->length, repLen - cb->length,
399
if (cb->type == RPCIN_CB_OLD) {
400
status = cb->callback.oldCb((char const **) &result, &resultLen, cb->name,
401
reply + cb->length, repLen - cb->length,
404
RpcInData data = { cb->name,
411
status = cb->callback.newCb(&data);
412
result = data.result;
413
resultLen = data.resultLen;
414
freeResult = data.freeResult;
422
442
memcpy(in->last_result, statusStr, statusLen);
423
443
memcpy(in->last_result + statusLen, result, resultLen);
424
444
in->last_resultLen = statusLen + resultLen;
426
450
#if 0 /* Costly in non-debug cases --hpreg */
427
451
if (strlen(reply) <= 128) {
540
564
/* Register the 'reset' handler */
541
565
if (resetCallback) {
542
RpcIn_RegisterCallback(in, "reset", resetCallback, resetClientData);
566
RpcIn_RegisterCallbackEx(in, "reset", resetCallback, resetClientData);
545
RpcIn_RegisterCallback(in, "ping", RpcInPingCallback, NULL);
569
RpcIn_RegisterCallbackEx(in, "ping", RpcInPingCallback, NULL);
613
637
* RpcIn_RegisterCallback --
615
* Register a callback to happen when a TCLO message is
639
* Register an old-style callback to happen when a TCLO message is
616
640
* received. When a TCLO message beginning with 'name' is
617
641
* sent, the callback will be called with: the cmd name, the args
618
642
* (starting with the char directly after the cmd name; that's why
644
ASSERT(RpcInLookupCallback(in, name) == NULL); // not there yet
646
p = (RpcInCallbackList *) malloc(sizeof(RpcInCallbackList));
647
ASSERT_NOT_IMPLEMENTED(p);
649
p->length = strlen(name);
650
p->name = strdup(name);
651
p->function = callback;
668
ASSERT(RpcInLookupCallback(in, name) == NULL); // not there yet
670
p = (RpcInCallbackList *) malloc(sizeof(RpcInCallbackList));
671
ASSERT_NOT_IMPLEMENTED(p);
673
p->length = strlen(name);
674
p->name = strdup(name);
675
p->type = RPCIN_CB_OLD;
676
p->callback.oldCb = cb;
677
p->clientData = clientData;
679
p->next = in->callbacks;
686
*-----------------------------------------------------------------------------
688
* RpcIn_RegisterCallbackEx --
690
* Register a callback to happen when a TCLO message is
691
* received. When a TCLO message beginning with 'name' is
692
* sent, the callback will be called with an instance of
693
* "RpcInData" with the information from the request.
701
*-----------------------------------------------------------------------------
704
RpcIn_RegisterCallbackEx(RpcIn *in, // IN
705
const char *name, // IN
706
RpcIn_Callback cb, // IN
707
void *clientData) // IN
709
RpcInCallbackList *p;
711
Debug("Registering callback '%s'\n", name);
716
ASSERT(RpcInLookupCallback(in, name) == NULL); // not there yet
718
p = (RpcInCallbackList *) malloc(sizeof(RpcInCallbackList));
719
ASSERT_NOT_IMPLEMENTED(p);
721
p->length = strlen(name);
722
p->name = strdup(name);
723
p->type = RPCIN_CB_NEW;
724
p->callback.newCb = cb;
652
725
p->clientData = clientData;
654
727
p->next = in->callbacks;
687
760
for (cur = in->callbacks, prev = NULL; cur && strcmp(cur->name, name);
688
761
prev = cur, cur = cur->next);
691
764
* If we called UnregisterCallback on a name that doesn't exist, we
692
765
* have a problem.