/** * Detach from the device */ int muxTkTestDetach(void) { if (muxTkTestCookie == NULL) return -1; /* Not attached */ muxUnbind(muxTkTestCookie, MUX_PROTO_SNARF, muxTkTestRcvRtn); return 0; }
/** * called by MUX in response to muxDevUnload() * @param netCallbackId the handle/ID installed at bind time * * Disconnect this module from the MUX stack */ STATUS muxTkTestShutdownRtn(void * netCallbackId /* the handle/ID installed at bind time */) { return (muxUnbind(netCallbackId, MUX_PROTO_SNARF, muxTkTestRcvRtn)); }
void etherInputHookDelete ( FUNCPTR inputHook, char *pName, int unit ) { HOOK_ENTRY *pHookEnt; HOOK_ENTRY *pTarget = NULL; BOOL unbindFlag = TRUE; /* Remove handler if hook found? */ if (pName != NULL) /* END case */ { for (pHookEnt = (HOOK_ENTRY *)lstFirst(&inputHookList); pHookEnt != NULL; pHookEnt = (HOOK_ENTRY *)lstNext(&pHookEnt->node)) { /* Ignore BSD device hook entries. */ if (pHookEnt->pCookie == NULL) continue; if (STREQ(pHookEnt->name, pName) && (pHookEnt->unit == unit)) { if (pHookEnt->routine == inputHook) { /* * Found matching hook entry to remove. Keep searching * for other hooks on this device if needed. */ pTarget = pHookEnt; if (!unbindFlag) /* Another hook already found? */ break; } else { /* * Different hook on same driver - do not unbind. * Stop searching if target hook entry already found. */ unbindFlag = FALSE; if (pTarget) break; } } } if (pTarget) /* Remove hook entry if match found. */ { if (unbindFlag) /* Remove binding if last hook for device. */ { if (muxTkDrvCheck (pName)) { muxUnbind (pTarget->pCookie, MUX_PROTO_SNARF, nptEtherInputHookRtn); } else { muxUnbind (pTarget->pCookie, MUX_PROTO_SNARF, endEtherInputHookRtn); } } lstDelete (&inputHookList, &pTarget->node); free (pTarget); } } else /* 4.4 case */ { for (pHookEnt = (HOOK_ENTRY *)lstFirst(&inputHookList); pHookEnt != NULL; pHookEnt = pTarget) { if (pHookEnt->pCookie) /* Ignore END device hook entries. */ continue; pTarget = (HOOK_ENTRY *)lstNext(&pHookEnt->node); if (pHookEnt->routine == inputHook) { lstDelete(&inputHookList, &pHookEnt->node); free(pHookEnt); } } } if (lstCount(&inputHookList) <= 0) { etherInputHookActive = FALSE; /* No END driver hooks installed. */ etherInputHookRtn = NULL; /* No BSD driver hooks installed. */ lstFree (&inputHookList); } }