Jump to main content

##

# TCPIP_MODULE_SignalFunctionRegister Function

## C

    TCPIP_MODULE_SIGNAL_HANDLE TCPIP_MODULE_SignalFunctionRegister(
        TCPIP_STACK_MODULE moduleId,
        TCPIP_MODULE_SIGNAL_FUNC signalF
    );

## Description

This function registers a new signal function. This function will be called and the user notified when a stack internal signal occurs.

## Preconditions

The TCP/IP stack should have been initialized by TCPIP_STACK_Initialize() and the TCPIP_STACK_Status() returned SYS_STATUS_Ready.

## Parameters

Parameters | Description
--- | ---
moduleId | Module ID.
signalF | Signal function to be called when an internal signal occurs.

## Returns

- valid handle - If the operation succeeded.
- 0/invalid handle - If the operation failed (i.e, no such module, invalid handle, etc.).

## Remarks

There is currently no support for multiple signal functions. Each module supports just one signal function. A call to register a new module signal function will fail if a function is already registered. TCPIP_MODULE_SignalFunctionDeregister() needs to be called first

By default all stack modules, including the stack manager (TCPIP_MODULE_MANAGER()) are initialized with a null signal function. Explicit call is needed for setting a module signal function.

A signal handler can be registered for the stack manager itself (TCPIP_MODULE_MANAGER()). This will report RX and TMO signals.

The stack internal signaling mechanism is always active and cannot be disabled. This function is called on top of the normal stack signaling mechanism for a module that has a registered signal function.

## Example

    void appSignalFunc(TCPIP_STACK_MODULE moduleId, TCPIP_MODULE_SIGNAL signal, uintptr_t signalParam)
    {
        // process incoming signal for the incoming module
    }

    TCPIP_MODULE_SIGNAL_HANDLE signalH = TCPIP_MODULE_SignalFunctionRegister( TCPIP_MODULE_HTTP_SERVER, appSignalFunc);