From: <hi...@us...> - 2012-06-27 19:41:32
|
Revision: 232 http://ptpd.svn.sourceforge.net/ptpd/?rev=232&view=rev Author: himan92 Date: 2012-06-27 19:41:25 +0000 (Wed, 27 Jun 2012) Log Message: ----------- Packing TLVs applicable for all nodes Modified Paths: -------------- branches/himanshu-2012/tools/ptpmanager/ptpmanager.c branches/himanshu-2012/tools/ptpmanager/ptpmanager.h Added Paths: ----------- branches/himanshu-2012/tools/ptpmanager/constants.h Added: branches/himanshu-2012/tools/ptpmanager/constants.h =================================================================== --- branches/himanshu-2012/tools/ptpmanager/constants.h (rev 0) +++ branches/himanshu-2012/tools/ptpmanager/constants.h 2012-06-27 19:41:25 UTC (rev 232) @@ -0,0 +1,108 @@ +#ifndef CONSTANTS_H +#define CONSTANTS_H + +#define MANAGEMENT_LENGTH 48 +#define CLOCK_IDENTITY_LENGTH 8 +#define HEADER_LENGTH 34 +#define PACKET_SIZE 300 +#define MANAGEMENT 13 +#define TLV_LENGTH 6 +#define USER_DESCRIPTION_MAX 128 + +#define flip16(x) htons(x) +#define flip32(x) htonl(x) + +/** + * \brief PTP Management Message managementId values (Table 40 in the spec) + */ +/* SLAVE_ONLY conflicts with another constant, so scope with MM_ */ +enum { + /* Applicable to all node types */ + MM_NULL_MANAGEMENT=0x0000, + MM_CLOCK_DESCRIPTION=0x0001, + MM_USER_DESCRIPTION=0x0002, + MM_SAVE_IN_NON_VOLATILE_STORAGE=0x0003, + MM_RESET_NON_VOLATILE_STORAGE=0x0004, + MM_INITIALIZE=0x0005, + MM_FAULT_LOG=0x0006, + MM_FAULT_LOG_RESET=0x0007, + + /* Reserved: 0x0008 - 0x1FFF */ + + /* Applicable to ordinary and boundary clocks */ + MM_DEFAULT_DATA_SET=0x2000, + MM_CURRENT_DATA_SET=0x2001, + MM_PARENT_DATA_SET=0x2002, + MM_TIME_PROPERTIES_DATA_SET=0x2003, + MM_PORT_DATA_SET=0x2004, + MM_PRIORITY1=0x2005, + MM_PRIORITY2=0x2006, + MM_DOMAIN=0x2007, + MM_SLAVE_ONLY=0x2008, + MM_LOG_ANNOUNCE_INTERVAL=0x2009, + MM_ANNOUNCE_RECEIPT_TIMEOUT=0x200A, + MM_LOG_SYNC_INTERVAL=0x200B, + MM_VERSION_NUMBER=0x200C, + MM_ENABLE_PORT=0x200D, + MM_DISABLE_PORT=0x200E, + MM_TIME=0x200F, + MM_CLOCK_ACCURACY=0x2010, + MM_UTC_PROPERTIES=0x2011, + MM_TRACEABILITY_PROPERTIES=0x2012, + MM_TIMESCALE_PROPERTIES=0x2013, + MM_UNICAST_NEGOTIATION_ENABLE=0x2014, + MM_PATH_TRACE_LIST=0x2015, + MM_PATH_TRACE_ENABLE=0x2016, + MM_GRANDMASTER_CLUSTER_TABLE=0x2017, + MM_UNICAST_MASTER_TABLE=0x2018, + MM_UNICAST_MASTER_MAX_TABLE_SIZE=0x2019, + MM_ACCEPTABLE_MASTER_TABLE=0x201A, + MM_ACCEPTABLE_MASTER_TABLE_ENABLED=0x201B, + MM_ACCEPTABLE_MASTER_MAX_TABLE_SIZE=0x201C, + MM_ALTERNATE_MASTER=0x201D, + MM_ALTERNATE_TIME_OFFSET_ENABLE=0x201E, + MM_ALTERNATE_TIME_OFFSET_NAME=0x201F, + MM_ALTERNATE_TIME_OFFSET_MAX_KEY=0x2020, + MM_ALTERNATE_TIME_OFFSET_PROPERTIES=0x2021, + + /* Reserved: 0x2022 - 0x3FFF */ + + /* Applicable to transparent clocks */ + MM_TRANSPARENT_CLOCK_DEFAULT_DATA_SET=0x4000, + MM_TRANSPARENT_CLOCK_PORT_DATA_SET=0x4001, + MM_PRIMARY_DOMAIN=0x4002, + + /* Reserved: 0x4003 - 0x5FFF */ + + /* Applicable to ordinary, boundary, and transparent clocks */ + MM_DELAY_MECHANISM=0x6000, + MM_LOG_MIN_PDELAY_REQ_INTERVAL=0x6001, + + /* Reserved: 0x6002 - 0xBFFF */ + /* Implementation-specific identifiers: 0xC000 - 0xDFFF */ + /* Assigned by alternate PTP profile: 0xE000 - 0xFFFE */ + /* Reserved: 0xFFFF */ +}; + +/* + * \brief PTP tlvType values for management messages (Table 34 in the spec) + */ +enum { + /* Standard TLVs */ + TLV_MANAGEMENT=0x0001, + TLV_MANAGEMENT_ERROR_STATUS=0x0002 +}; + +/** + * \brief Management Message actions (Table 38 in the spec) + */ +enum { + GET=0, + SET, + RESPONSE, + COMMAND, + ACKNOWLEDGE +}; + + +#endif /*CONSTANTS_H*/ Modified: branches/himanshu-2012/tools/ptpmanager/ptpmanager.c =================================================================== --- branches/himanshu-2012/tools/ptpmanager/ptpmanager.c 2012-06-26 19:34:25 UTC (rev 231) +++ branches/himanshu-2012/tools/ptpmanager/ptpmanager.c 2012-06-27 19:41:25 UTC (rev 232) @@ -6,13 +6,12 @@ * receiving management messages */ -#include "stdlib.h" +#include "constants.h" #include "ptpmanager.h" -#define PTP_GENERAL_PORT 320 -#define PTP_EVENT_PORT 319 +#define PTP_GENERAL_PORT 4201 +#define PTP_EVENT_PORT 4200 - NetPath * netPath; /* Function to pack the header of outgoing message */ @@ -32,7 +31,7 @@ *(unsigned char *)(buf + 1) = *(unsigned char *)(buf + 1) & 0x00; *(UInteger4 *) (buf + 1) = *(unsigned char *)(buf + 1) | versionNumber; - *(UInteger16 *) (buf + 2) = flip16(MANAGEMENT_LENGTH); +// *(UInteger16 *) (buf + 2) = flip16(MANAGEMENT_LENGTH); *(UInteger8 *) (buf + 4) = domainNumber; *(unsigned char *)(buf + 5) = 0x00; *(unsigned char *)(buf + 6) = 0x04; /*Table 20*/ @@ -62,8 +61,6 @@ void packManagementHeader(Octet *buf) { - MsgManagement *manage = (MsgManagement*)(buf); - /* targetPortIdentity to be zero for now*/ memset((buf + 34), 0, 10); @@ -92,7 +89,7 @@ int actionField; MsgManagement *manage = (MsgManagement*)(buf); - *(UInteger16 *) (buf + 2) = flip16(MANAGEMENT_LENGTH+6); + *(UInteger16 *) (buf + 2) = flip16(MANAGEMENT_LENGTH+TLV_LENGTH); *(UInteger16 *) (buf + 48) = flip16(TLV_MANAGEMENT); /* lengthField = 2+N*/ *(UInteger16 *) (buf + 50) = flip16(0x0002); @@ -110,12 +107,231 @@ else printf("This action is not allowed\n"); - out_length += 6; + out_length += TLV_LENGTH; } void -packMMClockDescription(); +packMMClockDescription(Octet *buf) +{ + int actionField; + + MsgManagement *manage = (MsgManagement*)(buf); + manage->tlv = (ManagementTLV*)(buf+48); + *(UInteger16 *) (buf + 2) = flip16(MANAGEMENT_LENGTH+TLV_LENGTH); + manage->tlv->tlvType = flip16(TLV_MANAGEMENT); + /*managementId Table 40*/ + manage->tlv->managementId = flip16(0x0001); + manage->tlv->lengthField = flip16(0x0002); + + printf("\n>actionField (0 for GET) ?"); + scanf("%d",&actionField); + switch(actionField){ + case GET: + *(UInteger8 *) (buf + 46) = *(UInteger8 *) (buf + 46) | GET; + break; + default: + printf("This action is not allowed\n"); /*Table 40*/ + } + + out_length += TLV_LENGTH; +} +void +packMMUserDescription(Octet *buf) +{ + int actionField; + + MsgManagement *manage = (MsgManagement*)(buf); + MMUserDescription* data = NULL; + manage->tlv = (ManagementTLV*)(buf+48); + manage->tlv->tlvType = flip16(TLV_MANAGEMENT); + manage->tlv->lengthField = flip16(0x0002); + /*managementId Table 40*/ + manage->tlv->managementId = flip16(0x0002); + + //*(UInteger16 *) (buf + 52) = flip16(0x0002); + printf("\n>actionField (0 for GET, 1 for SET) ?"); + scanf("%d",&actionField); + switch(actionField){ + case GET: + *(UInteger8 *) (buf + 46) = *(UInteger8 *) (buf + 46) | GET; + manage->tlv->dataField = NULL; + *(UInteger16 *) (buf + 2) = flip16(MANAGEMENT_LENGTH+TLV_LENGTH); + out_length += TLV_LENGTH; + break; + case SET: + *(UInteger8 *) (buf + 46) = *(UInteger8 *) (buf + 46) | SET; + data = (MMUserDescription*)malloc(sizeof(MMUserDescription)); + char text[128]; + int dataFieldLength = 0; + printf("\n>UserDescription (DeviceName;PhysicalLocation)?"); + scanf("%s",text); + data->userDescription.lengthField = strlen(text); + + if (data->userDescription.lengthField > USER_DESCRIPTION_MAX){ + printf("user description exceeds specification length"); + return; + } + + data->userDescription.textField = + (Octet*)malloc(data->userDescription.lengthField); + memcpy(data->userDescription.textField, + text, data->userDescription.lengthField); + + memcpy((Octet*)manage->tlv + TLV_LENGTH, data, 1); + memcpy((Octet*)manage->tlv + TLV_LENGTH + 1, + data->userDescription.textField, + data->userDescription.lengthField); + + + /* is the TLV length odd? TLV must be even according to Spec 5.3.8 */ + if (data->userDescription.lengthField % 2 == 0){ + memset(buf + MANAGEMENT_LENGTH + + TLV_LENGTH + data->userDescription.lengthField + 1, + 0,1); + dataFieldLength = data->userDescription.lengthField + 2; + } + else { + dataFieldLength = data->userDescription.lengthField + 1; + } + + *(UInteger16 *) (buf + 2) = flip16(MANAGEMENT_LENGTH + TLV_LENGTH + + dataFieldLength); + out_length += TLV_LENGTH + dataFieldLength; + + free(data->userDescription.textField); + free(data); + break; + default: + printf("This action is not allowed\n"); + } + +} + + +void +packMMSaveInNonVolatileStorage(Octet *buf) +{ + int actionField; + + MsgManagement *manage = (MsgManagement*)(buf); + manage->tlv = (ManagementTLV*)(buf+48); + *(UInteger16 *) (buf + 2) = flip16(MANAGEMENT_LENGTH+TLV_LENGTH); + manage->tlv->tlvType = flip16(TLV_MANAGEMENT); + /*managementId Table 40*/ + manage->tlv->managementId = flip16(0x0003); + manage->tlv->lengthField = flip16(0x0002); + + printf("\n>actionField (0 for GET) ?"); + scanf("%d",&actionField); + switch(actionField){ + case COMMAND: + *(UInteger8 *) (buf + 46) = *(UInteger8 *) (buf + 46) | COMMAND; + break; + default: + printf("This action is not allowed\n"); /*Table 40*/ + } + +} + +void +packMMResetInNonVolatileStorage(Octet *buf) +{ + int actionField; + + MsgManagement *manage = (MsgManagement*)(buf); + manage->tlv = (ManagementTLV*)(buf+48); + *(UInteger16 *) (buf + 2) = flip16(MANAGEMENT_LENGTH+TLV_LENGTH); + manage->tlv->tlvType = flip16(TLV_MANAGEMENT); + /*managementId Table 40*/ + manage->tlv->managementId = flip16(0x0004); + manage->tlv->lengthField = flip16(0x0002); + + printf("\n>actionField (0 for GET) ?"); + scanf("%d",&actionField); + switch(actionField){ + case COMMAND: + *(UInteger8 *) (buf + 46) = *(UInteger8 *) (buf + 46) | COMMAND; + break; + default: + printf("This action is not allowed\n"); /*Table 40*/ + } +} + +void +packMMInitialize(Octet *buf) +{ + int actionField; + + MsgManagement *manage = (MsgManagement*)(buf); + manage->tlv = (ManagementTLV*)(buf+48); + *(UInteger16 *) (buf + 2) = flip16(MANAGEMENT_LENGTH+TLV_LENGTH); + manage->tlv->tlvType = flip16(TLV_MANAGEMENT); + /*managementId Table 40*/ + manage->tlv->managementId = flip16(0x0005); + manage->tlv->lengthField = flip16(0x0002); + + printf("\n>actionField (0 for GET) ?"); + scanf("%d",&actionField); + switch(actionField){ + case COMMAND: + *(UInteger8 *) (buf + 46) = *(UInteger8 *) (buf + 46) | COMMAND; + break; + default: + printf("This action is not allowed\n"); /*Table 40*/ + } +} + +void +packMMFaultLog(Octet *buf) +{ + int actionField; + + MsgManagement *manage = (MsgManagement*)(buf); + manage->tlv = (ManagementTLV*)(buf+48); + *(UInteger16 *) (buf + 2) = flip16(MANAGEMENT_LENGTH+TLV_LENGTH); + manage->tlv->tlvType = flip16(TLV_MANAGEMENT); + /*managementId Table 40*/ + manage->tlv->managementId = flip16(0x0006); + manage->tlv->lengthField = flip16(0x0002); + + printf("\n>actionField (0 for GET) ?"); + scanf("%d",&actionField); + switch(actionField){ + case GET: + *(UInteger8 *) (buf + 46) = *(UInteger8 *) (buf + 46) | GET; + break; + default: + printf("This action is not allowed\n"); /*Table 40*/ + } + +} + +void +packMMFaultLogReset(Octet *buf) +{ + int actionField; + + MsgManagement *manage = (MsgManagement*)(buf); + manage->tlv = (ManagementTLV*)(buf+48); + *(UInteger16 *) (buf + 2) = flip16(MANAGEMENT_LENGTH+TLV_LENGTH); + manage->tlv->tlvType = flip16(TLV_MANAGEMENT); + /*managementId Table 40*/ + manage->tlv->managementId = flip16(0x0007); + manage->tlv->lengthField = flip16(0x0002); + + printf("\n>actionField (0 for GET) ?"); + scanf("%d",&actionField); + switch(actionField){ + case COMMAND: + *(UInteger8 *) (buf + 46) = *(UInteger8 *) (buf + 46) | COMMAND; + break; + default: + printf("This action is not allowed\n"); /*Table 40*/ + } +} + + /*function to initialize the UDP networking stuff*/ Boolean netInit(char *ifaceName) @@ -216,12 +432,6 @@ { } -/*Function to pack MMClockDescription*/ -void -packMMClockDescription() -{ -} - /*Function to unpack the header of received message*/ void unpackHeader(Octet *message, MsgHeader *h) @@ -296,13 +506,13 @@ { Octet *outmessage = (Octet*)(malloc(PACKET_SIZE)); - memset(outmessage, 0, sizeof(MANAGEMENT_LENGTH)); Octet *inmessage = (Octet*)(malloc(PACKET_SIZE)); - memset(inmessage, 0, sizeof(MANAGEMENT_LENGTH)); + int tlvtype; int managementId; - + Boolean toSend = TRUE; + Boolean toRec = TRUE; out_sequence = 0; in_sequence = 0; out_length = 0; @@ -314,6 +524,7 @@ } char command[10]; + char new_command[10]; /* * Command line arguments would include the IP address of PTP daemon and * interface on which it runs @@ -331,13 +542,17 @@ printf("Enter your command: 'send' for sending management message, \n \ 'show_previous' to display received response, \n \ - 'show_fields' to see management message fields\n>"); + 'show_fields' to see management message fields\ncommand>"); - command[0] = '\0'; + //command[0] = '\0'; scanf("%s", command); - while (strcmp(command, "quit")){ - + int j = 0; + while (strcmp(command,"quit")){ + + memset(outmessage, 0, PACKET_SIZE); + memset(inmessage, 0, PACKET_SIZE); + switch (getCommandId(command)){ case 1: @@ -348,7 +563,7 @@ scanf("%d", &tlvtype); if (tlvtype==TLV_MANAGEMENT){ - printf(">managementId ?"); + printf(">managementId (0-7)?"); scanf("%d", &managementId); switch(managementId){ @@ -356,45 +571,71 @@ packMMNullManagement(outmessage); break; case MM_CLOCK_DESCRIPTION: - packMMClockDescription(); + packMMClockDescription(outmessage); break; + case MM_USER_DESCRIPTION: + packMMUserDescription(outmessage); + break; + case MM_SAVE_IN_NON_VOLATILE_STORAGE: + packMMSaveInNonVolatileStorage(outmessage); + break; + case MM_RESET_NON_VOLATILE_STORAGE: + packMMResetInNonVolatileStorage(outmessage); + break; + case MM_INITIALIZE: + packMMInitialize(outmessage); + break; + case MM_FAULT_LOG: + packMMFaultLog(outmessage); + break; + case MM_FAULT_LOG_RESET: + packMMFaultLogReset(outmessage); + break; + default: + printf("This managementId is not supported yet\n"); + toSend = FALSE; + } - } } else { - printf("Only TLV_MANAGEMENT (0) is allowed"); + printf("Only TLV_MANAGEMENT (0) is allowed\n"); + toSend = FALSE; break; } - if (!netSendGeneral(outmessage, sizeof(outmessage), - argv[1])) - printf("Error sending message\n"); - else - printf("Management message sent,waiting for response...\n"); + if (toSend){ + if (!netSendGeneral(outmessage, sizeof(outmessage), + argv[1])) + printf("Error sending message\n"); + else { + printf("Management message sent, waiting for response...\n"); - receivedFlag = FALSE; - for (;;){ + receivedFlag = FALSE; +// for (;;){ - /* - * TODO wait for some time to receive a response - * or ack, if not received till timeout send the - * management message again, Use receivedFlag for this. - */ + /* + * TODO wait for some time to receive a response + * or ack, if not received till timeout send the + * management message again, Use receivedFlag for this. + */ - if (netRecv(inmessage)) { - MsgHeader *h; MsgManagement *manage; - unpackHeader(inmessage, h); - if (h->messageType == MANAGEMENT){ - receivedFlag = TRUE; - unpackManagementHeader(inmessage, manage); - if (manage->actionField == RESPONSE) - handleManagementResponse(inmessage, - manage); - else if (manage->actionField == RESPONSE) - handleManagementAck(inmessage, manage); - else if (manage->tlv->tlvType == - TLV_MANAGEMENT_ERROR_STATUS) - handleManagementError(inmessage, manage); - } + if (netRecv(inmessage)) { + MsgHeader *h; MsgManagement *manage; + unpackHeader(inmessage, h); + if (h->messageType == MANAGEMENT){ + receivedFlag = TRUE; + unpackManagementHeader(inmessage, manage); + if (manage->actionField == RESPONSE) + handleManagementResponse(inmessage, + manage); + else if (manage->actionField == RESPONSE) + handleManagementAck(inmessage, manage); + else if (manage->tlv->tlvType == + TLV_MANAGEMENT_ERROR_STATUS) + handleManagementError(inmessage, manage); + } + } + printf("received messages not handled yet\n"); + //} } } @@ -412,12 +653,13 @@ default: printf("Invalid command\n"); } - - printf(">"); - scanf("%s\n", command); + + printf("command>"); + scanf("%s", command); } - + free(outmessage); + free(inmessage); netShutdown(); return (0); } Modified: branches/himanshu-2012/tools/ptpmanager/ptpmanager.h =================================================================== --- branches/himanshu-2012/tools/ptpmanager/ptpmanager.h 2012-06-26 19:34:25 UTC (rev 231) +++ branches/himanshu-2012/tools/ptpmanager/ptpmanager.h 2012-06-27 19:41:25 UTC (rev 232) @@ -12,20 +12,13 @@ #include <net/if.h> #include <stdio.h> +#include <stdlib.h> #include <string.h> #include <stdarg.h> #include <syslog.h> #include <limits.h> -#define MANAGEMENT_LENGTH 48 -#define CLOCK_IDENTITY_LENGTH 8 -#define HEADER_LENGTH 34 -#define PACKET_SIZE 300 -#define MANAGEMENT 13 -#define flip16(x) htons(x) -#define flip32(x) htonl(x) - typedef enum {FALSE=0, TRUE} Boolean; typedef char Octet; typedef signed char Integer8; @@ -55,102 +48,9 @@ int out_length; UInteger16 out_sequence; UInteger16 in_sequence; +Boolean receivedFlag; - /** - * \brief PTP Management Message managementId values (Table 40 in the spec) - */ -/* SLAVE_ONLY conflicts with another constant, so scope with MM_ */ -enum { - /* Applicable to all node types */ - MM_NULL_MANAGEMENT=0x0000, - MM_CLOCK_DESCRIPTION=0x0001, - MM_USER_DESCRIPTION=0x0002, - MM_SAVE_IN_NON_VOLATILE_STORAGE=0x0003, - MM_RESET_NON_VOLATILE_STORAGE=0x0004, - MM_INITIALIZE=0x0005, - MM_FAULT_LOG=0x0006, - MM_FAULT_LOG_RESET=0x0007, - - /* Reserved: 0x0008 - 0x1FFF */ - - /* Applicable to ordinary and boundary clocks */ - MM_DEFAULT_DATA_SET=0x2000, - MM_CURRENT_DATA_SET=0x2001, - MM_PARENT_DATA_SET=0x2002, - MM_TIME_PROPERTIES_DATA_SET=0x2003, - MM_PORT_DATA_SET=0x2004, - MM_PRIORITY1=0x2005, - MM_PRIORITY2=0x2006, - MM_DOMAIN=0x2007, - MM_SLAVE_ONLY=0x2008, - MM_LOG_ANNOUNCE_INTERVAL=0x2009, - MM_ANNOUNCE_RECEIPT_TIMEOUT=0x200A, - MM_LOG_SYNC_INTERVAL=0x200B, - MM_VERSION_NUMBER=0x200C, - MM_ENABLE_PORT=0x200D, - MM_DISABLE_PORT=0x200E, - MM_TIME=0x200F, - MM_CLOCK_ACCURACY=0x2010, - MM_UTC_PROPERTIES=0x2011, - MM_TRACEABILITY_PROPERTIES=0x2012, - MM_TIMESCALE_PROPERTIES=0x2013, - MM_UNICAST_NEGOTIATION_ENABLE=0x2014, - MM_PATH_TRACE_LIST=0x2015, - MM_PATH_TRACE_ENABLE=0x2016, - MM_GRANDMASTER_CLUSTER_TABLE=0x2017, - MM_UNICAST_MASTER_TABLE=0x2018, - MM_UNICAST_MASTER_MAX_TABLE_SIZE=0x2019, - MM_ACCEPTABLE_MASTER_TABLE=0x201A, - MM_ACCEPTABLE_MASTER_TABLE_ENABLED=0x201B, - MM_ACCEPTABLE_MASTER_MAX_TABLE_SIZE=0x201C, - MM_ALTERNATE_MASTER=0x201D, - MM_ALTERNATE_TIME_OFFSET_ENABLE=0x201E, - MM_ALTERNATE_TIME_OFFSET_NAME=0x201F, - MM_ALTERNATE_TIME_OFFSET_MAX_KEY=0x2020, - MM_ALTERNATE_TIME_OFFSET_PROPERTIES=0x2021, - - /* Reserved: 0x2022 - 0x3FFF */ - - /* Applicable to transparent clocks */ - MM_TRANSPARENT_CLOCK_DEFAULT_DATA_SET=0x4000, - MM_TRANSPARENT_CLOCK_PORT_DATA_SET=0x4001, - MM_PRIMARY_DOMAIN=0x4002, - - /* Reserved: 0x4003 - 0x5FFF */ - - /* Applicable to ordinary, boundary, and transparent clocks */ - MM_DELAY_MECHANISM=0x6000, - MM_LOG_MIN_PDELAY_REQ_INTERVAL=0x6001, - - /* Reserved: 0x6002 - 0xBFFF */ - /* Implementation-specific identifiers: 0xC000 - 0xDFFF */ - /* Assigned by alternate PTP profile: 0xE000 - 0xFFFE */ - /* Reserved: 0xFFFF */ -}; - -/* - * \brief PTP tlvType values for management messages (Table 34 in the spec) - */ -enum { - /* Standard TLVs */ - TLV_MANAGEMENT=0x0001, - TLV_MANAGEMENT_ERROR_STATUS=0x0002 -}; - -/** - * \brief Management Message actions (Table 38 in the spec) - */ -enum { - GET=0, - SET, - RESPONSE, - COMMAND, - ACKNOWLEDGE -}; - -Boolean receivedFlag; -/** * \brief Struct used to store network datas */ typedef struct { @@ -172,6 +72,10 @@ #include "header.def" } MsgHeader; +typedef struct { + UInteger8 lengthField; + Octet* textField; +} PTPText; /** * \brief Management TLV message fields @@ -184,6 +88,15 @@ } ManagementTLV; /** + * \brief Management TLV User Description fields (Table 43 of the spec) + */ +/* Management TLV User Description Message */ +typedef struct { + PTPText userDescription; +} MMUserDescription; + + +/** * \brief Management message fields (Table 37 of the spec) */ /*management Message*/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |