[cc574511] | 1 | /*
|
---|
| 2 | * Copyright (c) 2011 Jiri Svoboda
|
---|
| 3 | * All rights reserved.
|
---|
| 4 | *
|
---|
| 5 | * Redistribution and use in source and binary forms, with or without
|
---|
| 6 | * modification, are permitted provided that the following conditions
|
---|
| 7 | * are met:
|
---|
| 8 | *
|
---|
| 9 | * - Redistributions of source code must retain the above copyright
|
---|
| 10 | * notice, this list of conditions and the following disclaimer.
|
---|
| 11 | * - Redistributions in binary form must reproduce the above copyright
|
---|
| 12 | * notice, this list of conditions and the following disclaimer in the
|
---|
| 13 | * documentation and/or other materials provided with the distribution.
|
---|
| 14 | * - The name of the author may not be used to endorse or promote products
|
---|
| 15 | * derived from this software without specific prior written permission.
|
---|
| 16 | *
|
---|
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
| 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
| 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
| 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
| 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
| 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
| 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
| 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
| 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
| 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
| 27 | */
|
---|
| 28 |
|
---|
[4122410] | 29 | /** @addtogroup locsrv
|
---|
[cc574511] | 30 | * @{
|
---|
| 31 | */
|
---|
| 32 | /** @file HelenOS location service.
|
---|
| 33 | */
|
---|
| 34 |
|
---|
[32d96e1] | 35 | #ifndef LOCSRV_H_
|
---|
| 36 | #define LOCSRV_H_
|
---|
[cc574511] | 37 |
|
---|
[42a619b] | 38 | #include <ipc/loc.h>
|
---|
[cc574511] | 39 | #include <async.h>
|
---|
| 40 | #include <fibril_synch.h>
|
---|
[8d2dd7f2] | 41 | #include <stddef.h>
|
---|
[cc574511] | 42 |
|
---|
| 43 | /** Representation of server (supplier).
|
---|
| 44 | *
|
---|
| 45 | * Each server supplies a set of services.
|
---|
| 46 | *
|
---|
| 47 | */
|
---|
| 48 | typedef struct {
|
---|
| 49 | /** Link to servers_list */
|
---|
| 50 | link_t servers;
|
---|
[a35b458] | 51 |
|
---|
[cc574511] | 52 | /** List of services supplied by this server */
|
---|
| 53 | list_t services;
|
---|
[a35b458] | 54 |
|
---|
[cc574511] | 55 | /** Session asociated with this server */
|
---|
| 56 | async_sess_t *sess;
|
---|
[a35b458] | 57 |
|
---|
[cc574511] | 58 | /** Server name */
|
---|
| 59 | char *name;
|
---|
[a35b458] | 60 |
|
---|
[cc574511] | 61 | /** Fibril mutex for list of services owned by this server */
|
---|
| 62 | fibril_mutex_t services_mutex;
|
---|
| 63 | } loc_server_t;
|
---|
| 64 |
|
---|
| 65 | /** Info about registered namespaces
|
---|
| 66 | *
|
---|
| 67 | */
|
---|
| 68 | typedef struct {
|
---|
| 69 | /** Link to namespaces_list */
|
---|
| 70 | link_t namespaces;
|
---|
[a35b458] | 71 |
|
---|
[cc574511] | 72 | /** Unique namespace identifier */
|
---|
| 73 | service_id_t id;
|
---|
[a35b458] | 74 |
|
---|
[cc574511] | 75 | /** Namespace name */
|
---|
| 76 | char *name;
|
---|
[a35b458] | 77 |
|
---|
[cc574511] | 78 | /** Reference count */
|
---|
| 79 | size_t refcnt;
|
---|
| 80 | } loc_namespace_t;
|
---|
| 81 |
|
---|
| 82 | /** Info about registered service
|
---|
| 83 | *
|
---|
| 84 | */
|
---|
| 85 | typedef struct {
|
---|
| 86 | /** Link to global list of services (services_list) */
|
---|
| 87 | link_t services;
|
---|
[a35b458] | 88 |
|
---|
[cc574511] | 89 | /** Link to server list of services (loc_server_t.services) */
|
---|
| 90 | link_t server_services;
|
---|
[a35b458] | 91 |
|
---|
[cc574511] | 92 | /** Link to list of services in category (category_t.services) */
|
---|
| 93 | link_t cat_services;
|
---|
[a35b458] | 94 |
|
---|
[d0dd7b5] | 95 | /** List of category memberships (svc_categ_t) */
|
---|
| 96 | list_t cat_memb;
|
---|
[a35b458] | 97 |
|
---|
[cc574511] | 98 | /** Unique service identifier */
|
---|
| 99 | service_id_t id;
|
---|
[a35b458] | 100 |
|
---|
[cc574511] | 101 | /** Service namespace */
|
---|
| 102 | loc_namespace_t *namespace;
|
---|
[a35b458] | 103 |
|
---|
[cc574511] | 104 | /** Service name */
|
---|
| 105 | char *name;
|
---|
[a35b458] | 106 |
|
---|
[cc574511] | 107 | /** Supplier of this service */
|
---|
| 108 | loc_server_t *server;
|
---|
| 109 | } loc_service_t;
|
---|
| 110 |
|
---|
[d0dd7b5] | 111 | extern fibril_mutex_t services_list_mutex;
|
---|
| 112 |
|
---|
[cc574511] | 113 | extern service_id_t loc_create_id(void);
|
---|
[12f9f0d0] | 114 | extern void loc_category_change_event(void);
|
---|
[cc574511] | 115 |
|
---|
| 116 | #endif
|
---|
| 117 |
|
---|
| 118 | /** @}
|
---|
| 119 | */
|
---|