1/* 2 * Copyright (c) 2004-2009 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. 5 * 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: 11 * 12 * Redistribution and use in source and binary forms, with or 13 * without modification, are permitted provided that the following 14 * conditions are met: 15 * 16 * - Redistributions of source code must retain the above 17 * copyright notice, this list of conditions and the following 18 * disclaimer. 19 * 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. 24 * 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 32 * SOFTWARE. 33 * 34 */ 35 36#ifndef _OSM_SVCR_H_ 37#define _OSM_SVCR_H_ 38 39/* 40 * Abstract: 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. 44 */ 45 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> 51 52#ifdef __cplusplus 53# define BEGIN_C_DECLS extern "C" { 54# define END_C_DECLS } 55#else /* !__cplusplus */ 56# define BEGIN_C_DECLS 57# define END_C_DECLS 58#endif /* __cplusplus */ 59 60BEGIN_C_DECLS 61/****h* OpenSM/Service Record 62* NAME 63* Service Record 64* 65* DESCRIPTION 66* The service record encapsulates the information needed by the 67* SA to manage service registrations. 68* 69* The service records is not thread safe, thus callers must provide 70* serialization. 71* 72* This object should be treated as opaque and should be 73* manipulated only through the provided functions. 74* 75* AUTHOR 76* Anil S Keshavamurthy, Intel 77* 78*********/ 79/****s* OpenSM: Service Record/osm_svcr_t 80* NAME 81* osm_svcr_t 82* 83* DESCRIPTION 84* Service Record structure. 85* 86* The osm_svcr_t object should be treated as opaque and should 87* be manipulated only through the provided functions. 88* 89* SYNOPSIS 90*/ 91typedef 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; 96} osm_svcr_t; 97/* 98* FIELDS 99* map_item 100* Map Item for qmap linkage. Must be first element!! 101* 102* svc_rec 103* IB Service record structure 104* 105* modified_time 106* Last modified time of this record in milliseconds 107* 108* lease_period 109* Remaining lease period for this record 110* 111* 112* SEE ALSO 113*********/ 114 115/****f* OpenSM: Service Record/osm_svcr_new 116* NAME 117* osm_svcr_new 118* 119* DESCRIPTION 120* Allocates and initializes a Service Record for use. 121* 122* SYNOPSIS 123*/ 124osm_svcr_t *osm_svcr_new(IN const ib_service_record_t * p_svc_rec); 125/* 126* PARAMETERS 127* p_svc_rec 128* [in] Pointer to IB Service Record 129* 130* RETURN VALUES 131* pointer to osm_svcr_t structure. 132* 133* NOTES 134* Allows calling other service record methods. 135* 136* SEE ALSO 137* Service Record, osm_svcr_delete 138*********/ 139 140/****f* OpenSM: Service Record/osm_svcr_init 141* NAME 142* osm_svcr_init 143* 144* DESCRIPTION 145* Initializes the osm_svcr_t structure. 146* 147* SYNOPSIS 148*/ 149void osm_svcr_init(IN osm_svcr_t * p_svcr, 150 IN const ib_service_record_t * p_svc_rec); 151/* 152* PARAMETERS 153* p_svc_rec 154* [in] Pointer to osm_svcr_t structure 155* p_svc_rec 156* [in] Pointer to the ib_service_record_t 157* 158* SEE ALSO 159* Service Record 160*********/ 161 162/****f* OpenSM: Service Record/osm_svcr_delete 163* NAME 164* osm_svcr_delete 165* 166* DESCRIPTION 167* Deallocates the osm_svcr_t structure. 168* 169* SYNOPSIS 170*/ 171void osm_svcr_delete(IN osm_svcr_t * p_svcr); 172/* 173* PARAMETERS 174* p_svc_rec 175* [in] Pointer to osm_svcr_t structure 176* 177* SEE ALSO 178* Service Record, osm_svcr_new 179*********/ 180 181osm_svcr_t *osm_svcr_get_by_rid(IN osm_subn_t const *p_subn, 182 IN osm_log_t * p_log, 183 IN ib_service_record_t * p_svc_rec); 184 185void osm_svcr_insert_to_db(IN osm_subn_t * p_subn, IN osm_log_t * p_log, 186 IN osm_svcr_t * p_svcr); 187void osm_svcr_remove_from_db(IN osm_subn_t * p_subn, IN osm_log_t * p_log, 188 IN osm_svcr_t * p_svcr); 189 190END_C_DECLS 191#endif /* _OSM_SVCR_H_ */ 192