| OLD | NEW |
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
| 9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 bool binary; | 85 bool binary; |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 class DataChannelObserver { | 88 class DataChannelObserver { |
| 89 public: | 89 public: |
| 90 // The data channel state have changed. | 90 // The data channel state have changed. |
| 91 virtual void OnStateChange() = 0; | 91 virtual void OnStateChange() = 0; |
| 92 // A data buffer was successfully received. | 92 // A data buffer was successfully received. |
| 93 virtual void OnMessage(const DataBuffer& buffer) = 0; | 93 virtual void OnMessage(const DataBuffer& buffer) = 0; |
| 94 // The data channel's buffered_amount has changed. | 94 // The data channel's buffered_amount has changed. |
| 95 virtual void OnBufferedAmountChange(uint64 previous_amount){}; | 95 virtual void OnBufferedAmountChange(uint64_t previous_amount){}; |
| 96 | 96 |
| 97 protected: | 97 protected: |
| 98 virtual ~DataChannelObserver() {} | 98 virtual ~DataChannelObserver() {} |
| 99 }; | 99 }; |
| 100 | 100 |
| 101 class DataChannelInterface : public rtc::RefCountInterface { | 101 class DataChannelInterface : public rtc::RefCountInterface { |
| 102 public: | 102 public: |
| 103 // Keep in sync with DataChannel.java:State and | 103 // Keep in sync with DataChannel.java:State and |
| 104 // RTCDataChannel.h:RTCDataChannelState. | 104 // RTCDataChannel.h:RTCDataChannelState. |
| 105 enum DataState { | 105 enum DataState { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 128 virtual void UnregisterObserver() = 0; | 128 virtual void UnregisterObserver() = 0; |
| 129 // The label attribute represents a label that can be used to distinguish this | 129 // The label attribute represents a label that can be used to distinguish this |
| 130 // DataChannel object from other DataChannel objects. | 130 // DataChannel object from other DataChannel objects. |
| 131 virtual std::string label() const = 0; | 131 virtual std::string label() const = 0; |
| 132 virtual bool reliable() const = 0; | 132 virtual bool reliable() const = 0; |
| 133 | 133 |
| 134 // TODO(tommyw): Remove these dummy implementations when all classes have | 134 // TODO(tommyw): Remove these dummy implementations when all classes have |
| 135 // implemented these APIs. They should all just return the values the | 135 // implemented these APIs. They should all just return the values the |
| 136 // DataChannel was created with. | 136 // DataChannel was created with. |
| 137 virtual bool ordered() const { return false; } | 137 virtual bool ordered() const { return false; } |
| 138 virtual uint16 maxRetransmitTime() const { return 0; } | 138 virtual uint16_t maxRetransmitTime() const { return 0; } |
| 139 virtual uint16 maxRetransmits() const { return 0; } | 139 virtual uint16_t maxRetransmits() const { return 0; } |
| 140 virtual std::string protocol() const { return std::string(); } | 140 virtual std::string protocol() const { return std::string(); } |
| 141 virtual bool negotiated() const { return false; } | 141 virtual bool negotiated() const { return false; } |
| 142 | 142 |
| 143 virtual int id() const = 0; | 143 virtual int id() const = 0; |
| 144 virtual DataState state() const = 0; | 144 virtual DataState state() const = 0; |
| 145 // The buffered_amount returns the number of bytes of application data | 145 // The buffered_amount returns the number of bytes of application data |
| 146 // (UTF-8 text and binary data) that have been queued using SendBuffer but | 146 // (UTF-8 text and binary data) that have been queued using SendBuffer but |
| 147 // have not yet been transmitted to the network. | 147 // have not yet been transmitted to the network. |
| 148 virtual uint64 buffered_amount() const = 0; | 148 virtual uint64_t buffered_amount() const = 0; |
| 149 virtual void Close() = 0; | 149 virtual void Close() = 0; |
| 150 // Sends |data| to the remote peer. | 150 // Sends |data| to the remote peer. |
| 151 virtual bool Send(const DataBuffer& buffer) = 0; | 151 virtual bool Send(const DataBuffer& buffer) = 0; |
| 152 | 152 |
| 153 protected: | 153 protected: |
| 154 virtual ~DataChannelInterface() {} | 154 virtual ~DataChannelInterface() {} |
| 155 }; | 155 }; |
| 156 | 156 |
| 157 } // namespace webrtc | 157 } // namespace webrtc |
| 158 | 158 |
| 159 #endif // TALK_APP_WEBRTC_DATACHANNELINTERFACE_H_ | 159 #endif // TALK_APP_WEBRTC_DATACHANNELINTERFACE_H_ |
| OLD | NEW |