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.
4
5// Defines local discovery messages between the browser and utility process.
6
7#include "chrome/common/local_discovery/service_discovery_client.h"
8#include "ipc/ipc_message_macros.h"
9
10#define IPC_MESSAGE_START LocalDiscoveryMsgStart
11
12IPC_STRUCT_TRAITS_BEGIN(local_discovery::ServiceDescription)
13  IPC_STRUCT_TRAITS_MEMBER(service_name)
14  IPC_STRUCT_TRAITS_MEMBER(address)
15  IPC_STRUCT_TRAITS_MEMBER(metadata)
16  IPC_STRUCT_TRAITS_MEMBER(ip_address)
17  IPC_STRUCT_TRAITS_MEMBER(last_seen)
18IPC_STRUCT_TRAITS_END()
19
20IPC_ENUM_TRAITS(local_discovery::ServiceWatcher::UpdateType)
21IPC_ENUM_TRAITS(local_discovery::ServiceResolver::RequestStatus)
22IPC_ENUM_TRAITS(net::AddressFamily)
23
24//------------------------------------------------------------------------------
25// Utility process messages:
26// These are messages from the browser to the utility process.
27
28// Creates watcher and starts listening in utility process.
29IPC_MESSAGE_CONTROL2(LocalDiscoveryMsg_StartWatcher,
30                     uint64 /* id */,
31                     std::string /* service_type */)
32
33// Discovers new services.
34IPC_MESSAGE_CONTROL2(LocalDiscoveryMsg_DiscoverServices,
35                     uint64 /* id */,
36                     bool /* force_update */)
37
38// Destroys watcher in utility process.
39IPC_MESSAGE_CONTROL1(LocalDiscoveryMsg_DestroyWatcher,
40                     uint64 /* id */)
41
42// Creates service resolver and starts resolving service in utility process.
43IPC_MESSAGE_CONTROL2(LocalDiscoveryMsg_ResolveService,
44                     uint64 /* id */,
45                     std::string /* service_name */)
46
47// Destroys service resolver in utility process.
48IPC_MESSAGE_CONTROL1(LocalDiscoveryMsg_DestroyResolver,
49                     uint64 /* id */)
50
51// Creates a local domain resolver and starts resolving in utility process.
52IPC_MESSAGE_CONTROL3(LocalDiscoveryMsg_ResolveLocalDomain,
53                     uint64 /* id */,
54                     std::string /* domain */,
55                     net::AddressFamily /* address_family */)
56
57// Destroys local domain resolver in utility process.
58IPC_MESSAGE_CONTROL1(LocalDiscoveryMsg_DestroyLocalDomainResolver,
59                     uint64 /* id */)
60
61//------------------------------------------------------------------------------
62// Utility process host messages:
63// These are messages from the utility process to the browser.
64
65// Notifies browser process about new services.
66IPC_MESSAGE_CONTROL3(LocalDiscoveryHostMsg_WatcherCallback,
67                     uint64 /* id */,
68                     local_discovery::ServiceWatcher::UpdateType /* update */,
69                     std::string /* service_name */)
70
71// Notifies browser process about service resolution results.
72IPC_MESSAGE_CONTROL3(
73    LocalDiscoveryHostMsg_ResolverCallback,
74    uint64 /* id */,
75    local_discovery::ServiceResolver::RequestStatus /* status */,
76    local_discovery::ServiceDescription /* description */)
77
78// Notifies browser process about local domain resolution results.
79IPC_MESSAGE_CONTROL3(
80    LocalDiscoveryHostMsg_LocalDomainResolverCallback,
81    uint64 /* id */,
82    bool /* success */,
83    net::IPAddressNumber /* ip_address */)
84