datapath-windows/ovsext/User.c
/*
 * --------------------------------------------------------------------------
 *  Handler for the subscription for a packet queue
 * --------------------------------------------------------------------------
 */
Handler for the subscription for a packet queue
Handler for the subscription for a packet queue
NTSTATUS
OvsSubscribePacketCmdHandler(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
                             UINT32 *replyLen)
{
    NDIS_STATUS status;
    BOOLEAN rc;
    UINT8 join;
    UINT32 pid;
    const NL_POLICY policy[] =  {
        [OVS_NL_ATTR_PACKET_PID] = {.type = NL_A_U32 },
        [OVS_NL_ATTR_PACKET_SUBSCRIBE] = {.type = NL_A_U8 }
        };
    PNL_ATTR attrs[ARRAY_SIZE(policy)];
    UNREFERENCED_PARAMETER(replyLen);
    POVS_OPEN_INSTANCE instance =
        (POVS_OPEN_INSTANCE)usrParamsCtx->ovsInstance;
    POVS_MESSAGE msgIn = (POVS_MESSAGE)usrParamsCtx->inputBuffer;
    rc = NlAttrParse(&msgIn->nlMsg, sizeof (*msgIn),
         NlMsgAttrsLen((PNL_MSG_HDR)msgIn), policy, ARRAY_SIZE(policy),
                       attrs, ARRAY_SIZE(attrs));
    if (!rc) {
        status = STATUS_INVALID_PARAMETER;
        goto done;
    }
    join = NlAttrGetU8(attrs[OVS_NL_ATTR_PACKET_SUBSCRIBE]);
    pid = NlAttrGetU32(attrs[OVS_NL_ATTR_PACKET_PID]);
    ASSERT(pid == instance->pid);
    status = OvsSubscribeDpIoctl(instance, pid, join);
done:
    return status;
}
NTSTATUS OvsSubscribePacketCmdHandler ( POVS_USER_PARAMS_CONTEXT usrParamsCtx , UINT32 * replyLen ) { NDIS_STATUS status ; BOOLEAN rc ; UINT8 join ; UINT32 pid ; const NL_POLICY policy [ ] = { [ OVS_NL_ATTR_PACKET_PID ] = { . type = NL_A_U32 } , [ OVS_NL_ATTR_PACKET_SUBSCRIBE ] = { . type = NL_A_U8 } } ; PNL_ATTR attrs [ ARRAY_SIZE ( policy ) ] ; UNREFERENCED_PARAMETER ( replyLen ) ; POVS_OPEN_INSTANCE instance = ( POVS_OPEN_INSTANCE ) usrParamsCtx -> ovsInstance ; POVS_MESSAGE msgIn = ( POVS_MESSAGE ) usrParamsCtx -> inputBuffer ; rc = NlAttrParse ( & msgIn -> nlMsg , sizeof ( * msgIn ) , NlMsgAttrsLen ( ( PNL_MSG_HDR ) msgIn ) , policy , ARRAY_SIZE ( policy ) , attrs , ARRAY_SIZE ( attrs ) ) ; if ( ! rc ) { status = STATUS_INVALID_PARAMETER ; goto done ; } join = NlAttrGetU8 ( attrs [ OVS_NL_ATTR_PACKET_SUBSCRIBE ] ) ; pid = NlAttrGetU32 ( attrs [ OVS_NL_ATTR_PACKET_PID ] ) ; ASSERT ( pid == instance -> pid ) ; status = OvsSubscribeDpIoctl ( instance , pid , join ) ; done : return status ; }
Handler for the subscription for a packet queue
Handler for the subscription for a packet queue
/* The socket subscribed with must be the same socket we perform receive*/ /*
     * XXX Need to add this instance to a global data structure
     * which hold all packet based instances. The data structure (hash)
     * should be searched through the pid field of the instance for
     * placing the missed packet into the correct queue
     */