cipmessagerouter.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*******************************************************************************
  2. * Copyright (c) 2009, Rockwell Automation, Inc.
  3. * All rights reserved.
  4. *
  5. ******************************************************************************/
  6. #ifndef OPENER_CIPMESSAGEROUTER_H_
  7. #define OPENER_CIPMESSAGEROUTER_H_
  8. #include "typedefs.h"
  9. #include "ciptypes.h"
  10. /** @brief Message Router class code */
  11. static const CipUint kCipMessageRouterClassCode = 0x02U;
  12. /* public functions */
  13. /** @brief Initialize the data structures of the message router
  14. * @return kEipStatusOk if class was initialized, otherwise kEipStatusError
  15. */
  16. EipStatus CipMessageRouterInit(void);
  17. /** @brief Free all data allocated by the classes created in the CIP stack
  18. */
  19. void DeleteAllClasses(void);
  20. /** @brief Notify the MessageRouter that an explicit message (connected or unconnected)
  21. * has been received. This function will be called from the encapsulation layer.
  22. * The CPF structure is already parsed an can be accessed via the global variable:
  23. * g_stCPFDataItem.
  24. * @param data pointer to the data buffer of the message directly at the beginning of the CIP part.
  25. * @param data_length number of bytes in the data buffer
  26. * @param originator_address The address of the originator as received
  27. * @param encapsulation_session The associated encapsulation session of the explicit message
  28. * @return kEipStatusError on fault
  29. * kEipStatusOk on success
  30. */
  31. EipStatus NotifyMessageRouter(EipUint8 *data,
  32. int data_length,
  33. CipMessageRouterResponse *message_router_response,
  34. const struct sockaddr *const originator_address,
  35. const CipSessionHandle encapsulation_session);
  36. /*! Register a class at the message router.
  37. * In order that the message router can deliver
  38. * explicit messages each class has to register.
  39. * Will be automatically done when invoking create
  40. * createCIPClass.
  41. * @param cip_class CIP class to be registered
  42. * @return kEipStatusOk on success
  43. */
  44. EipStatus RegisterCipClass(CipClass *cip_class);
  45. #endif /* OPENER_CIPMESSAGEROUTER_H_ */