2 * Copyright (c) 2004-2007 Voltaire, Inc. All rights reserved.
3 * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
4 * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
6 * This software is available to you under a choice of one of two
7 * licenses. You may choose to be licensed under the terms of the GNU
8 * General Public License (GPL) Version 2, available from the file
9 * COPYING in the main directory of this source tree, or the
10 * OpenIB.org BSD license below:
12 * Redistribution and use in source and binary forms, with or
13 * without modification, are permitted provided that the following
16 * - Redistributions of source code must retain the above
17 * copyright notice, this list of conditions and the following
20 * - Redistributions in binary form must reproduce the above
21 * copyright notice, this list of conditions and the following
22 * disclaimer in the documentation and/or other materials
23 * provided with the distribution.
25 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
41 * Declaration of osm_service_rec_t.
42 * This object represents an IBA Service Record.
43 * This object is part of the OpenSM family of objects.
46 #include <iba/ib_types.h>
47 #include <complib/cl_qmap.h>
48 #include <complib/cl_spinlock.h>
49 #include <opensm/osm_subnet.h>
50 #include <opensm/osm_log.h>
53 # define BEGIN_C_DECLS extern "C" {
54 # define END_C_DECLS }
55 #else /* !__cplusplus */
56 # define BEGIN_C_DECLS
58 #endif /* __cplusplus */
61 /****h* OpenSM/Service Record
66 * The service record encapsulates the information needed by the
67 * SA to manage service registrations.
69 * The service records is not thread safe, thus callers must provide
72 * This object should be treated as opaque and should be
73 * manipulated only through the provided functions.
76 * Anil S Keshavamurthy, Intel
79 /****s* OpenSM: Service Record/osm_svcr_t
84 * Service Record structure.
86 * The osm_svcr_t object should be treated as opaque and should
87 * be manipulated only through the provided functions.
91 typedef struct osm_svcr {
92 cl_list_item_t list_item;
93 ib_service_record_t service_record;
94 uint32_t modified_time;
95 uint32_t lease_period;
100 * Map Item for qmap linkage. Must be first element!!
103 * IB Service record structure
106 * Last modified time of this record in milliseconds
109 * Remaining lease period for this record
115 /****f* OpenSM: Service Record/osm_svcr_new
120 * Allocates and initializes a Service Record for use.
124 osm_svcr_t *osm_svcr_new(IN const ib_service_record_t * p_svc_rec);
128 * [in] Pointer to IB Service Record
131 * pointer to osm_svcr_t structure.
134 * Allows calling other service record methods.
137 * Service Record, osm_svcr_delete
140 /****f* OpenSM: Service Record/osm_svcr_init
145 * Initializes the osm_svcr_t structure.
150 osm_svcr_init(IN osm_svcr_t * const p_svcr,
151 IN const ib_service_record_t * p_svc_rec);
155 * [in] Pointer to osm_svcr_t structure
157 * [in] Pointer to the ib_service_record_t
163 /****f* OpenSM: Service Record/osm_svcr_delete
168 * Deallocates the osm_svcr_t structure.
172 void osm_svcr_delete(IN osm_svcr_t * const p_svcr);
176 * [in] Pointer to osm_svcr_t structure
179 * Service Record, osm_svcr_new
182 osm_svcr_t *osm_svcr_get_by_rid(IN osm_subn_t const *p_subn,
183 IN osm_log_t * p_log,
184 IN ib_service_record_t * const p_svc_rec);
187 osm_svcr_insert_to_db(IN osm_subn_t * p_subn,
188 IN osm_log_t * p_log, IN osm_svcr_t * p_svcr);
190 osm_svcr_remove_from_db(IN osm_subn_t * p_subn,
191 IN osm_log_t * p_log, IN osm_svcr_t * p_svcr);
194 #endif /* _OSM_SVCR_H_ */