tr069 节点模板定义c语言

发布时间 2023-06-15 21:13:24作者: lydstory
#include <stdio.h>

/* Signed */
typedef signed char     int8_t;
typedef short int       int16_t;
typedef int             int32_t;


/* Unsigned.  */
typedef unsigned char       uint8_t;
typedef unsigned short int  uint16_t;
typedef unsigned int        uint32_t;

typedef enum error_type
{
    ERR_NONE = 0,
    ERR_FAIL,
    ERR_BAD_PARAM,
    ERR_ACS_NOT_RESPONDING,
    ERR_MALLOC_FAILURE,
    ERR_MALLOC_SERVER_FAILURE = 9007,
} error_type_t;


typedef enum datatype
{
	INT=1,
	STRING,
	BOOL,
	UNSIGNEDINT,
	DATETIME,
	BASE64,
	OBJECT
}datatype_t;

typedef enum
{
	False=0,
	True,
} writable_t;

typedef struct DModel_template
{
    const char  *path;                        // Complete hierarchical path of TR parameter
    datatype_t datatypes ;
	 writable_t writable ;
	 error_type_t (*nv_cwmp_get_param)(uint8_t *, void**); // Get function for getting the param value
    error_type_t (*nv_cwmp_set_param)(uint8_t *, void*); // Set function for setting the param value
	//type of data if int, boolean, string, unsinged int
} dmodel_template_t;


typedef char* xsd__anySimpleType;
/// "urn:dslforum-org:cwmp-1-1":ParameterValueStruct is a complexType.
struct cwmp__ParameterValueStruct
{
/// Length of this string is within 0..256 characters
    char*                                                              
                                         Name                          ;	///< Required element.
/// Element Value of type xs:anySimpleType.
    xsd__anySimpleType                   Value                         ;	///< Required element.
};

/// "urn:dslforum-org:cwmp-1-1":ParameterValueList is a complexType with complexContent restriction of SOAP-ENC:Array.
/// SOAP encoded array of "urn:dslforum-org:cwmp-1-1":ParameterValueStruct
struct ParameterValueList
{
/// Pointer to array of struct cwmp__ParameterValueStruct*.
    struct cwmp__ParameterValueStruct*  *__ptrParameterValueStruct     ;
/// Size of the dynamic array.
    int                                  __size                        ;
/// Offset for partially transmitted arrays (uncomment only when required).
//  int                                  __offset                      ;
};
error_type_t 
	nv_cwmp_parametervalue_alloc(
	struct ParameterValueList ** outptr,
	char * name, 
	char * type, 
	char *value)
{

    struct ParameterValueList * parametervaluelist =  *outptr;

   return 0;
}

error_type_t getLANDeviceNumberOfEntries(uint8_t *path, void **outptr)
{
  /*
    return (nv_cwmp_parametervalue_alloc(
							(struct ParameterValueList **) outptr,
							"InternetGatewayDevice.LANDeviceNumberOfEntries",
							"string",
							"8"));
   */
}

error_type_t getWANDeviceNumberOfEntries(uint8_t *path, void **outptr)
{
   /*
    return (nv_cwmp_parametervalue_alloc(
							(struct ParameterValueList **) outptr,
							"InternetGatewayDevice.WANDeviceNumberOfEntries",
							"string",
							"2"));
                     */
}



#define DM_MAX_ENTRIES	2048
dmodel_template_t cwmp_datamodel_common[DM_MAX_ENTRIES] = {
	{"InternetGatewayDevice",										OBJECT,False ,NULL,NULL}, // object
	{"InternetGatewayDevice.X_ASB_UserLimitCfg",                   OBJECT,False ,NULL,NULL}, // object
   {"InternetGatewayDevice.LANDeviceNumberOfEntries",				STRING,False ,getLANDeviceNumberOfEntries, NULL},
	{"InternetGatewayDevice.WANDeviceNumberOfEntries",				STRING,False ,getWANDeviceNumberOfEntries, NULL},
};
int main()
{
 
   printf("hello,world\n");
   return 0;
}