Line data Source code
1 : // Copyright 2025 Accenture. 2 : 3 : #pragma once 4 : 5 : #include <platform/estdint.h> 6 : 7 : namespace tcp 8 : { 9 : /** 10 : * Interface for classes that want to be notified about sent TCP data. 11 : */ 12 : 13 : class IDataSendNotificationListener 14 : { 15 : public: 16 : IDataSendNotificationListener(IDataSendNotificationListener const&) = delete; 17 : IDataSendNotificationListener& operator=(IDataSendNotificationListener const&) = delete; 18 : 19 : /** 20 : * Results that dataSent may return 21 : * \enum SendStatus 22 : */ 23 : enum SendResult 24 : { 25 : /** data has been successfully sent */ 26 : DATA_SENT = 0, 27 : /** there is buffer again available */ 28 : DATA_NOT_SENT = 1, 29 : DATA_QUEUED = DATA_NOT_SENT 30 : }; 31 : 32 : /** 33 : * default constructor 34 : */ 35 2 : IDataSendNotificationListener() = default; 36 : 37 : /** 38 : * callback that gets invoked when a Socket has sent data 39 : * \param length number of bytes that have been sent 40 : * \param result result of send process 41 : * - DATA_SENT if data has been successfully sent 42 : * - BUFFER_AVAILABLE if new buffer is available again 43 : * 44 : * \note 45 : * This callback is invoked when the data has been successfully copied 46 : * to the TCP stack's internal buffer. This is not a guarantee that 47 : * the data has been received by the remote system. 48 : */ 49 : virtual void dataSent(uint16_t length, SendResult result) = 0; 50 : }; 51 : 52 : } // namespace tcp