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 // Multiple-included file, no traditional include guard.
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_
17 #include "base/file_descriptor_posix.h"
21 struct LocalDiscoveryMsg_SocketInfo
{
22 LocalDiscoveryMsg_SocketInfo()
23 : address_family(net::ADDRESS_FAMILY_UNSPECIFIED
),
27 base::FileDescriptor descriptor
;
28 net::AddressFamily address_family
;
29 uint32 interface_index
;
33 #endif // CHROME_COMMON_LOCAL_DISCOVERY_LOCAL_DISCOVERY_MESSAGES_H_
35 #define IPC_MESSAGE_START LocalDiscoveryMsgStart
37 IPC_ENUM_TRAITS_MAX_VALUE(local_discovery::ServiceWatcher::UpdateType
,
38 local_discovery::ServiceWatcher::UPDATE_TYPE_LAST
)
40 IPC_ENUM_TRAITS_MAX_VALUE(
41 local_discovery::ServiceResolver::RequestStatus
,
42 local_discovery::ServiceResolver::REQUEST_STATUS_LAST
)
44 IPC_ENUM_TRAITS_MAX_VALUE(net::AddressFamily
, net::ADDRESS_FAMILY_LAST
)
46 IPC_STRUCT_TRAITS_BEGIN(local_discovery::ServiceDescription
)
47 IPC_STRUCT_TRAITS_MEMBER(service_name
)
48 IPC_STRUCT_TRAITS_MEMBER(address
)
49 IPC_STRUCT_TRAITS_MEMBER(metadata
)
50 IPC_STRUCT_TRAITS_MEMBER(ip_address
)
51 IPC_STRUCT_TRAITS_MEMBER(last_seen
)
52 IPC_STRUCT_TRAITS_END()
55 IPC_STRUCT_TRAITS_BEGIN(LocalDiscoveryMsg_SocketInfo
)
56 IPC_STRUCT_TRAITS_MEMBER(descriptor
)
57 IPC_STRUCT_TRAITS_MEMBER(address_family
)
58 IPC_STRUCT_TRAITS_MEMBER(interface_index
)
59 IPC_STRUCT_TRAITS_END()
61 //------------------------------------------------------------------------------
62 // Utility process messages:
63 // These are messages from the browser to the utility process.
66 IPC_MESSAGE_CONTROL1(LocalDiscoveryMsg_SetSockets
,
67 std::vector
<LocalDiscoveryMsg_SocketInfo
> /* sockets */)
70 // Creates watcher and starts listening in utility process.
71 IPC_MESSAGE_CONTROL2(LocalDiscoveryMsg_StartWatcher
,
73 std::string
/* service_type */)
75 // Discovers new services.
76 IPC_MESSAGE_CONTROL2(LocalDiscoveryMsg_DiscoverServices
,
78 bool /* force_update */)
80 // Discovers new services.
81 IPC_MESSAGE_CONTROL2(LocalDiscoveryMsg_SetActivelyRefreshServices
,
83 bool /* actively_refresh_services */)
85 // Destroys watcher in utility process.
86 IPC_MESSAGE_CONTROL1(LocalDiscoveryMsg_DestroyWatcher
,
89 // Creates service resolver and starts resolving service in utility process.
90 IPC_MESSAGE_CONTROL2(LocalDiscoveryMsg_ResolveService
,
92 std::string
/* service_name */)
94 // Destroys service resolver in utility process.
95 IPC_MESSAGE_CONTROL1(LocalDiscoveryMsg_DestroyResolver
,
98 // Creates a local domain resolver and starts resolving in utility process.
99 IPC_MESSAGE_CONTROL3(LocalDiscoveryMsg_ResolveLocalDomain
,
101 std::string
/* domain */,
102 net::AddressFamily
/* address_family */)
104 // Destroys local domain resolver in utility process.
105 IPC_MESSAGE_CONTROL1(LocalDiscoveryMsg_DestroyLocalDomainResolver
,
108 // Stops local discovery in utility process. http://crbug.com/268466.
109 IPC_MESSAGE_CONTROL0(LocalDiscoveryMsg_ShutdownLocalDiscovery
)
112 //------------------------------------------------------------------------------
113 // Utility process host messages:
114 // These are messages from the utility process to the browser.
116 // Notifies browser process if process failed.
117 IPC_MESSAGE_CONTROL0(LocalDiscoveryHostMsg_Error
)
119 // Notifies browser process about new services.
120 IPC_MESSAGE_CONTROL3(LocalDiscoveryHostMsg_WatcherCallback
,
122 local_discovery::ServiceWatcher::UpdateType
/* update */,
123 std::string
/* service_name */)
125 // Notifies browser process about service resolution results.
126 IPC_MESSAGE_CONTROL3(
127 LocalDiscoveryHostMsg_ResolverCallback
,
129 local_discovery::ServiceResolver::RequestStatus
/* status */,
130 local_discovery::ServiceDescription
/* description */)
132 // Notifies browser process about local domain resolution results.
133 IPC_MESSAGE_CONTROL4(
134 LocalDiscoveryHostMsg_LocalDomainResolverCallback
,
137 net::IPAddressNumber
/* ip_address_ipv4 */,
138 net::IPAddressNumber
/* ip_address_ipv6 */)