void
mmsServer_handleGetNamedVariableListAttributesRequest(
    MmsServerConnection* connection,
    GetNamedVariableListAttributesRequest_t* request,
    int invokeId,
    ByteBuffer* response)
{
    if (request->present == ObjectName_PR_domainspecific) {

        char* domainName = createStringFromBuffer(
                               request->choice.domainspecific.domainId.buf,
                               request->choice.domainspecific.domainId.size);

        char* itemName = createStringFromBuffer(
                             request->choice.domainspecific.itemId.buf,
                             request->choice.domainspecific.itemId.size);

        MmsDevice* mmsDevice = MmsServer_getDevice(connection->server);

        MmsDomain* domain = MmsDevice_getDomain(mmsDevice, domainName);

        if (domain != NULL) {
            MmsNamedVariableList variableList =
                MmsDomain_getNamedVariableList(domain, itemName);

            if (variableList != NULL)
                createGetNamedVariableListAttributesResponse(invokeId, response, variableList, domainName);
            else
                mmsServer_createConfirmedErrorPdu(invokeId, response, MMS_ERROR_TYPE_OBJECT_NON_EXISTENT);
        }
        else
            mmsServer_createConfirmedErrorPdu(invokeId, response, MMS_ERROR_TYPE_OBJECT_NON_EXISTENT);


        free(domainName);
        free(itemName);
    }
    else {
        mmsServer_createConfirmedErrorPdu(invokeId, response, MMS_ERROR_TYPE_OBJECT_ACCESS_UNSUPPORTED);
    }
}
void
mmsServer_handleGetNamedVariableListAttributesRequest(
		MmsServerConnection connection,
		uint8_t* buffer, int bufPos, int maxBufPos,
		uint32_t invokeId,
		ByteBuffer* response)
{
	GetNamedVariableListAttributesRequest_t* request = 0;

	asn_dec_rval_t rval = ber_decode(NULL, &asn_DEF_GetNamedVariableListAttributesRequest,
				(void**) &request, buffer + bufPos, maxBufPos - bufPos);

	if (rval.code != RC_OK) {
	    mmsServer_writeMmsRejectPdu(&invokeId, MMS_ERROR_REJECT_INVALID_PDU, response);
	    return;
	}

	if (request->present == ObjectName_PR_domainspecific) {

	    char domainName[65];
	    char itemName[65];

	    if ((request->choice.domainspecific.domainId.size > 64) ||
	        (request->choice.domainspecific.itemId.size > 64)) {
	        mmsServer_createConfirmedErrorPdu(invokeId, response, MMS_ERROR_ACCESS_OTHER);
	        goto exit_function;
	    }

	    StringUtils_createStringFromBufferInBuffer(domainName, request->choice.domainspecific.domainId.buf,
	            request->choice.domainspecific.domainId.size);

	    StringUtils_createStringFromBufferInBuffer(itemName, request->choice.domainspecific.itemId.buf,
                request->choice.domainspecific.itemId.size);

		MmsDevice* mmsDevice = MmsServer_getDevice(connection->server);

		MmsDomain* domain = MmsDevice_getDomain(mmsDevice, domainName);

		if (domain != NULL) {
			MmsNamedVariableList variableList =
					MmsDomain_getNamedVariableList(domain, itemName);

			if (variableList != NULL)
				createGetNamedVariableListAttributesResponse(invokeId, response, variableList);
			else
				mmsServer_createConfirmedErrorPdu(invokeId, response, MMS_ERROR_ACCESS_OBJECT_NON_EXISTENT);
		}
		else
			mmsServer_createConfirmedErrorPdu(invokeId, response, MMS_ERROR_ACCESS_OBJECT_NON_EXISTENT);

	}
#if (MMS_DYNAMIC_DATA_SETS == 1)
	else if (request->present == ObjectName_PR_aaspecific) {

	    char listName[65];

        if (request->choice.aaspecific.size > 64) {
            mmsServer_createConfirmedErrorPdu(invokeId, response, MMS_ERROR_ACCESS_OTHER);
            goto exit_function;
        }

	    StringUtils_createStringFromBufferInBuffer(listName, request->choice.aaspecific.buf,
	            request->choice.aaspecific.size);

	    MmsNamedVariableList varList = MmsServerConnection_getNamedVariableList(connection, listName);

	    if (varList != NULL)
	        createGetNamedVariableListAttributesResponse(invokeId, response, varList);
	    else
	        mmsServer_createConfirmedErrorPdu(invokeId, response, MMS_ERROR_ACCESS_OBJECT_NON_EXISTENT);
	}
#endif /* (MMS_DYNAMIC_DATA_SETS == 1) */
	else {
		mmsServer_createConfirmedErrorPdu(invokeId, response, MMS_ERROR_ACCESS_OBJECT_ACCESS_UNSUPPORTED);
	}

exit_function:

	asn_DEF_GetVariableAccessAttributesRequest.free_struct(&asn_DEF_GetNamedVariableListAttributesRequest,
			request, 0);
}