1*24f6443dSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*24f6443dSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*24f6443dSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*24f6443dSAndrew Rist * distributed with this work for additional information 6*24f6443dSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*24f6443dSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*24f6443dSAndrew Rist * "License"); you may not use this file except in compliance 9*24f6443dSAndrew Rist * with the License. You may obtain a copy of the License at 10*24f6443dSAndrew Rist * 11*24f6443dSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*24f6443dSAndrew Rist * 13*24f6443dSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*24f6443dSAndrew Rist * software distributed under the License is distributed on an 15*24f6443dSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*24f6443dSAndrew Rist * KIND, either express or implied. See the License for the 17*24f6443dSAndrew Rist * specific language governing permissions and limitations 18*24f6443dSAndrew Rist * under the License. 19*24f6443dSAndrew Rist * 20*24f6443dSAndrew Rist *************************************************************/ 21*24f6443dSAndrew Rist 22*24f6443dSAndrew Rist 23cdf0e10cSrcweir #ifndef _UNO_MAPPING_H_ 24cdf0e10cSrcweir #define _UNO_MAPPING_H_ 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include <sal/types.h> 27cdf0e10cSrcweir #include <rtl/ustring.h> 28cdf0e10cSrcweir 29cdf0e10cSrcweir 30cdf0e10cSrcweir #ifdef __cplusplus 31cdf0e10cSrcweir extern "C" 32cdf0e10cSrcweir { 33cdf0e10cSrcweir #endif 34cdf0e10cSrcweir 35cdf0e10cSrcweir struct _typelib_InterfaceTypeDescription; 36cdf0e10cSrcweir struct _uno_Mapping; 37cdf0e10cSrcweir struct _uno_Environment; 38cdf0e10cSrcweir 39cdf0e10cSrcweir /** 40cdf0e10cSrcweir Function pointer declaration to acquire a UNO mapping. 41cdf0e10cSrcweir */ 42cdf0e10cSrcweir typedef void (SAL_CALL * uno_AcquireMappingFunc)(struct _uno_Mapping *); 43cdf0e10cSrcweir 44cdf0e10cSrcweir /** 45cdf0e10cSrcweir Function pointer declaration to release a UNO mapping. 46cdf0e10cSrcweir */ 47cdf0e10cSrcweir typedef void (SAL_CALL * uno_ReleaseMappingFunc)(struct _uno_Mapping *); 48cdf0e10cSrcweir 49cdf0e10cSrcweir /** Function pointer declaration to map an interface from one environment to another. 50cdf0e10cSrcweir 51cdf0e10cSrcweir @param pMapping mapping 52cdf0e10cSrcweir @param ppOut [inout] destination interface; existing interfaces are released 53cdf0e10cSrcweir @param pInterface source interface 54cdf0e10cSrcweir @param pInterfaceTypeDescr type description of the interface 55cdf0e10cSrcweir */ 56cdf0e10cSrcweir typedef void (SAL_CALL * uno_MapInterfaceFunc)( 57cdf0e10cSrcweir struct _uno_Mapping * pMapping, 58cdf0e10cSrcweir void ** ppOut, void * pInterface, 59cdf0e10cSrcweir struct _typelib_InterfaceTypeDescription * pInterfaceTypeDescr ); 60cdf0e10cSrcweir 61cdf0e10cSrcweir 62cdf0e10cSrcweir #if defined( SAL_W32) 63cdf0e10cSrcweir #pragma pack(push, 8) 64cdf0e10cSrcweir #elif defined(SAL_OS2) 65cdf0e10cSrcweir #pragma pack(push, 8) 66cdf0e10cSrcweir #endif 67cdf0e10cSrcweir 68cdf0e10cSrcweir /** This is the binary specification of a mapping. 69cdf0e10cSrcweir */ 70cdf0e10cSrcweir typedef struct _uno_Mapping 71cdf0e10cSrcweir { 72cdf0e10cSrcweir /** Acquires mapping 73cdf0e10cSrcweir */ 74cdf0e10cSrcweir uno_AcquireMappingFunc acquire; 75cdf0e10cSrcweir 76cdf0e10cSrcweir /** Releases mapping. The last release may unload bridges. 77cdf0e10cSrcweir */ 78cdf0e10cSrcweir uno_ReleaseMappingFunc release; 79cdf0e10cSrcweir 80cdf0e10cSrcweir /** mapping function 81cdf0e10cSrcweir */ 82cdf0e10cSrcweir uno_MapInterfaceFunc mapInterface; 83cdf0e10cSrcweir } uno_Mapping; 84cdf0e10cSrcweir 85cdf0e10cSrcweir #if defined( SAL_W32) || defined(SAL_OS2) 86cdf0e10cSrcweir #pragma pack(pop) 87cdf0e10cSrcweir #endif 88cdf0e10cSrcweir 89cdf0e10cSrcweir /** Gets an interface mapping from one environment to another. 90cdf0e10cSrcweir 91cdf0e10cSrcweir @param ppMapping [inout] mapping; existing mapping will be released 92cdf0e10cSrcweir @param pFrom source environment 93cdf0e10cSrcweir @param pTo destination environment 94cdf0e10cSrcweir (interfaces resulting in mapInterface() call can be used 95cdf0e10cSrcweir in this language environment) 96cdf0e10cSrcweir @param pAddPurpose additional purpose of mapping (e.g., protocolling); defaults to 0 (none) 97cdf0e10cSrcweir */ 98cdf0e10cSrcweir void SAL_CALL uno_getMapping( 99cdf0e10cSrcweir struct _uno_Mapping ** ppMapping, 100cdf0e10cSrcweir struct _uno_Environment * pFrom, 101cdf0e10cSrcweir struct _uno_Environment * pTo, 102cdf0e10cSrcweir rtl_uString * pAddPurpose ) 103cdf0e10cSrcweir SAL_THROW_EXTERN_C(); 104cdf0e10cSrcweir 105cdf0e10cSrcweir /** Callback function pointer declaration to get a mapping. 106cdf0e10cSrcweir 107cdf0e10cSrcweir @param ppMapping inout mapping 108cdf0e10cSrcweir @param pFrom source environment 109cdf0e10cSrcweir @param pTo destination environment 110cdf0e10cSrcweir @param pAddPurpose additional purpose 111cdf0e10cSrcweir */ 112cdf0e10cSrcweir typedef void (SAL_CALL * uno_getMappingFunc)( 113cdf0e10cSrcweir struct _uno_Mapping ** ppMapping, 114cdf0e10cSrcweir struct _uno_Environment * pFrom, 115cdf0e10cSrcweir struct _uno_Environment * pTo, 116cdf0e10cSrcweir rtl_uString * pAddPurpose ); 117cdf0e10cSrcweir 118cdf0e10cSrcweir /** Registers a callback being called each time a mapping is demanded. 119cdf0e10cSrcweir 120cdf0e10cSrcweir @param pCallback callback function 121cdf0e10cSrcweir */ 122cdf0e10cSrcweir void SAL_CALL uno_registerMappingCallback( 123cdf0e10cSrcweir uno_getMappingFunc pCallback ) 124cdf0e10cSrcweir SAL_THROW_EXTERN_C(); 125cdf0e10cSrcweir 126cdf0e10cSrcweir /** Revokes a mapping callback registration. 127cdf0e10cSrcweir 128cdf0e10cSrcweir @param pCallback callback function 129cdf0e10cSrcweir */ 130cdf0e10cSrcweir void SAL_CALL uno_revokeMappingCallback( 131cdf0e10cSrcweir uno_getMappingFunc pCallback ) 132cdf0e10cSrcweir SAL_THROW_EXTERN_C(); 133cdf0e10cSrcweir 134cdf0e10cSrcweir /** Function pointer declaration to free a mapping. 135cdf0e10cSrcweir 136cdf0e10cSrcweir @param pMapping mapping to be freed 137cdf0e10cSrcweir */ 138cdf0e10cSrcweir typedef void (SAL_CALL * uno_freeMappingFunc)( struct _uno_Mapping * pMapping ); 139cdf0e10cSrcweir 140cdf0e10cSrcweir /** Registers a mapping. A mapping registers itself on first acquire and revokes itself on last 141cdf0e10cSrcweir release. The given freeMapping function is called by the runtime to cleanup any resources. 142cdf0e10cSrcweir 143cdf0e10cSrcweir @param ppMapping inout mapping to be registered 144cdf0e10cSrcweir @param freeMapping called by runtime to delete mapping 145cdf0e10cSrcweir @param pFrom source environment 146cdf0e10cSrcweir @param pTo destination environment 147cdf0e10cSrcweir @param pAddPurpose additional purpose string; defaults to 0 148cdf0e10cSrcweir */ 149cdf0e10cSrcweir void SAL_CALL uno_registerMapping( 150cdf0e10cSrcweir struct _uno_Mapping ** ppMapping, uno_freeMappingFunc freeMapping, 151cdf0e10cSrcweir struct _uno_Environment * pFrom, struct _uno_Environment * pTo, rtl_uString * pAddPurpose ) 152cdf0e10cSrcweir SAL_THROW_EXTERN_C(); 153cdf0e10cSrcweir 154cdf0e10cSrcweir /** Revokes a mapping. A mapping registers itself on first acquire and revokes itself on last 155cdf0e10cSrcweir release. 156cdf0e10cSrcweir 157cdf0e10cSrcweir @param pMapping mapping to be revoked 158cdf0e10cSrcweir */ 159cdf0e10cSrcweir void SAL_CALL uno_revokeMapping( 160cdf0e10cSrcweir struct _uno_Mapping * pMapping ) 161cdf0e10cSrcweir SAL_THROW_EXTERN_C(); 162cdf0e10cSrcweir 163cdf0e10cSrcweir /** Gets an interface mapping from one language environment to another by corresponding environment 164cdf0e10cSrcweir type names. 165cdf0e10cSrcweir 166cdf0e10cSrcweir @param ppMapping [inout] mapping; existing mapping will be released 167cdf0e10cSrcweir @param pFrom source environment type name 168cdf0e10cSrcweir @param pTo destination environment type name 169cdf0e10cSrcweir (interfaces resulting in mapInterface() call can be used 170cdf0e10cSrcweir in this language environment) 171cdf0e10cSrcweir @param pAddPurpose additional purpose of mapping (e.g., protocolling); defaults to 0 (none) 172cdf0e10cSrcweir */ 173cdf0e10cSrcweir void SAL_CALL uno_getMappingByName( 174cdf0e10cSrcweir struct _uno_Mapping ** ppMapping, 175cdf0e10cSrcweir rtl_uString * pFrom, 176cdf0e10cSrcweir rtl_uString * pTo, 177cdf0e10cSrcweir rtl_uString * pAddPurpose ) 178cdf0e10cSrcweir SAL_THROW_EXTERN_C(); 179cdf0e10cSrcweir 180cdf0e10cSrcweir /* symbol exported by each language binding library */ 181cdf0e10cSrcweir #define UNO_EXT_GETMAPPING "uno_ext_getMapping" 182cdf0e10cSrcweir 183cdf0e10cSrcweir /** Function pointer declaration to get a mapping from a loaded bridge. Bridges export a function 184cdf0e10cSrcweir called uno_ext_getMapping() of this signature. 185cdf0e10cSrcweir 186cdf0e10cSrcweir @param ppMapping [inout] mapping; existing mapping will be released 187cdf0e10cSrcweir @pFrom source environment 188cdf0e10cSrcweir @pTo destination environment 189cdf0e10cSrcweir */ 190cdf0e10cSrcweir typedef void (SAL_CALL * uno_ext_getMappingFunc)( 191cdf0e10cSrcweir struct _uno_Mapping ** ppMapping, 192cdf0e10cSrcweir struct _uno_Environment * pFrom, 193cdf0e10cSrcweir struct _uno_Environment * pTo ); 194cdf0e10cSrcweir 195cdf0e10cSrcweir #ifdef __cplusplus 196cdf0e10cSrcweir } 197cdf0e10cSrcweir #endif 198cdf0e10cSrcweir 199cdf0e10cSrcweir #endif 200