From 8171d46410b1ea937b0ae59577b9b36ed151149a Mon Sep 17 00:00:00 2001 From: "eduardo.lima" Date: Fri, 13 Mar 2015 08:40:21 -0700 Subject: Add support for multicast in PPB_UDPSocket API This change introduces two new values to be used with SetOption(), to set up the behavior of the multicast packets: - PP_UDPSOCKET_OPTION_MULTICAST_LOOP (Boolean) Whether packets sent from the host to the multicast group will be looped back to the host or not. - PP_UDPSOCKET_OPTION_MULTICAST_TTL (Integer) Sets time-to-live of multicast packets sent to the multicast group. It also introduces two new functions JoinGroup() and LeaveGroup(), both of them expecting the address of the multicast group as specified by the PPB_NetAddress API. These two functions should only be called after the socket is bound. This CL adds specific test cases to browser_tests in order to exercise the different versions of the SetOption function. For this reason, the PPAPI UDPSocket tests were split into multiple tests, instead of a single one that enclosed all of them. This way we get clearer information about the results of each test. BUG=430939 TEST=browser_tests NOPRESUBMIT=true Signed-off-by: Eduardo Lima (Etrunko) Review URL: https://codereview.chromium.org/704133005 Cr-Commit-Position: refs/heads/master@{#320504} --- ppapi/cpp/udp_socket.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'ppapi/cpp/udp_socket.h') diff --git a/ppapi/cpp/udp_socket.h b/ppapi/cpp/udp_socket.h index 707c621..69e906f 100644 --- a/ppapi/cpp/udp_socket.h +++ b/ppapi/cpp/udp_socket.h @@ -156,6 +156,30 @@ class UDPSocket : public Resource { int32_t SetOption(PP_UDPSocket_Option name, const Var& value, const CompletionCallback& callback); + + /// Joins the multicast group with address specified by group + /// parameter, which is expected to be a NetAddress object. + /// + /// @param[in] group A NetAddress corresponding to the network + /// address of the multicast group. + /// @param[in] callback A CompletionCallback to be called upon + /// completion. + /// + /// @return An int32_t containing an error code from pp_errors.h. + int32_t JoinGroup(const NetAddress& group, + const CompletionCallback callback); + + /// Leaves the multicast group with address specified by group + /// parameter, which is expected to be a NetAddress object. + /// + /// @param[in] group A NetAddress corresponding to the network + /// address of the multicast group. + /// @param[in] callback A CompletionCallback to be called upon + /// completion. + /// + /// @return An int32_t containing an error code from pp_errors.h. + int32_t LeaveGroup(const NetAddress& group, + const CompletionCallback callback); }; } // namespace pp -- cgit v1.1