Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / common / local_discovery / local_discovery_messages.h
blob61678ec38cea4192271fa3713f92b00036b78136
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // Defines local discovery messages between the browser and utility process.
7 #include <vector>
9 #include "base/file_descriptor_posix.h"
10 #include "chrome/common/local_discovery/service_discovery_client.h"
11 #include "ipc/ipc_message_macros.h"
13 #ifndef CHROME_COMMON_LOCAL_DISCOVERY_LOCAL_DISCOVERY_MESSAGES_H_
14 #define CHROME_COMMON_LOCAL_DISCOVERY_LOCAL_DISCOVERY_MESSAGES_H_
16 #if defined(OS_POSIX)
17 struct LocalDiscoveryMsg_SocketInfo {
18 LocalDiscoveryMsg_SocketInfo()
19 : address_family(net::ADDRESS_FAMILY_UNSPECIFIED),
20 interface_index(0) {
23 base::FileDescriptor descriptor;
24 net::AddressFamily address_family;
25 uint32 interface_index;
27 #endif // OS_POSIX
29 #endif // CHROME_COMMON_LOCAL_DISCOVERY_LOCAL_DISCOVERY_MESSAGES_H_
31 #define IPC_MESSAGE_START LocalDiscoveryMsgStart
33 IPC_STRUCT_TRAITS_BEGIN(local_discovery::ServiceDescription)
34 IPC_STRUCT_TRAITS_MEMBER(service_name)
35 IPC_STRUCT_TRAITS_MEMBER(address)
36 IPC_STRUCT_TRAITS_MEMBER(metadata)
37 IPC_STRUCT_TRAITS_MEMBER(ip_address)
38 IPC_STRUCT_TRAITS_MEMBER(last_seen)
39 IPC_STRUCT_TRAITS_END()
41 IPC_ENUM_TRAITS(local_discovery::ServiceWatcher::UpdateType)
42 IPC_ENUM_TRAITS(local_discovery::ServiceResolver::RequestStatus)
43 IPC_ENUM_TRAITS(net::AddressFamily)
45 #if defined(OS_POSIX)
46 IPC_STRUCT_TRAITS_BEGIN(LocalDiscoveryMsg_SocketInfo)
47 IPC_STRUCT_TRAITS_MEMBER(descriptor)
48 IPC_STRUCT_TRAITS_MEMBER(address_family)
49 IPC_STRUCT_TRAITS_MEMBER(interface_index)
50 IPC_STRUCT_TRAITS_END()
51 #endif // OS_POSIX
52 //------------------------------------------------------------------------------
53 // Utility process messages:
54 // These are messages from the browser to the utility process.
56 #if defined(OS_POSIX)
57 IPC_MESSAGE_CONTROL1(LocalDiscoveryMsg_SetSockets,
58 std::vector<LocalDiscoveryMsg_SocketInfo> /* sockets */)
59 #endif // OS_POSIX
61 // Creates watcher and starts listening in utility process.
62 IPC_MESSAGE_CONTROL2(LocalDiscoveryMsg_StartWatcher,
63 uint64 /* id */,
64 std::string /* service_type */)
66 // Discovers new services.
67 IPC_MESSAGE_CONTROL2(LocalDiscoveryMsg_DiscoverServices,
68 uint64 /* id */,
69 bool /* force_update */)
71 // Destroys watcher in utility process.
72 IPC_MESSAGE_CONTROL1(LocalDiscoveryMsg_DestroyWatcher,
73 uint64 /* id */)
75 // Creates service resolver and starts resolving service in utility process.
76 IPC_MESSAGE_CONTROL2(LocalDiscoveryMsg_ResolveService,
77 uint64 /* id */,
78 std::string /* service_name */)
80 // Destroys service resolver in utility process.
81 IPC_MESSAGE_CONTROL1(LocalDiscoveryMsg_DestroyResolver,
82 uint64 /* id */)
84 // Creates a local domain resolver and starts resolving in utility process.
85 IPC_MESSAGE_CONTROL3(LocalDiscoveryMsg_ResolveLocalDomain,
86 uint64 /* id */,
87 std::string /* domain */,
88 net::AddressFamily /* address_family */)
90 // Destroys local domain resolver in utility process.
91 IPC_MESSAGE_CONTROL1(LocalDiscoveryMsg_DestroyLocalDomainResolver,
92 uint64 /* id */)
94 // Stops local discovery in utility process. http://crbug.com/268466.
95 IPC_MESSAGE_CONTROL0(LocalDiscoveryMsg_ShutdownLocalDiscovery)
98 //------------------------------------------------------------------------------
99 // Utility process host messages:
100 // These are messages from the utility process to the browser.
102 // Notifies browser process if process failed.
103 IPC_MESSAGE_CONTROL0(LocalDiscoveryHostMsg_Error)
105 // Notifies browser process about new services.
106 IPC_MESSAGE_CONTROL3(LocalDiscoveryHostMsg_WatcherCallback,
107 uint64 /* id */,
108 local_discovery::ServiceWatcher::UpdateType /* update */,
109 std::string /* service_name */)
111 // Notifies browser process about service resolution results.
112 IPC_MESSAGE_CONTROL3(
113 LocalDiscoveryHostMsg_ResolverCallback,
114 uint64 /* id */,
115 local_discovery::ServiceResolver::RequestStatus /* status */,
116 local_discovery::ServiceDescription /* description */)
118 // Notifies browser process about local domain resolution results.
119 IPC_MESSAGE_CONTROL4(
120 LocalDiscoveryHostMsg_LocalDomainResolverCallback,
121 uint64 /* id */,
122 bool /* success */,
123 net::IPAddressNumber /* ip_address_ipv4 */,
124 net::IPAddressNumber /* ip_address_ipv6 */)