Example #1
0
/*!
 * Load zone keys.
 */
static int load_zone_keys(const uint8_t *zone, dnssec_list_t **list_ptr, json_t *keys)
{
	if (!keys || !json_is_array(keys)) {
		return DNSSEC_CONFIG_MALFORMED;
	}

	dnssec_list_t *new_keys = dnssec_list_new();
	if (!new_keys) {
		return DNSSEC_ENOMEM;
	}

	int result = DNSSEC_EOK;

	int index;
	json_t *key;
	json_array_foreach(keys, index, key) {
		_cleanup_key_params_ key_params_t params = { 0 };

		result = decode_object(KEY_ATTRIBUTES, key, &params);
		if (result != DNSSEC_EOK) {
			break;
		}

		dnssec_key_t *dnskey = NULL;
		result = create_dnskey(zone, &params, &dnskey);
		if (result != DNSSEC_EOK) {
			break;
		}

		result = keyset_add_dnskey(new_keys, dnskey, &params.timing);
		if (result != DNSSEC_EOK) {
			dnssec_key_free(dnskey);
			break;
		}
	}
Example #2
0
static PyObject*
decode_json(JSONData *jsondata)
{
    PyObject *object;

    skipSpaces(jsondata);
    switch(*jsondata->ptr) {
    case 0:
        PyErr_SetString(JSON_DecodeError, "empty JSON description");
        return NULL;
    case '{':
        object = decode_object(jsondata);
        break;
    case '[':
        object = decode_array(jsondata);
        break;
    case '"':
        object = decode_string(jsondata);
        break;
    case 't':
    case 'f':
        object = decode_bool(jsondata);
        break;
    case 'n':
        object = decode_null(jsondata);
        break;
    case 'N':
        object = decode_nan(jsondata);
        break;
    case 'I':
        object = decode_inf(jsondata);
        break;
    case '+':
    case '-':
        if (*(jsondata->ptr+1) == 'I') {
            object = decode_inf(jsondata);
        } else {
            object = decode_number(jsondata);
        }
        break;
    case '0':
    case '1':
    case '2':
    case '3':
    case '4':
    case '5':
    case '6':
    case '7':
    case '8':
    case '9':
        object = decode_number(jsondata);
        break;
    default:
        PyErr_SetString(JSON_DecodeError, "cannot parse JSON description");
        return NULL;
    }

    return object;
}
Example #3
0
int load_policy_config(dnssec_kasp_policy_t *policy, const char *filename)
{
	assert(policy);
	assert(filename);

	_cleanup_fclose_ FILE *file = fopen(filename, "r");
	if (!file) {
		return DNSSEC_NOT_FOUND;
	}

	json_error_t error = { 0 };
	_json_cleanup_ json_t *config = json_loadf(file, JSON_LOAD_OPTIONS, &error);
	if (!config) {
		return DNSSEC_CONFIG_MALFORMED;
	}

	return decode_object(POLICY_ATTRS, config, policy);
}
int decode_Pre_emptionVulnerability(Buffer* buffer, enum Pre_emptionVulnerability* pre_emptionVulnerability) {
	return decode_object(buffer, pre_emptionVulnerability, &PRE_EMPTIONVULNERABILITY_TYPE);
}
int decode_ProvidedData(Buffer* buffer, struct ProvidedData* providedData) {
	return decode_object(buffer, providedData, &PROVIDEDDATA_TYPE);
}
int decode_RAB_AsymmetryIndicator(Buffer* buffer, enum RAB_AsymmetryIndicator* rAB_AsymmetryIndicator) {
	return decode_object(buffer, rAB_AsymmetryIndicator, &RAB_ASYMMETRYINDICATOR_TYPE);
}
Example #7
0
int decode_UE_ID(Buffer* buffer, struct UE_ID* uE_ID) {
	return decode_object(buffer, uE_ID, &UE_ID_TYPE);
}
int decode_InformationRequestType(Buffer* buffer, struct InformationRequestType* informationRequestType) {
	return decode_object(buffer, informationRequestType, &INFORMATIONREQUESTTYPE_TYPE);
}
int decode_EquipmentsToBeTraced(Buffer* buffer, struct EquipmentsToBeTraced* equipmentsToBeTraced) {
	return decode_object(buffer, equipmentsToBeTraced, &EQUIPMENTSTOBETRACED_TYPE);
}
int decode_PriorityLevel(Buffer* buffer, int* priorityLevel) {
	return decode_object(buffer, priorityLevel, &PRIORITYLEVEL_TYPE);
}
int decode_SourceStatisticsDescriptor(Buffer* buffer, enum SourceStatisticsDescriptor* sourceStatisticsDescriptor) {
	return decode_object(buffer, sourceStatisticsDescriptor, &SOURCESTATISTICSDESCRIPTOR_TYPE);
}
Example #12
0
int decode_Event(Buffer* buffer, enum Event* event) {
	return decode_object(buffer, event, &EVENT_TYPE);
}
Example #13
0
int decode_Interface(Buffer* buffer, enum Interface* interface) {
    return decode_object(buffer, interface, &INTERFACE_TYPE);
}
int decode_Alt_RAB_Parameter_MaxBitrateType(Buffer* buffer, enum Alt_RAB_Parameter_MaxBitrateType* alt_RAB_Parameter_MaxBitrateType) {
	return decode_object(buffer, alt_RAB_Parameter_MaxBitrateType, &ALT_RAB_PARAMETER_MAXBITRATETYPE_TYPE);
}
Example #15
0
int decode_ENB_ID(Buffer* buffer, struct ENB_ID* eNB_ID) {
	return decode_object(buffer, eNB_ID, &ENB_ID_TYPE);
}
int decode_AlternativeRABConfigurationRequest(Buffer* buffer, enum AlternativeRABConfigurationRequest* alternativeRABConfigurationRequest) {
	return decode_object(buffer, alternativeRABConfigurationRequest, &ALTERNATIVERABCONFIGURATIONREQUEST_TYPE);
}
int decode_QueuingAllowed(Buffer* buffer, enum QueuingAllowed* queuingAllowed) {
	return decode_object(buffer, queuingAllowed, &QUEUINGALLOWED_TYPE);
}
int decode_MBMSCNDe_Registration(Buffer* buffer, enum MBMSCNDe_Registration* mBMSCNDe_Registration) {
	return decode_object(buffer, mBMSCNDe_Registration, &MBMSCNDE_REGISTRATION_TYPE);
}
int decode_TraceActivationIndicator(Buffer* buffer, enum TraceActivationIndicator* traceActivationIndicator) {
	return decode_object(buffer, traceActivationIndicator, &TRACEACTIVATIONINDICATOR_TYPE);
}
int decode_IuTransportAssociation(Buffer* buffer, struct IuTransportAssociation* iuTransportAssociation) {
	return decode_object(buffer, iuTransportAssociation, &IUTRANSPORTASSOCIATION_TYPE);
}
int decode_TemporaryUE_ID(Buffer* buffer, struct TemporaryUE_ID* temporaryUE_ID) {
	return decode_object(buffer, temporaryUE_ID, &TEMPORARYUE_ID_TYPE);
}
Example #22
0
int decode_Cause(Buffer* buffer, struct Cause* cause) {
	return decode_object(buffer, cause, &CAUSE_TYPE);
}
int decode_VelocityEstimate(Buffer* buffer, struct VelocityEstimate* velocityEstimate) {
	return decode_object(buffer, velocityEstimate, &VELOCITYESTIMATE_TYPE);
}
int decode_CauseProtocol(Buffer* buffer, int* causeProtocol) {
	return decode_object(buffer, causeProtocol, &CAUSEPROTOCOL_TYPE);
}
int decode_SignallingIndication(Buffer* buffer, enum SignallingIndication* signallingIndication) {
	return decode_object(buffer, signallingIndication, &SIGNALLINGINDICATION_TYPE);
}
int decode_NonSearchingIndication(Buffer* buffer, enum NonSearchingIndication* nonSearchingIndication) {
	return decode_object(buffer, nonSearchingIndication, &NONSEARCHINGINDICATION_TYPE);
}