cipdlr.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /******************************************************************************
  2. * Copyright (c) 2019, Rockwell Automation, Inc.
  3. * All rights reserved.
  4. *
  5. *****************************************************************************/
  6. /** @file
  7. * @brief Declare public interface of the DLR object
  8. *
  9. * @author Stefan Maetje <stefan.maetje@esd.eu>
  10. *
  11. */
  12. #ifndef OPENER_CIPDLR_H_
  13. #define OPENER_CIPDLR_H_
  14. #include "typedefs.h"
  15. #include "ciptypes.h"
  16. /** @brief DLR object class code */
  17. static const CipUint kCipDlrClassCode = 0x47U;
  18. /* ********************************************************************
  19. * Type declarations
  20. */
  21. /** @brief Provide bit masks for the Capability Flags attribute (#12)
  22. *
  23. * The @ref kDlrCapAnnounceBased and @ref kDlrCapBeaconBased capability
  24. * flags are mutually exclusive but one of it must be set.
  25. */
  26. typedef enum {
  27. /** Device is an announce based ring node. */
  28. kDlrCapAnnounceBased = 0x01,
  29. /** Device is a beacon based ring node. */
  30. kDlrCapBeaconBased = 0x02,
  31. /** The device is capable of providing the supervisor function. */
  32. kDlrCapSupervisor = 0x20,
  33. /** The device is capable of providing the redundant gateway function. */
  34. kDlrCapRedundantGateway = 0x40,
  35. /** The device is capable of supporting the Flush_Tables frame. */
  36. kDlrCapFlushTableFrame = 0x80,
  37. } CipDlrCapabilityFlags;
  38. /** @brief Node address information for a DLR node
  39. *
  40. * This is the node address information that uniquely identifies a
  41. * participant of the DLR protocol.
  42. */
  43. typedef struct {
  44. CipUdint device_ip; /**< IP address of a participating DLR node */
  45. CipUsint device_mac[6]; /**< MAC address of a participating DLR node */
  46. } CipNodeAddress;
  47. /** @brief Type declaration for the DLR object
  48. *
  49. * This is the type declaration for the DLR object. It contains only the
  50. * attributes needed for a non supervisor and non redundant gateway
  51. * ring participant.
  52. */
  53. typedef struct {
  54. CipUsint network_topology; /**< Attribute #1: */
  55. CipUsint network_status; /**< Attribute #2: */
  56. CipNodeAddress active_supervisor_address; /**< Attribute #10: */
  57. CipDword capability_flags; /**< Attribute #12: */
  58. } CipDlrObject;
  59. /* ********************************************************************
  60. * global public variables
  61. */
  62. extern CipDlrObject g_dlr; /**< declaration of DLR object instance 1 data */
  63. /* ********************************************************************
  64. * public functions
  65. */
  66. /** @brief Initializing the data structures of the DLR object
  67. *
  68. * @return kEipStatusOk on success, otherwise kEipStatusError
  69. */
  70. EipStatus CipDlrInit(void);
  71. #endif /* of OPENER_CIPDLR_H_ */