1/* 2 3Copyright 1993, 1998 The Open Group 4 5Permission to use, copy, modify, distribute, and sell this software and its 6documentation for any purpose is hereby granted without fee, provided that 7the above copyright notice appear in all copies and that both that 8copyright notice and this permission notice appear in supporting 9documentation. 10 11The above copyright notice and this permission notice shall be included in 12all copies or substantial portions of the Software. 13 14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 18AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 19CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20 21Except as contained in this notice, the name of The Open Group shall not be 22used in advertising or otherwise to promote the sale, use or other dealings 23in this Software without prior written authorization from The Open Group. 24 25*/ 26 27/* 28 * Author: Ralph Mor, X Consortium 29 */ 30 31#ifdef HAVE_CONFIG_H 32#include <config.h> 33#endif 34#include <X11/SM/SMlib.h> 35#include "SMlibint.h" 36#include <stdio.h> 37 38/* 39 * Free property 40 */ 41 42void 43SmFreeProperty(SmProp *prop) 44{ 45 if (prop) 46 { 47 int i; 48 49 if (prop->name) 50 free (prop->name); 51 if (prop->type) 52 free (prop->type); 53 if (prop->vals) 54 { 55 for (i = 0; i < prop->num_vals; i++) 56 if (prop->vals[i].value) 57 free (prop->vals[i].value); 58 free (prop->vals); 59 } 60 61 free (prop); 62 } 63} 64 65 66/* 67 * Free reason messages 68 */ 69 70void 71SmFreeReasons(int count, char **reasonMsgs) 72{ 73 if (reasonMsgs) 74 { 75 int i; 76 77 for (i = 0; i < count; i++) 78 free (reasonMsgs[i]); 79 80 free (reasonMsgs); 81 } 82} 83 84 85 86/* 87 * Smc informational functions 88 */ 89 90int 91SmcProtocolVersion(SmcConn smcConn) 92{ 93 return (smcConn->proto_major_version); 94} 95 96 97int 98SmcProtocolRevision(SmcConn smcConn) 99{ 100 return (smcConn->proto_minor_version); 101} 102 103 104char * 105SmcVendor(SmcConn smcConn) 106{ 107 return strdup(smcConn->vendor); 108} 109 110 111char * 112SmcRelease(SmcConn smcConn) 113{ 114 return strdup(smcConn->release); 115} 116 117 118char * 119SmcClientID(SmcConn smcConn) 120{ 121 return strdup(smcConn->client_id); 122} 123 124 125IceConn 126SmcGetIceConnection(SmcConn smcConn) 127{ 128 return (smcConn->iceConn); 129} 130 131 132 133/* 134 * Sms informational functions 135 */ 136 137int 138SmsProtocolVersion(SmsConn smsConn) 139{ 140 return (smsConn->proto_major_version); 141} 142 143 144int 145SmsProtocolRevision(SmsConn smsConn) 146{ 147 return (smsConn->proto_minor_version); 148} 149 150 151char * 152SmsClientID(SmsConn smsConn) 153{ 154 return strdup(smsConn->client_id); 155} 156 157 158IceConn 159SmsGetIceConnection(SmsConn smsConn) 160{ 161 return (smsConn->iceConn); 162} 163