Pepper_42_C++_interfaces
udp_socket_extension_samsung.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Samsung Electronics, Visual Display Division.
3  * All Rights Reserved.
4  *
5  * @author Tomasz Plewnia <t.plewnia@samsung.com>
6  *
7  * Use of this source code is governed by a BSD-style license that can be
8  * found in the Chromium-LICENSE file.
9  */
10 
11 #ifndef PPAPI_CPP_SAMSUNG_SOCKET_EXTENSION_SAMSUNG_H_
12 #define PPAPI_CPP_SAMSUNG_SOCKET_EXTENSION_SAMSUNG_H_
13 
14 #include "ppapi/c/samsung/ppb_udp_socket_extension_samsung.h"
15 #include "ppapi/cpp/udp_socket.h"
16 
17 /// @file
18 /// This file defines the API used to handle gesture input events.
19 /// This file defines the API providing additional sockets functionality
20 /// for PPB_UDPSocket.
21 /// To use this interface, one have to create standard UDPSocket object.
22 namespace pp {
23 
25 public:
26  /// Constructs an is_null() gesture input event object.
28 
29  /// This constructor constructs a extended socket object from the
30  /// provided generic UDP socket. If the given socket is itself
31  /// is_null() or is not a UDPSocket, the extended socket object will be
32  /// is_null().
33  ///
34  /// @param[in] socket A generic UDP socket instance.
35  explicit UDPSocketExtensionSamsung(const InstanceHandle& instance);
36 
37  /// Get a socket option on the associated socket.
38  /// Please see the <code>PP_UDPSocket_Option</code> description for option
39  /// names, value types and allowed values.
40  /// Socket need to be already bound and method will fail with
41  /// <code>PP_ERROR_FAILED</code> if it's not.
42  ///
43  /// @param[in] udp_socket A <code>PP_Resource</code> corresponding to a UDP
44  /// socket.
45  /// @param[in] name The option to get.
46  /// @param[out] Value of requested option.
47  /// @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
48  /// completion.
49  ///
50  /// @return An int32_t containing an error code from <code>pp_errors.h</code>
51  int32_t GetOption(PP_UDPSocket_Option name,
52  const CompletionCallbackWithOutput<Var>& callback);
53 
54  /// Join a multicast group. Use optional <code>source_addr</code> to allow
55  /// receiving data only from a specified source. This option can be used
56  /// multiple times to allow receiving data from more than one source.
57  /// Socket need to be already bound and method will fail with
58  /// <code>PP_ERROR_FAILED</code> if it's not.
59  ///
60  /// @param[in] udp_socket A <code>PP_Resource</code> corresponding to a UDP
61  /// socket.
62  /// @param[in] membership A <code>PP_MulticastMembership</code> multicast
63  /// group and optional source IP.
64  /// @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
65  /// completion.
66  ///
67  /// @return An int32_t containing an error code from <code>pp_errors.h</code>
68  int32_t JoinMulticast(const struct PP_MulticastMembership& membership,
69  const CompletionCallback& callback);
70 
71  /// Leave a multicast group. Use optional member <code>source_addr</code>
72  /// to stop receiving data from multicast group that come from a given source.
73  /// If the application has subscribed to multiple sources within the same
74  /// group, data from the remaining sources will still be delivered.
75  /// Socket need to be already bound and method will fail with
76  /// <code>PP_ERROR_FAILED</code> if it's not.
77  ///
78  /// @param[in] udp_socket A <code>PP_Resource</code> corresponding to a UDP
79  /// socket.
80  /// @param[in] membership A <code>PP_MulticastMembership</code> multicast
81  /// group and optional source IP.
82  /// @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
83  /// completion.
84  ///
85  /// @return An int32_t containing an error code from <code>pp_errors.h</code>
86  int32_t LeaveMulticast(const struct PP_MulticastMembership& membership,
87  const CompletionCallback& callback);
88 };
89 
90 } // naemspace pp
91 
92 #endif // PPAPI_CPP_SAMSUNG_SOCKET_EXTENSION_SAMSUNG_H_
93 
UDPSocketExtensionSamsung()
Constructs an is_null() gesture input event object.
int32_t JoinMulticast(const struct PP_MulticastMembership &membership, const CompletionCallback &callback)
int32_t LeaveMulticast(const struct PP_MulticastMembership &membership, const CompletionCallback &callback)
int32_t GetOption(PP_UDPSocket_Option name, const CompletionCallbackWithOutput< Var > &callback)