📄 ipmpx_parse.c
字号:
if (!stricmp(fieldName, "isMACEncrypted")) GET_BOOL(p->isMACEncrypted) } break; case GF_IPMPX_INIT_AUTHENTICATION_TAG: { GF_IPMPX_InitAuthentication *p = (GF_IPMPX_InitAuthentication*)_p; if (!stricmp(fieldName, "Context")) GET_U32(p->Context) else if (!stricmp(fieldName, "AuthType")) GET_U8(p->AuthType) } break; case GF_IPMPX_TRUSTED_TOOL_TAG: { GF_IPMPX_TrustedTool *p = (GF_IPMPX_TrustedTool*)_p; if (!stricmp(fieldName, "toolID")) { GF_IPMPX_ParseBin128(val, &p->toolID); ret = 1; } else if (!stricmp(fieldName, "AuditDate")) { GF_IPMPX_ParseDate(val, &p->AuditDate); ret = 1; } } break; case GF_IPMPX_TRUST_SPECIFICATION_TAG: { GF_IPMPX_TrustSpecification *p = (GF_IPMPX_TrustSpecification*)_p; if (!stricmp(fieldName, "startDate")) { GF_IPMPX_ParseDate(val, &p->startDate); ret = 1; } else if (!stricmp(fieldName, "attackerProfile")) GET_U8(p->attackerProfile) else if (!stricmp(fieldName, "trustedDuration")) GET_U32(p->trustedDuration) } break; case GF_IPMPX_ALGORITHM_DESCRIPTOR_TAG: { GF_IPMPX_AUTH_AlgorithmDescriptor *p = (GF_IPMPX_AUTH_AlgorithmDescriptor *)_p; if (!stricmp(fieldName, "regAlgoID")) GET_U16(p->regAlgoID) } break; case GF_IPMPX_KEY_DESCRIPTOR_TAG: { GF_IPMPX_AUTH_KeyDescriptor *p = (GF_IPMPX_AUTH_KeyDescriptor *)_p; if (!stricmp(fieldName, "keyBody")) { u32 s; GF_IPMPX_ParseBinData(val, &p->keyBody, &s); p->keyBodyLength = s; ret = 1; } } break; case GF_IPMPX_PARAMETRIC_DESCRIPTION_TAG: { GF_IPMPX_ParametricDescription*p = (GF_IPMPX_ParametricDescription*)_p; if (!stricmp(fieldName, "majorVersion")) GET_U8(p->majorVersion) else if (!stricmp(fieldName, "minorVersion")) GET_U8(p->minorVersion) } break; case GF_IPMPX_PARAMETRIC_CAPS_RESPONSE_TAG: { GF_IPMPX_ToolParamCapabilitiesResponse*p = (GF_IPMPX_ToolParamCapabilitiesResponse*)_p; if (!stricmp(fieldName, "capabilitiesSupported")) GET_BOOL(p->capabilitiesSupported) } break; case GF_IPMPX_DISCONNECT_TOOL_TAG: { GF_IPMPX_DisconnectTool*p = (GF_IPMPX_DisconnectTool*)_p; if (!stricmp(fieldName, "IPMP_ToolContextID")) GET_U16(p->IPMP_ToolContextID) } break; case GF_IPMPX_GET_TOOL_CONTEXT_TAG: { GF_IPMPX_GetToolContext*p = (GF_IPMPX_GetToolContext*)_p; if (!stricmp(fieldName, "scope")) GET_U8(p->scope) else if (!stricmp(fieldName, "IPMP_DescriptorIDEx")) GET_U16(p->IPMP_DescriptorIDEx) } break; case GF_IPMPX_GET_TOOL_CONTEXT_RESPONSE_TAG: { GF_IPMPX_GetToolContextResponse*p = (GF_IPMPX_GetToolContextResponse*)_p; if (!stricmp(fieldName, "OD_ID")) GET_U16(p->OD_ID) else if (!stricmp(fieldName, "ESD_ID")) GET_U16(p->ESD_ID) else if (!stricmp(fieldName, "IPMP_ToolContextID")) GET_U16(p->IPMP_ToolContextID) } break; case GF_IPMPX_ADD_TOOL_LISTENER_TAG: { GF_IPMPX_AddToolNotificationListener*p = (GF_IPMPX_AddToolNotificationListener*)_p; if (!stricmp(fieldName, "eventType")) return GF_IPMPX_ParseEventType(val, p->eventType, &p->eventTypeCount); else if (!stricmp(fieldName, "scope")) GET_U8(p->scope) } break; case GF_IPMPX_REMOVE_TOOL_LISTENER_TAG: { GF_IPMPX_RemoveToolNotificationListener*p = (GF_IPMPX_RemoveToolNotificationListener*)_p; if (!stricmp(fieldName, "eventType")) return GF_IPMPX_ParseEventType(val, p->eventType, &p->eventTypeCount); } break; case GF_IPMPX_NOTIFY_TOOL_EVENT_TAG: { GF_IPMPX_NotifyToolEvent*p = (GF_IPMPX_NotifyToolEvent*)_p; if (!stricmp(fieldName, "OD_ID")) GET_U16(p->OD_ID) else if (!stricmp(fieldName, "ESD_ID")) GET_U16(p->ESD_ID) else if (!stricmp(fieldName, "IPMP_ToolContextID")) GET_U16(p->IPMP_ToolContextID) else if (!stricmp(fieldName, "eventType")) GET_U8(p->eventType) } break; case GF_IPMPX_CAN_PROCESS_TAG: { GF_IPMPX_CanProcess*p = (GF_IPMPX_CanProcess*)_p; if (!stricmp(fieldName, "canProcess")) GET_BOOL(p->canProcess) } break; case GF_IPMPX_TOOL_API_CONFIG_TAG: { GF_IPMPX_ToolAPI_Config*p = (GF_IPMPX_ToolAPI_Config*)_p; if (!stricmp(fieldName, "Instantiation_API_ID")) GET_U32(p->Instantiation_API_ID) else if (!stricmp(fieldName, "Messaging_API_ID")) GET_U32(p->Messaging_API_ID) } break; case GF_IPMPX_AUDIO_WM_INIT_TAG: case GF_IPMPX_VIDEO_WM_INIT_TAG: { GF_IPMPX_WatermarkingInit *p = (GF_IPMPX_WatermarkingInit*)_p; if (!stricmp(fieldName, "inputFormat")) GET_U8(p->inputFormat) else if (!stricmp(fieldName, "requiredOp")) GET_U8(p->requiredOp) else if (!stricmp(fieldName, "nChannels")) GET_U8(p->nChannels) else if (!stricmp(fieldName, "bitPerSample")) GET_U8(p->bitPerSample) else if (!stricmp(fieldName, "frequency")) GET_U32(p->frequency) else if (!stricmp(fieldName, "frame_horizontal_size")) GET_U16(p->frame_horizontal_size) else if (!stricmp(fieldName, "frame_vertical_size")) GET_U16(p->frame_vertical_size) else if (!stricmp(fieldName, "chroma_format")) GET_U8(p->chroma_format) else if (!stricmp(fieldName, "wmPayload")) { ret=1; GF_IPMPX_ParseBinData(val, &p->wmPayload, &p->wmPayloadLen); } else if (!stricmp(fieldName, "opaqueData")) { ret=1; GF_IPMPX_ParseBinData(val, &p->opaqueData, &p->opaqueDataSize); } else if (!stricmp(fieldName, "wmRecipientId")) GET_U16(p->wmRecipientId) } break; case GF_IPMPX_AUDIO_WM_SEND_TAG: case GF_IPMPX_VIDEO_WM_SEND_TAG: { GF_IPMPX_SendWatermark *p = (GF_IPMPX_SendWatermark*)_p; if (!stricmp(fieldName, "wm_status")) GET_U8(p->wm_status) else if (!stricmp(fieldName, "compression_status")) GET_U8(p->compression_status) } break; case GF_IPMPX_SEL_DEC_INIT_TAG: { GF_IPMPX_SelectiveDecryptionInit*p = (GF_IPMPX_SelectiveDecryptionInit*)_p; if (!stricmp(fieldName, "mediaTypeExtension")) GET_U8(p->mediaTypeExtension) else if (!stricmp(fieldName, "mediaTypeExtension")) GET_U8(p->mediaTypeExtension) else if (!stricmp(fieldName, "mediaTypeIndication")) GET_U8(p->mediaTypeIndication) else if (!stricmp(fieldName, "profileLevelIndication")) GET_U8(p->profileLevelIndication) else if (!stricmp(fieldName, "compliance")) GET_U8(p->compliance) else if (!stricmp(fieldName, "RLE_Data")) { ret=1; gf_ipmpx_data_parse_16(val, &p->RLE_Data, &p->RLE_DataLength); } } break; case GF_IPMPX_SEL_ENC_BUFFER_TAG: { GF_IPMPX_SelEncBuffer*p = (GF_IPMPX_SelEncBuffer*)_p; if (!stricmp(fieldName, "cipher_Id")) { GF_IPMPX_ParseBin128(val, &p->cipher_Id); ret = 1; } else if (!stricmp(fieldName, "syncBoundary")) GET_U8(p->syncBoundary) else if (!stricmp(fieldName, "mode")) GET_U8(p->mode) else if (!stricmp(fieldName, "blockSize")) GET_U16(p->blockSize) else if (!stricmp(fieldName, "keySize")) GET_U16(p->keySize) } break; case GF_IPMPX_SEL_ENC_FIELD_TAG: { GF_IPMPX_SelEncField*p = (GF_IPMPX_SelEncField*)_p; if (!stricmp(fieldName, "field_Id")) GET_U8(p->field_Id) else if (!stricmp(fieldName, "field_Scope")) GET_U8(p->field_Scope) else if (!stricmp(fieldName, "buf")) GET_U8(p->buf) else if (!stricmp(fieldName, "mappingTable")) { ret=1; gf_ipmpx_data_parse_16(val, &p->mappingTable, &p->mappingTableSize); } } break; case GF_IPMPX_ISMACRYP_TAG: { GF_IPMPX_ISMACryp*p = (GF_IPMPX_ISMACryp*)_p; if (!stricmp(fieldName, "crypto_suite")) GET_U8(p->cryptoSuite) else if (!stricmp(fieldName, "IV_length")) GET_U8(p->IV_length) else if (!stricmp(fieldName, "selective_encryption")) GET_BOOL(p->use_selective_encryption) else if (!stricmp(fieldName, "key_indicator_length")) GET_U8(p->key_indicator_length) } break; } return ret ? GF_OK : GF_BAD_PARAM;}GF_Err gf_ipmpx_set_sub_data(GF_IPMPX_Data *_p, char *fieldName, GF_IPMPX_Data *sp){ switch (_p->tag) { case GF_IPMPX_SECURE_CONTAINER_TAG: { GF_IPMPX_SecureContainer*p = (GF_IPMPX_SecureContainer*)_p; if (p->protectedMsg) gf_ipmpx_data_del(p->protectedMsg); p->protectedMsg = sp; return GF_OK; } break; case GF_IPMPX_TRUST_SECURITY_METADATA_TAG: { GF_IPMPX_TrustSecurityMetadata *p = (GF_IPMPX_TrustSecurityMetadata*)_p; if (!sp || (sp->tag!=GF_IPMPX_TRUSTED_TOOL_TAG) ) return GF_BAD_PARAM; gf_list_add(p->TrustedTools, sp); return GF_OK; } break; case GF_IPMPX_TRUSTED_TOOL_TAG: { GF_IPMPX_TrustedTool *p = (GF_IPMPX_TrustedTool *)_p; if (!sp || (sp->tag!=GF_IPMPX_TRUST_SPECIFICATION_TAG) ) return GF_BAD_PARAM; gf_list_add(p->trustSpecifications, sp); return GF_OK; } break; case GF_IPMPX_MUTUAL_AUTHENTICATION_TAG: { GF_IPMPX_MutualAuthentication *p = (GF_IPMPX_MutualAuthentication *)_p; if (!sp) return GF_BAD_PARAM; switch (sp->tag) { case GF_IPMPX_ALGORITHM_DESCRIPTOR_TAG: sp->tag = GF_IPMPX_AUTH_AlgorithmDescr_Tag; if (!stricmp(fieldName, "candidateAlgorithms")) return gf_list_add(p->agreedAlgorithms, sp); else if (!stricmp(fieldName, "agreedAlgorithms")) return gf_list_add(p->agreedAlgorithms, sp); else return GF_BAD_PARAM; case GF_IPMPX_KEY_DESCRIPTOR_TAG: sp->tag = GF_IPMPX_AUTH_KeyDescr_Tag; if (!stricmp(fieldName, "candidateAlgorithms")) return gf_list_add(p->agreedAlgorithms, sp); else if (!stricmp(fieldName, "agreedAlgorithms")) return gf_list_add(p->agreedAlgorithms, sp); else if (!stricmp(fieldName, "publicKey")) { if (p->publicKey) GF_IPMPX_AUTH_Delete((GF_IPMPX_Authentication *) p->publicKey); p->publicKey = (GF_IPMPX_AUTH_KeyDescriptor *) sp; return GF_OK; } else return GF_BAD_PARAM; case GF_IPMPX_TRUST_SECURITY_METADATA_TAG: if (p->trustData) gf_ipmpx_data_del((GF_IPMPX_Data *)p->trustData); p->trustData = (GF_IPMPX_TrustSecurityMetadata*)sp; return GF_OK; default: return GF_BAD_PARAM; } } break; case GF_IPMPX_PARAMETRIC_DESCRIPTION_TAG: { GF_IPMPX_ParametricDescription*p = (GF_IPMPX_ParametricDescription*)_p; if (!sp || (sp->tag!=GF_IPMPX_PARAM_DESCRIPTOR_ITEM_TAG) ) return GF_BAD_PARAM; if (!stricmp(fieldName, "descriptions")) return gf_list_add(p->descriptions, sp); else return GF_BAD_PARAM; } break; case GF_IPMPX_PARAMETRIC_CAPS_QUERY_TAG: { GF_IPMPX_ToolParamCapabilitiesQuery*p = (GF_IPMPX_ToolParamCapabilitiesQuery*)_p; if (!sp || (sp->tag!=GF_IPMPX_PARAMETRIC_DESCRIPTION_TAG) ) return GF_BAD_PARAM; if (stricmp(fieldName, "description")) return GF_BAD_PARAM; if (p->description) gf_ipmpx_data_del((GF_IPMPX_Data *)p->description); p->description = (GF_IPMPX_ParametricDescription*)sp; return GF_OK; } break; case GF_IPMPX_SEL_DEC_INIT_TAG: { GF_IPMPX_SelectiveDecryptionInit*p = (GF_IPMPX_SelectiveDecryptionInit*)_p; if (!sp) return GF_BAD_PARAM; if (sp->tag==GF_IPMPX_SEL_ENC_BUFFER_TAG) return gf_list_add(p->SelEncBuffer, sp); else if (sp->tag==GF_IPMPX_SEL_ENC_FIELD_TAG) return gf_list_add(p->SelEncFields, sp); else return GF_BAD_PARAM; } break; } return GF_BAD_PARAM;}GF_Err gf_ipmpx_set_byte_array(GF_IPMPX_Data *p, char *field, char *str){ GF_IPMPX_ByteArray *d; GF_IPMPX_ByteArray **dest; d = (GF_IPMPX_ByteArray*)malloc(sizeof(GF_IPMPX_ByteArray)); d->length = strlen(str); d->data = (char*)malloc(sizeof(char)*d->length); memcpy(d->data, str, d->length); dest = NULL; switch (p->tag) { case GF_IPMPX_KEY_DATA_TAG: if (!stricmp(field, "keyBody")) dest = & ((GF_IPMPX_KeyData*)p)->keyBody; else if (!stricmp(field, "opaqueData")) dest = & ((GF_IPMPX_KeyData*)p)->OpaqueData; break; case GF_IPMPX_RIGHTS_DATA_TAG: if (!stricmp(field, "rightsInfo")) dest = & ((GF_IPMPX_RightsData*)p)->rightsInfo; break; case GF_IPMPX_OPAQUE_DATA_TAG: if (!stricmp(field, "opaqueData")) dest = & ((GF_IPMPX_OpaqueData*)p)->opaqueData; break; case GF_IPMPX_SECURE_CONTAINER_TAG: if (!stricmp(field, "encryptedData")) dest = & ((GF_IPMPX_SecureContainer*)p)->encryptedData; else if (!stricmp(field, "MAC")) dest = & ((GF_IPMPX_SecureContainer*)p)->MAC; break; case GF_IPMPX_TRUST_SPECIFICATION_TAG: if (!stricmp(field, "CCTrustMetadata")) dest = & ((GF_IPMPX_TrustSpecification*)p)->CCTrustMetadata; break; case GF_IPMPX_MUTUAL_AUTHENTICATION_TAG: if (!stricmp(field, "AuthenticationData")) dest = & ((GF_IPMPX_MutualAuthentication*)p)->AuthenticationData; else if (!stricmp(field, "opaque")) dest = & ((GF_IPMPX_MutualAuthentication*)p)->opaque; else if (!stricmp(field, "authCodes")) dest = & ((GF_IPMPX_MutualAuthentication*)p)->authCodes; else if (!stricmp(field, "certificates")) { gf_list_add(((GF_IPMPX_MutualAuthentication*)p)->certificates, d); return GF_OK; } break; case GF_IPMPX_PARAMETRIC_DESCRIPTION_TAG: if (!stricmp(field, "descriptionComment")) dest = & ((GF_IPMPX_ParametricDescription*)p)->descriptionComment; break; case GF_IPMPX_PARAM_DESCRIPTOR_ITEM_TAG: if (!stricmp(field, "class")) dest = & ((GF_IPMPX_ParametricDescriptionItem*)p)->main_class; else if (!stricmp(field, "subClass")) dest = & ((GF_IPMPX_ParametricDescriptionItem*)p)->subClass; else if (!stricmp(field, "typeData")) dest = & ((GF_IPMPX_ParametricDescriptionItem*)p)->typeData; else if (!stricmp(field, "type")) dest = & ((GF_IPMPX_ParametricDescriptionItem*)p)->type; else if (!stricmp(field, "addedData")) dest = & ((GF_IPMPX_ParametricDescriptionItem*)p)->addedData; break; case GF_IPMPX_TOOL_API_CONFIG_TAG: if (!stricmp(field, "opaqueData")) dest = & ((GF_IPMPX_ToolAPI_Config*)p)->opaqueData; break; case GF_IPMPX_AUDIO_WM_SEND_TAG: case GF_IPMPX_VIDEO_WM_SEND_TAG: if (!stricmp(field, "payload")) dest = & ((GF_IPMPX_SendWatermark *)p)->payload; else if (!stricmp(field, "opaqueData")) dest = & ((GF_IPMPX_SendWatermark*)p)->opaqueData; break; case GF_IPMPX_SEL_ENC_BUFFER_TAG: if (!stricmp(field, "StreamCipher")) dest = & ((GF_IPMPX_SelEncBuffer*)p)->Stream_Cipher_Specific_Init_Info; break; case GF_IPMPX_SEL_ENC_FIELD_TAG: if (!stricmp(field, "shuffleSpecificInfo")) dest = & ((GF_IPMPX_SelEncField*)p)->shuffleSpecificInfo; break; } if (!dest) { free(d->data); free(d); return GF_BAD_PARAM; } if ( (*dest) ) { if ((*dest)->data) free((*dest)->data); free((*dest)); } (*dest) = d; return GF_OK;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -