Example #1
0
void CheckCaption( TidyDocImpl* doc, Node *node )
{
    AttVal *attval;
    char *value = null;

    CheckAttributes( doc, node );

    for (attval = node->attributes; attval != null; attval = attval->next)
    {
        if ( tmbstrcasecmp(attval->attribute, "align") == 0 )
        {
            value = attval->value;
            break;
        }
    }

    if (value != null)
    {
        if ( tmbstrcasecmp(value, "left") == 0 ||
             tmbstrcasecmp(value, "right") == 0 )
            ConstrainVersion( doc, VERS_HTML40_LOOSE );
        else if ( tmbstrcasecmp(value, "top") == 0 ||
                  tmbstrcasecmp(value, "bottom") == 0 )
            ConstrainVersion( doc, ~(VERS_HTML20|VERS_HTML32) );
        else
            ReportAttrError( doc, node, attval, BAD_ATTRIBUTE_VALUE );
    }
}
Example #2
0
/* reports missing action attribute */
void CheckFORM( TidyDocImpl* doc, Node *node )
{
    AttVal *action = GetAttrByName( node, "action" );
    CheckAttributes( doc, node );
    if (!action)
        ReportMissingAttr( doc, node, "action");
}
Example #3
0
void CheckHR( TidyDocImpl* doc, Node *node )
{
    AttVal* av = GetAttrByName( node, "src" );
    CheckAttributes( doc, node );
    if ( av )
        ReportAttrError( doc, node, av, PROPRIETARY_ATTR_VALUE );
}
Example #4
0
/* reports missing content attribute */
void CheckMETA( TidyDocImpl* doc, Node *node )
{
    AttVal *content = GetAttrByName( node, "content" );
    CheckAttributes( doc, node );
    if ( ! content )
        ReportMissingAttr( doc, node, "content" );
    /* name or http-equiv attribute must also be set */
}
Example #5
0
void CheckTableCell( TidyDocImpl* doc, Node *node )
{
    CheckAttributes( doc, node );

    /*
      HTML4 strict doesn't allow mixed content for
      elements with %block; as their content model
    */
    if ( GetAttrByName(node, "width") 
         || GetAttrByName(node, "height") )
        ConstrainVersion( doc, ~VERS_HTML40_STRICT );
}
Example #6
0
/* add missing type attribute when appropriate */
void CheckSTYLE( TidyDocImpl* doc, Node *node )
{
    AttVal *type = GetAttrByName( node, "type" );

    CheckAttributes( doc, node );

    if ( !type )
    {
        AddAttribute( doc, node, "type", "text/css" );
        type = GetAttrByName( node, "type" );
        ReportAttrError( doc, node, type, INSERTING_ATTRIBUTE );
    }
}
Example #7
0
/* add missing type attribute when appropriate */
void CheckLINK( TidyDocImpl* doc, Node *node )
{
    AttVal *rel = GetAttrByName( node, "rel" );

    CheckAttributes( doc, node );

    if ( rel && rel->value &&
         tmbstrcmp(rel->value, "stylesheet") == 0 )
    {
        AttVal *type = GetAttrByName(node, "type");
        if (!type)
        {
            AddAttribute( doc, node, "type", "text/css" );
            type = GetAttrByName( node, "type" );
            ReportAttrError( doc, node, type, INSERTING_ATTRIBUTE );
        }
    }
}
Example #8
0
/* add missing type attribute when appropriate */
void CheckSCRIPT( TidyDocImpl* doc, Node *node )
{
    AttVal *lang, *type;
    char buf[16];

    CheckAttributes( doc, node );

    lang = GetAttrByName( node, "language" );
    type = GetAttrByName( node, "type" );

    if ( !type )
    {
        /*  ReportMissingAttr( doc, node, "type" );  */

        /* check for javascript */
        if ( lang )
        {
            tmbstrncpy( buf, lang->value, sizeof(buf) );
            buf[10] = '\0';

            if ( tmbstrncasecmp(buf, "javascript", 10) == 0 ||
                 tmbstrncasecmp(buf,    "jscript", 7) == 0 )
            {
                AddAttribute( doc, node, "type", "text/javascript" );
            }
            else if ( tmbstrcasecmp(buf, "vbscript") == 0 )
            {
                /* per Randy Waki 8/6/01 */
                AddAttribute( doc, node, "type", "text/vbscript" );
            }
        }
        else
            AddAttribute( doc, node, "type", "text/javascript" );
        type = GetAttrByName( node, "type" );
        ReportAttrError( doc, node, type, INSERTING_ATTRIBUTE );
    }
}
Example #9
0
void CheckMap( TidyDocImpl* doc, Node *node )
{
    CheckAttributes( doc, node );
    FixId( doc, node );
}
Example #10
0
/**
 * @brief oneM2M V1 request
 * @param[in] resourceType : oneM2M resource type value
 * @param[in] operation : operation
 * @param[in] to : target
 * @param[in] ri : request id
 * @param[in] pc : other attributes
 * @return int : result code
 */ 
int tp_oneM2M_V1_Request(int resourceType, int operation, char* to, char* ri, void* pc) {
    int rc = CheckAttributes(resourceType, operation, to, ri, pc);
    if(rc != TP_SDK_SUCCESS) {
        return rc;
    }
    char payload[1024];
    memset(payload, 0, sizeof(payload));
    
    SetHeader(payload, resourceType, operation, to, ri);

    switch(resourceType) {
        case CSEBase:
            {
            oneM2M_CSEBase* CSEBase = (oneM2M_CSEBase *)pc;
            oneM2M_Attribute attr = {ATTR_FR, CSEBase->ni};
            SetElement(payload, &attr, 1);
            }
            break;
        case node:
            {
            oneM2M_node* node = (oneM2M_node *)pc;
            oneM2M_Attribute attr[] = {{ATTR_FR, node->ni}, {ATTR_NM, node->ni}, {ATTR_DKEY, node->dKey}};
            SetElement(payload, attr, 3);
            if(operation != DELETE) {
                oneM2M_Attribute pc[] = {{ATTR_NI, node->ni}, {ATTR_HCL, node->hcl}, {ATTR_MGA, node->mga}};
                SetPCElement(payload, pc, resourceType, 3);
            }
            }
            break;
        case remoteCSE:
            {
            oneM2M_remoteCSE* remoteCSE = (oneM2M_remoteCSE *)pc;
            oneM2M_Attribute attr[] = {{ATTR_FR, remoteCSE->ni}, {ATTR_PASSCODE, remoteCSE->passCode}, {ATTR_DKEY, remoteCSE->dKey}, {ATTR_NM, remoteCSE->nm}};
            SetElement(payload, attr, 4);
            if(operation != DELETE) {
                oneM2M_Attribute pc[] = {{ATTR_CST, remoteCSE->cst}, {ATTR_CSI, remoteCSE->ni}, {ATTR_POA, remoteCSE->poa}, {ATTR_RR, remoteCSE->rr},  {ATTR_NL, remoteCSE->nl}};
                SetPCElement(payload, pc, resourceType, 5);
            }
            }
            break;            
        case container:
            {
            oneM2M_container* container = (oneM2M_container *)pc;
            oneM2M_Attribute attr[] = {{ATTR_FR, container->ni}, {ATTR_NM, container->nm}, {ATTR_DKEY, container->dKey}};
            SetElement(payload, attr, 3);
            if(operation != DELETE) {
                oneM2M_Attribute lbl = {ATTR_LBL, container->lbl};
                SetPCElement(payload, &lbl, resourceType, 1);
            }
            }
            break;
        case mgmtCmd:
            {
            oneM2M_mgmtCmd* mgmtCmd = (oneM2M_mgmtCmd *)pc;
            oneM2M_Attribute attr[] = {{ATTR_FR, mgmtCmd->ni}, {ATTR_NM, mgmtCmd->nm}, {ATTR_DKEY, mgmtCmd->dKey}, {ATTR_UKEY, mgmtCmd->uKey}};
            SetElement(payload, attr, 4);
            if(operation != DELETE) {
                oneM2M_Attribute pc[] = {{ATTR_CMT, mgmtCmd->cmt}, {ATTR_EXE, mgmtCmd->exe}, {ATTR_EXT, mgmtCmd->ext}, {ATTR_LBL, mgmtCmd->lbl}};
                SetPCElement(payload, pc, resourceType, 4);
            }
            }
            break;
        case contentInstance:
            {
            oneM2M_contentInstance* contentInstance = (oneM2M_contentInstance *)pc;
            oneM2M_Attribute attr[] = {{ATTR_FR, contentInstance->ni}, {ATTR_DKEY, contentInstance->dKey}};
            SetElement(payload, attr, 2);
            if(operation != DELETE) {
                oneM2M_Attribute pc[] = {{ATTR_CNF, contentInstance->cnf}, {ATTR_CON, contentInstance->con}, {ATTR_LBL, contentInstance->lbl}};
                SetPCElement(payload, pc, resourceType, 3);
            }
            }
            break;
        case locationPolicy:
            {
            oneM2M_locationPolicy* locationPolicy = (oneM2M_locationPolicy *)pc;
            oneM2M_Attribute attr[] = {{ATTR_FR, locationPolicy->ni}, {ATTR_DKEY, locationPolicy->dKey}, {ATTR_NM, locationPolicy->nm}};
            SetElement(payload, attr, 3);
            if(operation != DELETE) {
                oneM2M_Attribute pc[] = {{ATTR_LOS, locationPolicy->los}, {ATTR_LBL, locationPolicy->ni}};
                SetPCElement(payload, pc, resourceType, 2);
            }
            }
            break;
        case AE:
            {
            oneM2M_AE* AE = (oneM2M_AE *)pc;
            oneM2M_Attribute attr[] = {{ATTR_FR, AE->ni}, {ATTR_DKEY, AE->dKey}};
            SetElement(payload, attr, 2);
            if(operation != DELETE) {
                oneM2M_Attribute pc[] = {{ATTR_API, AE->api}, {ATTR_APN, AE->apn}};
                SetPCElement(payload, pc, resourceType, 2);
            }
            }
            break;
        case mgmtObj:
            {
            oneM2M_areaNwkInfo* areaNwkInfo = (oneM2M_areaNwkInfo *)pc;
            oneM2M_Attribute attr[] = {{ATTR_FR, areaNwkInfo->ni}, {ATTR_NM, areaNwkInfo->nm}, {ATTR_DKEY, areaNwkInfo->dKey}};
            SetElement(payload, attr, 3);
            if(operation != DELETE) {
                oneM2M_Attribute pc[] = {{ATTR_MGD, areaNwkInfo->mgd}, {ATTR_ANT, areaNwkInfo->ant}, {ATTR_LDV, areaNwkInfo->ldv}};
                SetPCElement(payload, pc, resourceType, 3);
            }
            }
            break;
        case execInstance:
            {
            oneM2M_mgmtCmdResult* mgmtCmdResult = (oneM2M_mgmtCmdResult *)pc;
            oneM2M_Attribute attr[] = {{ATTR_FR, mgmtCmdResult->ni}, {ATTR_DKEY, mgmtCmdResult->dKey}};
            SetElement(payload, attr, 2);
            oneM2M_Attribute pc[] = {{ATTR_EXR, mgmtCmdResult->exr}, {ATTR_EXS, mgmtCmdResult->exs}};
            SetPCElement(payload, pc, resourceType, 2);
            }
            break;
        default:;
            break;
    }

    SetFooter(payload);
    rc = MQTTPublishMessage(payload);
    return rc;

}