Initial import of the CDE 2.1.30 sources from the Open Group.
This commit is contained in:
214
cde/lib/tt/lib/Imakefile
Normal file
214
cde/lib/tt/lib/Imakefile
Normal file
@@ -0,0 +1,214 @@
|
||||
XCOMM $TOG: Imakefile /main/14 1999/08/30 10:49:21 mgreess $
|
||||
#define DoNormalLib NormalLibTt
|
||||
#define DoSharedLib SharedLibTt
|
||||
#define DoDebugLib DebugLibTt
|
||||
#define DoProfileLib ProfileLibTt
|
||||
#define LibName tt
|
||||
#define SoRev SOTTREV
|
||||
#define LibHeaders NO
|
||||
|
||||
XCOMM Currently libtt is just barely too large to compile with small
|
||||
XCOMM PIC tables on Solaris. Other platforms (e.g. HP/UX) seem to do
|
||||
XCOMM fine. Rather than enable LargePICTable everywhere it is only
|
||||
XCOMM set in tttk/Imakefile and api/c/Imakefile. If we need to compile
|
||||
XCOMM more modules with large PIC tables it should be set in other
|
||||
XCOMM subdirectories too.
|
||||
|
||||
#define CplusplusSource YES
|
||||
|
||||
#include <Threads.tmpl>
|
||||
|
||||
#define IHaveSubdirs
|
||||
#define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)' 'CXXDEBUGFLAGS=$(CXXDEBUGFLAGS)'
|
||||
|
||||
SUBDIRS = api db mp util tttk
|
||||
EXTRALIBRARYDEPS = api/DONE db/DONE mp/DONE util/DONE tttk/DONE
|
||||
|
||||
MakeSubdirs($(SUBDIRS))
|
||||
ForceSubdirs($(SUBDIRS))
|
||||
DependSubdirs($(SUBDIRS))
|
||||
|
||||
#include "../tooltalk.tmpl"
|
||||
|
||||
DEFINES =
|
||||
INCLUDES = -I.
|
||||
|
||||
#ifdef RsArchitecture
|
||||
REALPATHC = realpath.c
|
||||
REALPATHO = realpath.o
|
||||
#endif
|
||||
|
||||
#ifdef AlphaArchitecture
|
||||
REALPATHC = realpath.c
|
||||
REALPATHO = realpath.o
|
||||
#endif
|
||||
|
||||
#ifdef SharedTtReqs
|
||||
#ifdef SunArchitecture
|
||||
REQUIREDLIBS = SharedTtReqs -L/opt/SUNWspro/SC4.0/lib -Bstatic -lC
|
||||
SHLIBLDFLAGS = -G
|
||||
#else
|
||||
REQUIREDLIBS = SharedTtReqs
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* You do not need to list sources except where .o's are actually made */
|
||||
SRCS = $(REALPATHC)
|
||||
|
||||
OBJS_1 = \
|
||||
api/c/api_api.o \
|
||||
api/c/api_auth.o \
|
||||
api/c/api_default.o \
|
||||
api/c/api_error.o \
|
||||
api/c/api_file.o \
|
||||
api/c/api_filemap.o \
|
||||
api/c/api_handle.o \
|
||||
api/c/api_message.o \
|
||||
api/c/api_mp.o \
|
||||
api/c/api_mp_io.o \
|
||||
api/c/api_mp_otype.o \
|
||||
api/c/api_objid_spec.o \
|
||||
api/c/api_pattern.o \
|
||||
api/c/api_session_prop.o \
|
||||
api/c/api_spec.o \
|
||||
api/c/api_spec_map_ref.o \
|
||||
api/c/api_storage.o \
|
||||
api/c/api_typecb.o \
|
||||
api/c/api_typecb_utils.o \
|
||||
api/c/api_utils.o \
|
||||
api/c/api_xdr.o \
|
||||
api/dnd/ttdnd.o \
|
||||
db/db_server_clnt.o \
|
||||
db/db_server_xdr.o \
|
||||
db/old_db_server_functions.o \
|
||||
db/tt_client_isam_file.o \
|
||||
db/tt_client_isam_file_utils.o \
|
||||
db/tt_client_isam_key_descriptor.o \
|
||||
db/tt_client_isam_key_descriptor_utils.o \
|
||||
db/tt_client_isam_record.o \
|
||||
db/tt_client_isam_record_utils.o \
|
||||
db/tt_db_access_utils.o \
|
||||
db/tt_db_client.o \
|
||||
db/tt_db_client_utils.o \
|
||||
db/tt_db_create_objid.o \
|
||||
db/tt_db_file.o \
|
||||
db/tt_db_file_utils.o \
|
||||
db/tt_db_hostname_global_map_ref.o \
|
||||
db/tt_db_hostname_redirection_map.o \
|
||||
db/tt_db_key.o \
|
||||
db/tt_db_key_utils.o \
|
||||
db/tt_db_network_path.o \
|
||||
db/tt_db_object.o \
|
||||
db/tt_db_object_utils.o \
|
||||
db/tt_db_objid_to_key.o \
|
||||
db/tt_db_property.o \
|
||||
db/tt_db_property_utils.o \
|
||||
db/tt_db_rpc_message_routines.o \
|
||||
db/tt_db_rpc_routines.o \
|
||||
db/tt_old_db.o \
|
||||
db/tt_old_db_message_info.o \
|
||||
db/tt_old_db_message_info_utils.o \
|
||||
db/tt_old_db_partition_map_ref.o \
|
||||
db/tt_old_db_utils.o
|
||||
|
||||
OBJS_2 = \
|
||||
mp/mp_arg.o \
|
||||
mp/mp_arg_utils.o \
|
||||
mp/mp_auth.o \
|
||||
mp/mp_auth_functions.o \
|
||||
mp/mp_c_file.o \
|
||||
mp/mp_c_file_utils.o \
|
||||
mp/mp_c_message.o \
|
||||
mp/mp_c_message_utils.o \
|
||||
mp/mp_c_mp.o \
|
||||
mp/mp_c_msg_context.o \
|
||||
mp/mp_c_msg_context_utils.o \
|
||||
mp/mp_c_pattern.o \
|
||||
mp/mp_c_procid.o \
|
||||
mp/mp_c_procid_utils.o \
|
||||
mp/mp_c_session.o \
|
||||
mp/mp_c_session_prop.o \
|
||||
mp/mp_c_session_utils.o \
|
||||
mp/mp_context.o \
|
||||
mp/mp_context_utils.o \
|
||||
mp/mp_desktop.o \
|
||||
mp/mp_desktop_utils.o \
|
||||
mp/mp_file.o \
|
||||
mp/mp_file_utils.o \
|
||||
mp/mp_message.o \
|
||||
mp/mp_message_utils.o \
|
||||
mp/mp_mp.o \
|
||||
mp/mp_mp_utils.o \
|
||||
mp/mp_msg_context.o \
|
||||
mp/mp_msg_context_utils.o \
|
||||
mp/mp_pat_context.o \
|
||||
mp/mp_pat_context_utils.o \
|
||||
mp/mp_pattern.o \
|
||||
mp/mp_pattern_utils.o \
|
||||
mp/mp_procid.o \
|
||||
mp/mp_procid_utils.o \
|
||||
mp/mp_rpc_client.o \
|
||||
mp/mp_rpc_client_utils.o \
|
||||
mp/mp_rpc_fns.o \
|
||||
mp/mp_session.o \
|
||||
mp/mp_session_prop.o \
|
||||
mp/mp_session_prop_utils.o \
|
||||
mp/mp_session_utils.o \
|
||||
mp/mp_stream_socket.o \
|
||||
mp/mp_stream_socket_utils.o \
|
||||
mp/mp_trace.o \
|
||||
mp/mp_xdr_functions.o \
|
||||
tttk/ttdesktop.o \
|
||||
tttk/ttdtfile.o \
|
||||
tttk/ttdtprocid.o \
|
||||
tttk/ttmedia.o \
|
||||
tttk/tttk.o \
|
||||
tttk/tttk2free.o \
|
||||
tttk/tttkmessage.o \
|
||||
tttk/tttkpattern.o \
|
||||
tttk/tttkutils.o
|
||||
|
||||
OBJS_3 = \
|
||||
util/copyright.o \
|
||||
util/tt_Xlib.o \
|
||||
util/tt_audit.o \
|
||||
util/tt_base64.o \
|
||||
util/tt_enumname.o \
|
||||
util/tt_entry_pt.o \
|
||||
util/tt_file_system.o \
|
||||
util/tt_file_system_entry_utils.o \
|
||||
util/tt_gettext.o \
|
||||
util/tt_global_env.o \
|
||||
util/tt_host.o \
|
||||
util/tt_host_equiv.o \
|
||||
util/tt_host_equiv_utils.o \
|
||||
util/tt_host_utils.o \
|
||||
util/tt_int_rec.o \
|
||||
util/tt_iostream.o \
|
||||
util/tt_ldpath.o \
|
||||
util/tt_log.o \
|
||||
util/tt_map_entry.o \
|
||||
util/tt_map_entry_utils.o \
|
||||
util/tt_new.o \
|
||||
util/tt_new_ptr.o \
|
||||
util/tt_object.o \
|
||||
util/tt_object_list.o \
|
||||
util/tt_object_table.o \
|
||||
util/tt_path.o \
|
||||
util/tt_port.o \
|
||||
util/tt_string.o \
|
||||
util/tt_string_map.o \
|
||||
util/tt_string_map_utils.o \
|
||||
util/tt_string_match.o \
|
||||
util/tt_threadspecific.o \
|
||||
util/tt_trace.o \
|
||||
util/tt_trace_parser.o \
|
||||
util/tt_tracefile_parse.o \
|
||||
util/tt_trace_stream.o \
|
||||
util/tt_xdr_utils.o $(REALPATHO)
|
||||
|
||||
OBJS = $(OBJS_1) $(OBJS_2) $(OBJS_3)
|
||||
|
||||
#include <Library.tmpl>
|
||||
|
||||
DependTarget()
|
||||
543
cde/lib/tt/lib/Mapfile-measured
Normal file
543
cde/lib/tt/lib/Mapfile-measured
Normal file
@@ -0,0 +1,543 @@
|
||||
# %% (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
# %% (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
# %% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
# %% (c) Copyright 1993, 1994 Novell, Inc.
|
||||
# %% $XConsortium: Mapfile-measured /main/3 1995/10/23 09:48:46 rswiston $
|
||||
text : .text%__nw__13_Tt_allocatedSFUi : Derived-O/tt_new.o;
|
||||
text : .text%__ct__18_Tt_string_buf_ptrFv : Derived-O/tt_string.o;
|
||||
text : .text%__ct__14_Tt_object_ptrFv : Derived-O/tt_object_list.o;
|
||||
text : .text%__ct__11_Tt_new_ptrFv : Derived-O/tt_new_ptr.o;
|
||||
text : .text%__as__11_Tt_new_ptrFP10_Tt_object : Derived-O/tt_new_ptr.o;
|
||||
text : .text%__as__10_Tt_stringFPCc : Derived-O/tt_string.o;
|
||||
text : .text%__ct__10_Tt_stringFPCc : Derived-O/tt_string.o;
|
||||
text : .text%__as__11_Tt_new_ptrFRC11_Tt_new_ptr : Derived-O/tt_new_ptr.o;
|
||||
text : .text%__dt__14_Tt_string_bufFv : Derived-O/tt_string.o;
|
||||
text : .text%__dt__10_Tt_objectFv : Derived-O/tt_object.o;
|
||||
text : .text%__dl__13_Tt_allocatedSFPv : Derived-O/tt_new.o;
|
||||
text : .text%__dt__10_Tt_stringFv : Derived-O/tt_string.o;
|
||||
text : .text%__dt__18_Tt_string_buf_ptrFv : Derived-O/tt_string.o;
|
||||
text : .text%__dt__14_Tt_object_ptrFv : Derived-O/tt_object_list.o;
|
||||
text : .text%__dt__11_Tt_new_ptrFv : Derived-O/tt_new_ptr.o;
|
||||
text : .text%__ct__19_Tt_object_list_ptrFv : Derived-O/tt_object_list.o;
|
||||
text : .text%__ct__10_Tt_stringFRC10_Tt_string : Derived-O/tt_string.o;
|
||||
text : .text%__ct__11_Tt_new_ptrFRC11_Tt_new_ptr : Derived-O/tt_new_ptr.o;
|
||||
text : .text%__dt__12_Tt_host_ptrFv : Derived-O/tt_host_utils.o;
|
||||
text : .text%__dt__20_Tt_message_list_ptrFv : Derived-O/mp_message_utils.o;
|
||||
text : .text%__dt__19_Tt_object_list_ptrFv : Derived-O/tt_object_list.o;
|
||||
text : .text%maxfds__10_Tt_globalFv : Derived-O/tt_global_env.o;
|
||||
text : .text%__ct__11_Tt_new_ptrFP10_Tt_object : Derived-O/tt_new_ptr.o;
|
||||
text : .text%lookup__16_Tt_object_tableCFRC10_Tt_stringR14_Tt_object_ptr : Derived-O/tt_object_table.o;
|
||||
text : .text%hash__10_Tt_stringCFi : Derived-O/tt_string.o;
|
||||
text : .text%__ct__22_Tt_object_list_cursorFRC19_Tt_object_list_ptr : Derived-O/tt_object_list.o;
|
||||
text : .text%next__22_Tt_object_list_cursorFv : Derived-O/tt_object_list.o;
|
||||
text : .text%__ml__22_Tt_object_list_cursorCFv : Derived-O/tt_object_list.o;
|
||||
text : .text%__dt__22_Tt_object_list_cursorFv : Derived-O/tt_object_list.o;
|
||||
text : .text%__ct__22_Tt_object_list_cursorFv : Derived-O/tt_object_list.o;
|
||||
text : .text%reset__22_Tt_object_list_cursorFRC19_Tt_object_list_ptr : Derived-O/tt_object_list.o;
|
||||
text : .text%__dt__23_Tt_int_rec_list_cursorFv : Derived-O/tt_int_rec.o;
|
||||
text : .text%id__10_Tt_procidFv : Derived-O/mp_procid.o;
|
||||
text : .text%_tt_procid_id__FR14_Tt_object_ptr : Derived-O/mp_procid.o;
|
||||
text : .text%__dt__14_Tt_procid_ptrFv : Derived-O/mp_procid_utils.o;
|
||||
text : .text%__ct__22_Tt_string_list_cursorFRC19_Tt_string_list_ptr : Derived-O/tt_string.o;
|
||||
text : .text%__ml__22_Tt_string_list_cursorCFv : Derived-O/tt_string.o;
|
||||
text : .text%__dt__22_Tt_string_list_cursorFv : Derived-O/tt_string.o;
|
||||
text : .text%__dt__26_Tt_string_buf_list_cursorFv : Derived-O/tt_string.o;
|
||||
text : .text%__dt__10_Tt_procidFv : Derived-O/mp_procid.o;
|
||||
text : .text%__dt__21_Tt_stream_socket_ptrFv : Derived-O/mp_stream_socket_utils.o;
|
||||
text : .text%__dt__20_Tt_pattern_list_ptrFv : Derived-O/mp_pattern_utils.o;
|
||||
text : .text%__dt__19_Tt_string_list_ptrFv : Derived-O/tt_string.o;
|
||||
text : .text%__dt__23_Tt_string_buf_list_ptrFv : Derived-O/tt_string.o;
|
||||
text : .text%__dt__15_Tt_message_ptrFv : Derived-O/mp_message_utils.o;
|
||||
text : .text%__dt__15_Tt_session_ptrFv : Derived-O/mp_session_utils.o;
|
||||
text : .text%__ct__15_Tt_patlist_ptrFv : Derived-O/mp_pattern_utils.o;
|
||||
text : .text%_tt_patlist_op__FR14_Tt_object_ptr : Derived-O/mp_pattern_utils.o;
|
||||
text : .text%__dt__15_Tt_patlist_ptrFv : Derived-O/mp_pattern_utils.o;
|
||||
text : .text%id__11_Tt_patternFv : Derived-O/mp_pattern.o;
|
||||
text : .text%__dt__11_Tt_arg_ptrFv : Derived-O/mp_arg_utils.o;
|
||||
text : .text%cmp__10_Tt_stringCFPCci : Derived-O/tt_string.o;
|
||||
text : .text%__dt__16_Tt_arg_list_ptrFv : Derived-O/mp_arg_utils.o;
|
||||
text : .text%__dt__23_Tt_object_list_elementFv : Derived-O/tt_object_list.o;
|
||||
text : .text%__dt__15_Tt_object_listFv : Derived-O/tt_object_list.o;
|
||||
text : .text%remove__22_Tt_object_list_cursorFv : Derived-O/tt_object_list.o;
|
||||
text : .text%__dt__20_Tt_context_list_ptrFv : Derived-O/mp_context_utils.o;
|
||||
text : .text%__dt__16_Tt_context_listFv : Derived-O/mp_context_utils.o;
|
||||
text : .text%__dt__12_Tt_arg_listFv : Derived-O/mp_arg_utils.o;
|
||||
text : .text%__dt__23_Tt_message_list_cursorFv : Derived-O/mp_message_utils.o;
|
||||
text : .text%__dt__23_Tt_pattern_list_cursorFv : Derived-O/mp_pattern_utils.o;
|
||||
text : .text%lookup__16_Tt_object_tableCFRC10_Tt_string : Derived-O/tt_object_table.o;
|
||||
text : .text%__ct__10_Tt_stringFv : Derived-O/tt_string.o;
|
||||
text : .text%__ct__12_Tt_host_ptrFv : Derived-O/tt_host_utils.o;
|
||||
text : .text%__ct__15_Tt_session_ptrFv : Derived-O/mp_session_utils.o;
|
||||
text : .text%__ct__20_Tt_pattern_list_ptrFv : Derived-O/mp_pattern_utils.o;
|
||||
text : .text%__ct__15_Tt_message_ptrFv : Derived-O/mp_message_utils.o;
|
||||
text : .text%__ct__20_Tt_int_rec_list_ptrFv : Derived-O/tt_int_rec.o;
|
||||
text : .text%__ct__19_Tt_string_list_ptrFv : Derived-O/tt_string.o;
|
||||
text : .text%__ct__23_Tt_string_buf_list_ptrFv : Derived-O/tt_string.o;
|
||||
text : .text%__ct__14_Tt_procid_ptrFv : Derived-O/mp_procid_utils.o;
|
||||
text : .text%__ct__20_Tt_message_list_ptrFv : Derived-O/mp_message_utils.o;
|
||||
text : .text%__ct__16_Tt_int_rec_listFv : Derived-O/tt_int_rec.o;
|
||||
text : .text%__ct__15_Tt_object_listFv : Derived-O/tt_object_list.o;
|
||||
text : .text%__ct__15_Tt_string_listFv : Derived-O/tt_string.o;
|
||||
text : .text%__ct__19_Tt_string_buf_listFv : Derived-O/tt_string.o;
|
||||
text : .text%__as__19_Tt_string_list_ptrFP15_Tt_string_list : Derived-O/tt_string.o;
|
||||
text : .text%__ct__16_Tt_pattern_listFv : Derived-O/mp_pattern_utils.o;
|
||||
text : .text%__ct__16_Tt_arg_list_ptrFv : Derived-O/mp_arg_utils.o;
|
||||
text : .text%__ct__20_Tt_context_list_ptrFv : Derived-O/mp_context_utils.o;
|
||||
text : .text%__ct__12_Tt_arg_listFv : Derived-O/mp_arg_utils.o;
|
||||
text : .text%__ct__16_Tt_context_listFv : Derived-O/mp_context_utils.o;
|
||||
text : .text%cat__10_Tt_stringCFRC10_Tt_string : Derived-O/tt_string.o;
|
||||
text : .text%__ct__10_Tt_stringFi : Derived-O/tt_string.o;
|
||||
text : .text%__opPc__10_Tt_stringCFv : Derived-O/tt_string.o;
|
||||
text : .text%push__15_Tt_object_listFRC14_Tt_object_ptr : Derived-O/tt_object_list.o;
|
||||
text : .text%__ct__23_Tt_object_list_elementFv : Derived-O/tt_object_list.o;
|
||||
text : .text%xdr_version__10_Tt_globalFv : Derived-O/tt_global_env.o;
|
||||
text : .text%set_xdr_version__10_Tt_globalFi : Derived-O/tt_global_env.o;
|
||||
text : .text%xdr__11_Tt_new_ptrFP3XDRPFP3XDRP10_Tt_object_iPFv_P10_Tt_object : Derived-O/tt_new_ptr.o;
|
||||
text : .text%xdr__10_Tt_stringFP3XDR : Derived-O/tt_string.o;
|
||||
text : .text%xdr__14_Tt_string_bufFP3XDR : Derived-O/tt_string.o;
|
||||
text : .text%xdr__15_Tt_object_listFP3XDRPFP3XDRP10_Tt_object_iPFv_P10_Tt_object : Derived-O/tt_object_list.o;
|
||||
text : .text%flush__15_Tt_object_listFv : Derived-O/tt_object_list.o;
|
||||
text : .text%append__15_Tt_object_listFRC14_Tt_object_ptr : Derived-O/tt_object_list.o;
|
||||
text : .text%insert__16_Tt_object_tableFR14_Tt_object_ptr : Derived-O/tt_object_table.o;
|
||||
text : .text%xdr__16_Tt_arg_list_ptrFP3XDR : Derived-O/mp_arg_utils.o;
|
||||
text : .text%_Tt_arg_list_xdr__FP3XDRP10_Tt_object : Derived-O/mp_arg_utils.o;
|
||||
text : .text%xdr__12_Tt_arg_listFP3XDR : Derived-O/mp_arg_utils.o;
|
||||
text : .text%_Tt_arg_maker__Fv : Derived-O/mp_arg_utils.o;
|
||||
text : .text%__ct__7_Tt_argFv : Derived-O/mp_arg.o;
|
||||
text : .text%constructor_common__7_Tt_argFv : Derived-O/mp_arg.o;
|
||||
text : .text%_Tt_arg_xdr__FP3XDRP10_Tt_object : Derived-O/mp_arg_utils.o;
|
||||
text : .text%xdr__7_Tt_argFP3XDR : Derived-O/mp_arg.o;
|
||||
text : .text%xdr__23_Tt_string_buf_list_ptrFP3XDR : Derived-O/tt_string.o;
|
||||
text : .text%_Tt_string_buf_list_xdr__FP3XDRP10_Tt_object : Derived-O/tt_string.o;
|
||||
text : .text%xdr__19_Tt_string_buf_listFP3XDR : Derived-O/tt_string.o;
|
||||
text : .text%__dt__16_Tt_message_listFv : Derived-O/mp_message_utils.o;
|
||||
text : .text%__dt__7_Tt_argFv : Derived-O/mp_arg.o;
|
||||
text : .text%__dt__11_Tt_messageFv : Derived-O/mp_message.o;
|
||||
text : .text%__dt__24_Tt_msg_context_list_ptrFv : Derived-O/mp_msg_context_utils.o;
|
||||
text : .text%__dt__20_Tt_msg_context_listFv : Derived-O/mp_msg_context_utils.o;
|
||||
text : .text%__dt__19_Tt_procid_list_ptrFv : Derived-O/mp_procid_utils.o;
|
||||
text : .text%remove__16_Tt_object_tableFRC10_Tt_string : Derived-O/tt_object_table.o;
|
||||
text : .text%__dt__11_Tt_patternFv : Derived-O/mp_pattern.o;
|
||||
text : .text%__dt__15_Tt_string_listFv : Derived-O/tt_string.o;
|
||||
text : .text%__dt__19_Tt_string_buf_listFv : Derived-O/tt_string.o;
|
||||
text : .text%__dt__24_Tt_pat_context_list_ptrFv : Derived-O/mp_pat_context_utils.o;
|
||||
text : .text%__dt__20_Tt_pat_context_listFv : Derived-O/mp_pat_context_utils.o;
|
||||
text : .text%__dt__20_Tt_int_rec_list_ptrFv : Derived-O/tt_int_rec.o;
|
||||
text : .text%__dt__16_Tt_int_rec_listFv : Derived-O/tt_int_rec.o;
|
||||
text : .text%tt_default_procid : Derived-O/api_default.o;
|
||||
text : .text%_tt_default_procid__Fv : Derived-O/api_default.o;
|
||||
text : .text%__ct__15_Tt_pattern_ptrFv : Derived-O/mp_pattern_utils.o;
|
||||
text : .text%call__11_Tt_sessionFiPFv_iPcT2T3N21 : Derived-O/mp_session.o;
|
||||
text : .text%call__14_Tt_rpc_clientFiPFv_iPcT2T3T1 : Derived-O/mp_rpc_client.o;
|
||||
text : .text%_tt_svc_getargs : Derived-O/mp_rpc_fns.o;
|
||||
text : .text%process_tree_id__11_Tt_sessionFv : Derived-O/mp_session.o;
|
||||
text : .text%tt_xdr_string__FP3XDRP10_Tt_string : Derived-O/tt_string.o;
|
||||
text : .text%xdr_2__14_Tt_string_bufFP3XDR : Derived-O/tt_string.o;
|
||||
text : .text%_tt_session_id__FR14_Tt_object_ptr : Derived-O/mp_session.o;
|
||||
text : .text%id__11_Tt_sessionFv : Derived-O/mp_session.o;
|
||||
text : .text%__ct__10_Tt_procidFv : Derived-O/mp_procid.o;
|
||||
text : .text%__ct__21_Tt_stream_socket_ptrFv : Derived-O/mp_stream_socket_utils.o;
|
||||
text : .text%xdr__14_Tt_procid_ptrFP3XDR : Derived-O/mp_procid_utils.o;
|
||||
text : .text%_Tt_procid_xdr__FP3XDRP10_Tt_object : Derived-O/mp_procid_utils.o;
|
||||
text : .text%xdr__10_Tt_procidFP3XDR : Derived-O/mp_procid.o;
|
||||
text : .text%_Tt_procid_maker__Fv : Derived-O/mp_procid_utils.o;
|
||||
text : .text%default_procid__8_Tt_c_mpFv : Derived-O/mp_c_mp.o;
|
||||
text : .text%_tt_strdup__FRC10_Tt_string : Derived-O/api_api.o;
|
||||
text : .text%_tt_strdup__FPCc : Derived-O/api_api.o;
|
||||
text : .text%malloc__17_Tt_api_stg_stackFUi : Derived-O/api_storage.o;
|
||||
text : .text%__dt__25_Tt_api_stg_stack_elm_ptrFv : Derived-O/api_utils.o;
|
||||
text : .text%tt_pointer_error : Derived-O/tt_c.o;
|
||||
text : .text%_tt_pointer_error__FPv : Derived-O/api_api.o;
|
||||
text : .text%tt_message_receive : Derived-O/api_message.o;
|
||||
text : .text%__ct__17_Tt_c_message_ptrFv : Derived-O/mp_c_message_utils.o;
|
||||
text : .text%next_message__12_Tt_c_procidFR15_Tt_message_ptr : Derived-O/mp_c_procid.o;
|
||||
text : .text%tt_xdr_procid__FP3XDRP14_Tt_procid_ptr : Derived-O/mp_procid.o;
|
||||
text : .text%tt_xdr_next_message_args__FP3XDRP21_Tt_next_message_args : Derived-O/mp_xdr_functions.o;
|
||||
text : .text%xdr__20_Tt_message_list_ptrFP3XDR : Derived-O/mp_message_utils.o;
|
||||
text : .text%__dt__17_Tt_c_message_ptrFv : Derived-O/mp_c_message_utils.o;
|
||||
text : .text%lookup_msg__20_Tt_api_handle_tableFP18_Tt_message_handle : Derived-O/api_handle.o;
|
||||
text : .text%tt_pattern_create : Derived-O/api_pattern.o;
|
||||
text : .text%__ct__11_Tt_patternFv : Derived-O/mp_c_pattern.o;
|
||||
text : .text%__ct__24_Tt_pat_context_list_ptrFv : Derived-O/mp_pat_context_utils.o;
|
||||
text : .text%set_id__11_Tt_patternFR10_Tt_string : Derived-O/mp_c_pattern.o;
|
||||
text : .text%generate_pattern_id__6_Tt_mpFv : Derived-O/mp_mp.o;
|
||||
text : .text%base_constructor__11_Tt_patternFv : Derived-O/mp_pattern.o;
|
||||
text : .text%__ct__20_Tt_pat_context_listFv : Derived-O/mp_pat_context_utils.o;
|
||||
text : .text%lookup_phandle__20_Tt_api_handle_tableF15_Tt_pattern_ptr : Derived-O/api_handle.o;
|
||||
text : .text%__ct__14_Tt_api_handleFv : Derived-O/api_handle.o;
|
||||
text : .text%__ct__25_Tt_api_userdata_list_ptrFv : Derived-O/api_utils.o;
|
||||
text : .text%__ct__25_Tt_api_callback_list_ptrFv : Derived-O/api_utils.o;
|
||||
text : .text%__ct__21_Tt_api_userdata_listFv : Derived-O/api_utils.o;
|
||||
text : .text%__ct__21_Tt_api_callback_listFv : Derived-O/api_utils.o;
|
||||
text : .text%ptr_set__14_Tt_api_handleF15_Tt_pattern_ptr : Derived-O/api_handle.o;
|
||||
text : .text%__dt__15_Tt_pattern_ptrFv : Derived-O/mp_pattern_utils.o;
|
||||
text : .text%__dt__18_Tt_api_handle_ptrFv : Derived-O/api_utils.o;
|
||||
text : .text%__dt__26_Tt_api_handle_list_cursorFv : Derived-O/api_utils.o;
|
||||
text : .text%tt_pattern_scope_add : Derived-O/api_pattern.o;
|
||||
text : .text%lookup_pat__20_Tt_api_handle_tableFP18_Tt_pattern_handle : Derived-O/api_handle.o;
|
||||
text : .text%pptr__14_Tt_api_handleFv : Derived-O/api_handle.o;
|
||||
text : .text%tt_default_session : Derived-O/api_default.o;
|
||||
text : .text%_tt_default_session__Fv : Derived-O/api_default.o;
|
||||
text : .text%tt_pattern_session_add : Derived-O/api_pattern.o;
|
||||
text : .text%_prepend_P_to_sessid__FPCcR10_Tt_string : Derived-O/api_api.o;
|
||||
text : .text%find_session__6_Tt_mpF10_Tt_stringR15_Tt_session_ptriT3 : Derived-O/mp_mp.o;
|
||||
text : .text%add_field__11_Tt_patternFRC10_Tt_stringR19_Tt_string_list_ptr : Derived-O/mp_pattern.o;
|
||||
text : .text%tt_pattern_category_set : Derived-O/api_pattern.o;
|
||||
text : .text%tt_pattern_op_add : Derived-O/api_pattern.o;
|
||||
text : .text%tt_pattern_register : Derived-O/api_pattern.o;
|
||||
text : .text%commit__12_Tt_c_procidFv : Derived-O/mp_c_procid.o;
|
||||
text : .text%default_c_procid__8_Tt_c_mpFv : Derived-O/mp_c_mp.o;
|
||||
text : .text%add_pattern__12_Tt_c_procidFR15_Tt_pattern_ptr : Derived-O/mp_c_procid.o;
|
||||
text : .text%contextsCount__11_Tt_patternCFv : Derived-O/mp_pattern.o;
|
||||
text : .text%tt_xdr_add_pattern_args__FP3XDRP20_Tt_add_pattern_args : Derived-O/mp_xdr_functions.o;
|
||||
text : .text%xdr__15_Tt_pattern_ptrFP3XDR : Derived-O/mp_pattern_utils.o;
|
||||
text : .text%_Tt_pattern_xdr__FP3XDRP10_Tt_object : Derived-O/mp_pattern_utils.o;
|
||||
text : .text%xdr__11_Tt_patternFP3XDR : Derived-O/mp_pattern.o;
|
||||
text : .text%_Tt_string_buf_xdr__FP3XDRP10_Tt_object : Derived-O/tt_string.o;
|
||||
text : .text%xdr__20_Tt_int_rec_list_ptrFP3XDR : Derived-O/tt_int_rec.o;
|
||||
text : .text%_Tt_int_rec_list_xdr__FP3XDRP10_Tt_object : Derived-O/tt_int_rec.o;
|
||||
text : .text%xdr__16_Tt_int_rec_listFP3XDR : Derived-O/tt_int_rec.o;
|
||||
text : .text%_Tt_string_buf_maker__Fv : Derived-O/tt_string.o;
|
||||
text : .text%join_files__11_Tt_patternCFRC10_Tt_string : Derived-O/mp_c_pattern.o;
|
||||
text : .text%__ct__11_Tt_arg_ptrFv : Derived-O/mp_arg_utils.o;
|
||||
text : .text%__ct__7_Tt_argF7tt_modePCc : Derived-O/mp_arg.o;
|
||||
text : .text%add_callback__14_Tt_api_handleFPFP18_Tt_message_handleP18_Tt_pattern_handle_18tt_callback_action : Derived-O/api_handle.o;
|
||||
text : .text%__ct__16_Tt_api_callbackFv : Derived-O/api_handle.o;
|
||||
text : .text%__dt__20_Tt_api_callback_ptrFv : Derived-O/api_utils.o;
|
||||
text : .text%store__14_Tt_api_handleFiPv : Derived-O/api_handle.o;
|
||||
text : .text%__ct__16_Tt_api_userdataFv : Derived-O/api_handle.o;
|
||||
text : .text%__dt__20_Tt_api_userdata_ptrFv : Derived-O/api_utils.o;
|
||||
text : .text%__dt__28_Tt_api_userdata_list_cursorFv : Derived-O/api_utils.o;
|
||||
text : .text%tt_mark : Derived-O/tt_c.o;
|
||||
text : .text%_tt_mark__Fv : Derived-O/api_api.o;
|
||||
text : .text%mark__17_Tt_api_stg_stackFv : Derived-O/api_storage.o;
|
||||
text : .text%__ct__11_Tt_messageFv : Derived-O/mp_message.o;
|
||||
text : .text%__ct__24_Tt_msg_context_list_ptrFv : Derived-O/mp_msg_context_utils.o;
|
||||
text : .text%base_constructor__11_Tt_messageFv : Derived-O/mp_message.o;
|
||||
text : .text%__ct__20_Tt_msg_context_listFv : Derived-O/mp_msg_context_utils.o;
|
||||
text : .text%__ct__16_Tt_message_listFv : Derived-O/mp_message_utils.o;
|
||||
text : .text%__ct__10_Tt_globalFv : Derived-O/tt_global_env.o;
|
||||
text : .text%__ct__31_Tt_db_hostname_redirection_mapFv : Derived-O/tt_db_hostname_redirection_map.o;
|
||||
text : .text%__ct__18_Tt_string_map_ptrFv : Derived-O/tt_string_map_utils.o;
|
||||
text : .text%__ct__14_Tt_string_mapFPFR14_Tt_object_ptr_10_Tt_string : Derived-O/tt_string_map.o;
|
||||
text : .text%__ct__23_Tt_map_entry_table_ptrFv : Derived-O/tt_map_entry_utils.o;
|
||||
text : .text%__ct__20_Tt_object_table_ptrFv : Derived-O/tt_object_table.o;
|
||||
text : .text%__ct__16_Tt_object_tableFi : Derived-O/tt_object_table.o;
|
||||
text : .text%__ct__18_Tt_host_table_ptrFv : Derived-O/tt_host_utils.o;
|
||||
text : .text%__ct__6_Tt_mpFv : Derived-O/mp_mp.o;
|
||||
text : .text%__ct__20_Tt_procid_table_ptrFv : Derived-O/mp_procid_utils.o;
|
||||
text : .text%__ct__18_Tt_file_table_ptrFv : Derived-O/mp_file_utils.o;
|
||||
text : .text%__ct__21_Tt_session_table_ptrFv : Derived-O/mp_session_utils.o;
|
||||
text : .text%__ct__11_Tt_sessionFv : Derived-O/mp_session.o;
|
||||
text : .text%__ct__25_Tt_session_prop_list_ptrFv : Derived-O/mp_session_prop_utils.o;
|
||||
text : .text%__ct__18_Tt_rpc_client_ptrFv : Derived-O/mp_rpc_client_utils.o;
|
||||
text : .text%__ct__15_Tt_desktop_ptrFv : Derived-O/mp_desktop_utils.o;
|
||||
text : .text%env__11_Tt_sessionFv : Derived-O/mp_session.o;
|
||||
text : .text%index__10_Tt_stringCFc : Derived-O/tt_string.o;
|
||||
text : .text%get_local_host__10_Tt_globalFR12_Tt_host_ptr : Derived-O/tt_global_env.o;
|
||||
text : .text%__ct__8_Tt_hostFv : Derived-O/tt_host.o;
|
||||
text : .text%init_byname__8_Tt_hostF10_Tt_string : Derived-O/tt_host.o;
|
||||
text : .text%_tt_gethostname__FPci : Derived-O/tt_port.o;
|
||||
text : .text%init_from_hostent__8_Tt_hostFP7hostent : Derived-O/tt_host.o;
|
||||
text : .text%set__10_Tt_stringFPCUci : Derived-O/tt_string.o;
|
||||
text : .text%__ct__10_Tt_stringFPCUci : Derived-O/tt_string.o;
|
||||
text : .text%set__14_Tt_string_bufFPCUci : Derived-O/tt_string.o;
|
||||
text : .text%name__8_Tt_hostFv : Derived-O/tt_host.o;
|
||||
text : .text%__vc__10_Tt_stringCFi : Derived-O/tt_string.o;
|
||||
text : .text%find_advertised_address__11_Tt_sessionFR10_Tt_string : Derived-O/mp_session.o;
|
||||
text : .text%parsed_address__11_Tt_sessionFR10_Tt_string : Derived-O/mp_session.o;
|
||||
text : .text%set_id__11_Tt_sessionFPc : Derived-O/mp_session.o;
|
||||
text : .text%__ct__11_Tt_int_recFi : Derived-O/tt_int_rec.o;
|
||||
text : .text%__dt__15_Tt_int_rec_ptrFv : Derived-O/tt_int_rec.o;
|
||||
text : .text%__dt__15_Tt_msg_contextFv : Derived-O/mp_msg_context.o;
|
||||
text : .text%__dt__11_Tt_contextFv : Derived-O/mp_context.o;
|
||||
text : .text%__dt__11_Tt_patlistFv : Derived-O/mp_pattern_utils.o;
|
||||
text : .text%__dt__16_Tt_pattern_listFv : Derived-O/mp_pattern_utils.o;
|
||||
text : .text%__dt__20_Tt_object_table_ptrFv : Derived-O/tt_object_table.o;
|
||||
text : .text%tt_default_procid_set : Derived-O/api_default.o;
|
||||
text : .text%_tt_default_procid_set__FPCc : Derived-O/api_default.o;
|
||||
text : .text%set_default_procid__8_Tt_c_mpF10_Tt_string : Derived-O/mp_c_mp.o;
|
||||
text : .text%tt_pattern_arg_add : Derived-O/api_pattern.o;
|
||||
text : .text%tt_pattern_callback_add : Derived-O/api_pattern.o;
|
||||
text : .text%add_callback__20_Tt_api_handle_tableFP18_Tt_pattern_handlePFP18_Tt_message_handleP18_Tt_pattern_handle_18tt_callback_action : Derived-O/api_handle.o;
|
||||
text : .text%tt_pattern_user_set : Derived-O/api_pattern.o;
|
||||
text : .text%store__20_Tt_api_handle_tableFP18_Tt_pattern_handleiPv : Derived-O/api_handle.o;
|
||||
text : .text%__ct__11_Tt_patlistFv : Derived-O/mp_pattern_utils.o;
|
||||
text : .text%set_state__11_Tt_messageF8tt_state : Derived-O/mp_message.o;
|
||||
text : .text%_set_id__11_Tt_messageFi : Derived-O/mp_message.o;
|
||||
text : .text%lookup_mhandle__20_Tt_api_handle_tableF17_Tt_c_message_ptr : Derived-O/api_handle.o;
|
||||
text : .text%mptr__14_Tt_api_handleFv : Derived-O/api_handle.o;
|
||||
text : .text%set_reliability__11_Tt_messageF14tt_disposition : Derived-O/mp_message.o;
|
||||
text : .text%xdr__15_Tt_message_ptrFP3XDR : Derived-O/mp_message_utils.o;
|
||||
text : .text%_Tt_message_xdr__FP3XDRP10_Tt_object : Derived-O/mp_message_utils.o;
|
||||
text : .text%xdr__11_Tt_messageFP3XDR : Derived-O/mp_message.o;
|
||||
text : .text%__ct__9_Tt_traceFP4FILEPCcT2i : Derived-O/tt_trace.o;
|
||||
text : .text%type__7_Tt_argCFv : Derived-O/mp_arg.o;
|
||||
text : .text%__dt__19_Tt_arg_list_cursorFv : Derived-O/mp_arg_utils.o;
|
||||
text : .text%__dt__9_Tt_traceFv : Derived-O/tt_trace.o;
|
||||
text : .text%send__17_Tt_stream_socketFPci : Derived-O/mp_stream_socket.o;
|
||||
text : .text%handling__10_Tt_procidFR15_Tt_message_ptr : Derived-O/mp_procid.o;
|
||||
text : .text%__dt__27_Tt_msg_context_list_cursorFv : Derived-O/mp_msg_context_utils.o;
|
||||
text : .text%top__15_Tt_object_listCFv : Derived-O/tt_object_list.o;
|
||||
text : .text%add_out_arg__11_Tt_messageFR11_Tt_arg_ptr : Derived-O/mp_message.o;
|
||||
text : .text%pop__15_Tt_object_listFv : Derived-O/tt_object_list.o;
|
||||
text : .text%_Tt_message_list_xdr__FP3XDRP10_Tt_object : Derived-O/mp_message_utils.o;
|
||||
text : .text%xdr__16_Tt_message_listFP3XDR : Derived-O/mp_message_utils.o;
|
||||
text : .text%_Tt_message_list_maker__Fv : Derived-O/mp_message_utils.o;
|
||||
text : .text%_Tt_message_maker__Fv : Derived-O/mp_message_utils.o;
|
||||
text : .text%bot__15_Tt_object_listCFv : Derived-O/tt_object_list.o;
|
||||
text : .text%dequeue__15_Tt_object_listFv : Derived-O/tt_object_list.o;
|
||||
text : .text%clear_signal__12_Tt_c_procidFv : Derived-O/mp_c_procid.o;
|
||||
text : .text%read_would_block__17_Tt_stream_socketFv : Derived-O/mp_stream_socket.o;
|
||||
text : .text%recv__17_Tt_stream_socketFPci : Derived-O/mp_stream_socket.o;
|
||||
text : .text%is_equal__11_Tt_messageFRC15_Tt_message_ptr : Derived-O/mp_message.o;
|
||||
text : .text%update_message__11_Tt_messageFR15_Tt_message_ptr : Derived-O/mp_message.o;
|
||||
text : .text%tt_message_pattern : Derived-O/api_message.o;
|
||||
text : .text%pattern_id__11_Tt_messageFv : Derived-O/mp_message.o;
|
||||
text : .text%run_message_callbacks__20_Tt_api_handle_tableFP18_Tt_message_handleP18_Tt_pattern_handle : Derived-O/api_handle.o;
|
||||
text : .text%run_callbacks__14_Tt_api_handleFP18_Tt_message_handleP18_Tt_pattern_handle : Derived-O/api_handle.o;
|
||||
text : .text%tt_message_user : Derived-O/api_message.o;
|
||||
text : .text%fetch__20_Tt_api_handle_tableFP18_Tt_message_handlei : Derived-O/api_handle.o;
|
||||
text : .text%fetch__14_Tt_api_handleFi : Derived-O/api_handle.o;
|
||||
text : .text%tt_message_arg_type : Derived-O/api_message.o;
|
||||
text : .text%__vc__15_Tt_object_listCFi : Derived-O/tt_object_list.o;
|
||||
text : .text%tt_message_arg_val : Derived-O/api_message.o;
|
||||
text : .text%data_string__7_Tt_argCFR10_Tt_string : Derived-O/mp_arg.o;
|
||||
text : .text%tt_message_args_count : Derived-O/api_message.o;
|
||||
text : .text%tt_message_context_val : Derived-O/api_message.o;
|
||||
text : .text%context__11_Tt_messageCFPCc : Derived-O/mp_message.o;
|
||||
text : .text%__dt__19_Tt_msg_context_ptrFv : Derived-O/mp_msg_context_utils.o;
|
||||
text : .text%__dt__15_Tt_context_ptrFv : Derived-O/mp_context_utils.o;
|
||||
text : .text%tt_message_state : Derived-O/api_message.o;
|
||||
text : .text%tt_release : Derived-O/tt_c.o;
|
||||
text : .text%_tt_release__Fi : Derived-O/api_api.o;
|
||||
text : .text%release__17_Tt_api_stg_stackFi : Derived-O/api_storage.o;
|
||||
text : .text%__dt__21_Tt_api_stg_stack_elmFv : Derived-O/api_storage.o;
|
||||
text : .text%prev__22_Tt_object_list_cursorFv : Derived-O/tt_object_list.o;
|
||||
text : .text%__dt__33_Tt_api_stg_stack_elm_list_cursorFv : Derived-O/api_utils.o;
|
||||
text : .text%tt_message_destroy : Derived-O/api_message.o;
|
||||
text : .text%__dt__28_Tt_api_callback_list_cursorFv : Derived-O/api_utils.o;
|
||||
text : .text%set_start_message__11_Tt_messageFi : Derived-O/mp_message.o;
|
||||
text : .text%tt_xdr_update_args__FP3XDRP15_Tt_update_args : Derived-O/mp_xdr_functions.o;
|
||||
text : .text%is_start_message__11_Tt_messageFv : Derived-O/mp_message.o;
|
||||
text : .text%clear__20_Tt_api_handle_tableFP18_Tt_message_handle : Derived-O/api_handle.o;
|
||||
text : .text%__dt__14_Tt_api_handleFv : Derived-O/api_handle.o;
|
||||
text : .text%__dt__25_Tt_api_callback_list_ptrFv : Derived-O/api_utils.o;
|
||||
text : .text%__dt__21_Tt_api_callback_listFv : Derived-O/api_utils.o;
|
||||
text : .text%__dt__25_Tt_api_userdata_list_ptrFv : Derived-O/api_utils.o;
|
||||
text : .text%__dt__21_Tt_api_userdata_listFv : Derived-O/api_utils.o;
|
||||
text : .text%__dt__13_Tt_c_messageFv : Derived-O/mp_c_message.o;
|
||||
text : .text%tt_open : Derived-O/api_mp.o;
|
||||
text : .text%_tt_internal_init__Fv : Derived-O/api_mp.o;
|
||||
text : .text%__ct__8_Tt_c_mpFv : Derived-O/mp_c_mp.o;
|
||||
text : .text%__ct__17_Tt_c_session_ptrFv : Derived-O/mp_c_session_utils.o;
|
||||
text : .text%__ct__16_Tt_c_procid_ptrFv : Derived-O/mp_c_procid_utils.o;
|
||||
text : .text%__ct__13_Tt_c_sessionFv : Derived-O/mp_c_session.o;
|
||||
text : .text%__ct__20_Tt_api_handle_tableFv : Derived-O/api_handle.o;
|
||||
text : .text%__ct__23_Tt_api_handle_list_ptrFv : Derived-O/api_utils.o;
|
||||
text : .text%__ct__18_Tt_api_handle_ptrFv : Derived-O/api_utils.o;
|
||||
text : .text%__ct__19_Tt_api_handle_listFv : Derived-O/api_utils.o;
|
||||
text : .text%c_init__8_Tt_c_mpFv : Derived-O/mp_c_mp.o;
|
||||
text : .text%c_init__13_Tt_c_sessionFv : Derived-O/mp_c_session.o;
|
||||
text : .text%client_session_init__11_Tt_sessionFv : Derived-O/mp_session.o;
|
||||
text : .text%find_host__10_Tt_globalF10_Tt_stringR12_Tt_host_ptri : Derived-O/tt_global_env.o;
|
||||
text : .text%init_byaddr__8_Tt_hostF10_Tt_string : Derived-O/tt_host.o;
|
||||
text : .text%init_bystringaddr__8_Tt_hostF10_Tt_string : Derived-O/tt_host.o;
|
||||
text : .text%_tt_host_addr__FR14_Tt_object_ptr : Derived-O/tt_host.o;
|
||||
text : .text%addr__8_Tt_hostFv : Derived-O/tt_host.o;
|
||||
text : .text%_tt_host_name__FR14_Tt_object_ptr : Derived-O/tt_host.o;
|
||||
text : .text%__ct__14_Tt_rpc_clientFi : Derived-O/mp_rpc_client.o;
|
||||
text : .text%init__14_Tt_rpc_clientFR12_Tt_host_ptriT2l14_Tt_auth_level : Derived-O/mp_rpc_client.o;
|
||||
text : .text%_tt_tli_set_nodelay : Derived-O/mp_rpc_fns.o;
|
||||
text : .text%ping__11_Tt_sessionFv : Derived-O/mp_session.o;
|
||||
text : .text%has_id__11_Tt_sessionFR10_Tt_string : Derived-O/mp_session.o;
|
||||
text : .text%mid__10_Tt_stringCFiT1 : Derived-O/tt_string.o;
|
||||
text : .text%create_new_procid__8_Tt_c_mpFv : Derived-O/mp_c_mp.o;
|
||||
text : .text%__ct__12_Tt_c_procidFv : Derived-O/mp_c_procid.o;
|
||||
text : .text%__ct__20_Tt_typecb_table_ptrFv : Derived-O/api_typecb_utils.o;
|
||||
text : .text%init__12_Tt_c_procidFv : Derived-O/mp_c_procid.o;
|
||||
text : .text%_tt_base64_encode__FUl : Derived-O/tt_base64.o;
|
||||
text : .text%set_id__12_Tt_c_procidFv : Derived-O/mp_c_procid.o;
|
||||
text : .text%set_fd_channel__12_Tt_c_procidFi : Derived-O/mp_c_procid.o;
|
||||
text : .text%__ct__17_Tt_stream_socketFR12_Tt_host_ptri : Derived-O/mp_stream_socket.o;
|
||||
text : .text%init__17_Tt_stream_socketFi : Derived-O/mp_stream_socket.o;
|
||||
text : .text%__dt__8_Tt_hostFv : Derived-O/tt_host.o;
|
||||
text : .text%port__10_Tt_procidCFv : Derived-O/mp_procid.o;
|
||||
text : .text%port__17_Tt_stream_socketFv : Derived-O/mp_stream_socket.o;
|
||||
text : .text%tt_xdr_fd_args__FP3XDRP11_Tt_fd_args : Derived-O/mp_xdr_functions.o;
|
||||
text : .text%fd__10_Tt_procidFv : Derived-O/mp_procid.o;
|
||||
text : .text%fd__17_Tt_stream_socketFv : Derived-O/mp_stream_socket.o;
|
||||
text : .text%accept__17_Tt_stream_socketFv : Derived-O/mp_stream_socket.o;
|
||||
text : .text%addr_length__8_Tt_hostFv : Derived-O/tt_host.o;
|
||||
text : .text%refresh__31_Tt_db_hostname_redirection_mapFv : Derived-O/tt_db_hostname_redirection_map.o;
|
||||
text : .text%_tt_user_path__F10_Tt_stringT1i : Derived-O/tt_path.o;
|
||||
text : .text%loadFile__14_Tt_string_mapFRC10_Tt_string : Derived-O/tt_string_map.o;
|
||||
text : .text%flush__16_Tt_object_tableFv : Derived-O/tt_object_table.o;
|
||||
text : .text%__ct__17_Tt_api_stg_stackFv : Derived-O/api_storage.o;
|
||||
text : .text%__ct__30_Tt_api_stg_stack_elm_list_ptrFv : Derived-O/api_utils.o;
|
||||
text : .text%__ct__26_Tt_api_stg_stack_elm_listFv : Derived-O/api_utils.o;
|
||||
text : .text%tt_message_status : Derived-O/api_message.o;
|
||||
text : .text%tt_fd : Derived-O/api_mp.o;
|
||||
text : .text%tt_int_error : Derived-O/tt_c.o;
|
||||
text : .text%_tt_int_error__Fi : Derived-O/api_api.o;
|
||||
text : .text%tt_xdr_declare_ptype_args__FP3XDRP22_Tt_declare_ptype_args : Derived-O/mp_xdr_functions.o;
|
||||
text : .text%__ct__19_Tt_procid_list_ptrFv : Derived-O/mp_procid_utils.o;
|
||||
text : .text%_tt_getdtablesize__Fv : Derived-O/tt_port.o;
|
||||
text : .text%__ct__11_Tt_desktopFv : Derived-O/mp_desktop.o;
|
||||
text : .text%init__11_Tt_desktopF10_Tt_string11_Tt_dt_type : Derived-O/mp_desktop.o;
|
||||
text : .text%stringaddr__8_Tt_hostFv : Derived-O/tt_host.o;
|
||||
text : .text%get_prop__11_Tt_desktopF10_Tt_stringR10_Tt_string : Derived-O/mp_desktop.o;
|
||||
text : .text%Xid__11_Tt_sessionF10_Tt_string : Derived-O/mp_session.o;
|
||||
text : .text%session_name__11_Tt_desktopF10_Tt_string : Derived-O/mp_desktop.o;
|
||||
text : .text%__dt__17_Tt_stream_socketFv : Derived-O/mp_stream_socket.o;
|
||||
text : .text%__dt__11_Tt_int_recFv : Derived-O/tt_int_rec.o;
|
||||
text : .text%__dt__16_Tt_object_tableFv : Derived-O/tt_object_table.o;
|
||||
text : .text%__ct__15_Tt_msg_contextFv : Derived-O/mp_msg_context.o;
|
||||
text : .text%__ct__11_Tt_contextFv : Derived-O/mp_context.o;
|
||||
text : .text%xdr__20_Tt_msg_context_listFP3XDR : Derived-O/mp_msg_context_utils.o;
|
||||
text : .text%_Tt_msg_context_xdr__FP3XDRP10_Tt_object : Derived-O/mp_msg_context_utils.o;
|
||||
text : .text%xdr__15_Tt_msg_contextFP3XDR : Derived-O/mp_msg_context.o;
|
||||
text : .text%xdr__11_Tt_contextFP3XDR : Derived-O/mp_context.o;
|
||||
text : .text%xdr__11_Tt_arg_ptrFP3XDR : Derived-O/mp_arg_utils.o;
|
||||
text : .text%_Tt_msg_context_maker__Fv : Derived-O/mp_msg_context_utils.o;
|
||||
text : .text%tt_message_reply : Derived-O/api_message.o;
|
||||
text : .text%update_message__12_Tt_c_procidFR15_Tt_message_ptr8tt_state : Derived-O/mp_c_procid.o;
|
||||
text : .text%set_return_handler_flags__13_Tt_c_messageFv : Derived-O/mp_c_message.o;
|
||||
text : .text%tt_pattern_user : Derived-O/api_pattern.o;
|
||||
text : .text%fetch__20_Tt_api_handle_tableFP18_Tt_pattern_handlei : Derived-O/api_handle.o;
|
||||
text : .text%__dt__16_Tt_api_callbackFv : Derived-O/api_handle.o;
|
||||
text : .text%__dt__16_Tt_api_userdataFv : Derived-O/api_handle.o;
|
||||
text : .text%__dt__17_Tt_c_session_ptrFv : Derived-O/mp_c_session_utils.o;
|
||||
text : .text%tt_message_create : Derived-O/api_message.o;
|
||||
text : .text%__ct__13_Tt_c_messageFv : Derived-O/mp_c_message.o;
|
||||
text : .text%set_sender__11_Tt_messageFR14_Tt_procid_ptr : Derived-O/mp_message.o;
|
||||
text : .text%set_id__11_Tt_messageFv : Derived-O/mp_message.o;
|
||||
text : .text%generate_message_id__6_Tt_mpFv : Derived-O/mp_mp.o;
|
||||
text : .text%set_file__11_Tt_messageF10_Tt_string : Derived-O/mp_message.o;
|
||||
text : .text%set_session__11_Tt_messageFR15_Tt_session_ptr : Derived-O/mp_message.o;
|
||||
text : .text%set_sender_ptype__11_Tt_messageF10_Tt_string : Derived-O/mp_message.o;
|
||||
text : .text%is_a_diff__13_Tt_c_messageFv : Derived-O/mp_c_message.o;
|
||||
text : .text%ptr_set__14_Tt_api_handleF17_Tt_c_message_ptr : Derived-O/api_handle.o;
|
||||
text : .text%tt_message_address_set : Derived-O/api_message.o;
|
||||
text : .text%set_paradigm__11_Tt_messageF10tt_address : Derived-O/mp_message.o;
|
||||
text : .text%tt_message_class_set : Derived-O/api_message.o;
|
||||
text : .text%set_message_class__11_Tt_messageF8tt_class : Derived-O/mp_message.o;
|
||||
text : .text%tt_message_scope_set : Derived-O/api_message.o;
|
||||
text : .text%set_scope__11_Tt_messageF8tt_scope : Derived-O/mp_message.o;
|
||||
text : .text%tt_message_session_set : Derived-O/api_message.o;
|
||||
text : .text%tt_message_disposition_set : Derived-O/api_message.o;
|
||||
text : .text%tt_message_op_set : Derived-O/api_message.o;
|
||||
text : .text%set_op__11_Tt_messageF10_Tt_string : Derived-O/mp_message.o;
|
||||
text : .text%tt_message_barg_add : Derived-O/api_message.o;
|
||||
text : .text%set_data_string__7_Tt_argFRC10_Tt_string : Derived-O/mp_arg.o;
|
||||
text : .text%add_arg__11_Tt_messageFR11_Tt_arg_ptr : Derived-O/mp_message.o;
|
||||
text : .text%tt_message_arg_add : Derived-O/api_message.o;
|
||||
text : .text%__ct__7_Tt_argF7tt_modeR10_Tt_string : Derived-O/mp_arg.o;
|
||||
text : .text%set_data_string__7_Tt_argFPCc : Derived-O/mp_arg.o;
|
||||
text : .text%tt_message_iarg_add : Derived-O/api_message.o;
|
||||
text : .text%set_data_int__7_Tt_argFi : Derived-O/mp_arg.o;
|
||||
text : .text%tt_message_callback_add : Derived-O/api_message.o;
|
||||
text : .text%add_callback__20_Tt_api_handle_tableFP18_Tt_message_handlePFP18_Tt_message_handleP18_Tt_pattern_handle_18tt_callback_action : Derived-O/api_handle.o;
|
||||
text : .text%tt_message_user_set : Derived-O/api_message.o;
|
||||
text : .text%store__20_Tt_api_handle_tableFP18_Tt_message_handleiPv : Derived-O/api_handle.o;
|
||||
text : .text%tt_message_send : Derived-O/api_message.o;
|
||||
text : .text%dispatch__13_Tt_c_messageFi : Derived-O/mp_c_message.o;
|
||||
text : .text%__ct__12_Tt_file_ptrFv : Derived-O/mp_file_utils.o;
|
||||
text : .text%__ct__17_Tt_qmsg_info_ptrFv : Derived-O/mp_file_utils.o;
|
||||
text : .text%_rpc_dispatch_2__13_Tt_c_messageCFv : Derived-O/mp_c_message.o;
|
||||
text : .text%tt_xdr_message__FP3XDRP15_Tt_message_ptr : Derived-O/mp_message.o;
|
||||
text : .text%__dt__17_Tt_qmsg_info_ptrFv : Derived-O/mp_file_utils.o;
|
||||
text : .text%__dt__12_Tt_file_ptrFv : Derived-O/mp_file_utils.o;
|
||||
text : .text%is_valid__22_Tt_object_list_cursorCFv : Derived-O/tt_object_list.o;
|
||||
text : .text%__dt__23_Tt_context_list_cursorFv : Derived-O/mp_context_utils.o;
|
||||
text : .text%set_opnum__11_Tt_messageFi : Derived-O/mp_message.o;
|
||||
text : .text%set_handler_ptype__11_Tt_messageF10_Tt_string : Derived-O/mp_message.o;
|
||||
text : .text%address_string__11_Tt_sessionFv : Derived-O/mp_session.o;
|
||||
text : .text%displayname__11_Tt_sessionFv : Derived-O/mp_session.o;
|
||||
text : .text%tt_message_arg_ival : Derived-O/api_message.o;
|
||||
text : .text%data_int__7_Tt_argCFRi : Derived-O/mp_arg.o;
|
||||
text : .text%set_handler_procid__11_Tt_messageFR14_Tt_procid_ptr : Derived-O/mp_message.o;
|
||||
text : .text%set_status__11_Tt_messageFi : Derived-O/mp_message.o;
|
||||
text : .text%update_value__7_Tt_argFR11_Tt_arg_ptr : Derived-O/mp_arg.o;
|
||||
text : .text%__dt__27_Tt_pat_context_list_cursorFv : Derived-O/mp_pat_context_utils.o;
|
||||
text : .text%set_pattern_id__11_Tt_messageF10_Tt_string : Derived-O/mp_message.o;
|
||||
text : .text%lookup_pat_by_id__20_Tt_api_handle_tableF10_Tt_stringRP18_Tt_pattern_handle : Derived-O/api_handle.o;
|
||||
text : .text%__dt__11_Tt_sessionFv : Derived-O/mp_session.o;
|
||||
text : .text%__dt__15_Tt_desktop_ptrFv : Derived-O/mp_desktop_utils.o;
|
||||
text : .text%__dt__18_Tt_rpc_client_ptrFv : Derived-O/mp_rpc_client_utils.o;
|
||||
text : .text%__dt__25_Tt_session_prop_list_ptrFv : Derived-O/mp_session_prop_utils.o;
|
||||
text : .text%__dt__22_Tt_pid_t_rec_list_ptrFv : Derived-O/tt_int_rec.o;
|
||||
text : .text%__dt__21_Tt_patlist_table_ptrFv : Derived-O/mp_pattern_utils.o;
|
||||
text : .text%__dt__17_Tt_patlist_tableFv : Derived-O/mp_pattern_utils.o;
|
||||
text : .text%tt_pattern_destroy : Derived-O/api_pattern.o;
|
||||
text : .text%del_pattern__12_Tt_c_procidFR10_Tt_string : Derived-O/mp_c_procid.o;
|
||||
text : .text%tt_xdr_del_pattern_args__FP3XDRP20_Tt_del_pattern_args : Derived-O/mp_xdr_functions.o;
|
||||
text : .text%__ct__15_Tt_object_listFRC15_Tt_object_list : Derived-O/tt_object_list.o;
|
||||
text : .text%clear__20_Tt_api_handle_tableFP18_Tt_pattern_handle : Derived-O/api_handle.o;
|
||||
text : .text%tt_message_context_set : Derived-O/api_message.o;
|
||||
text : .text%setName__11_Tt_contextFPCc : Derived-O/mp_context.o;
|
||||
text : .text%setValue__15_Tt_msg_contextFRC10_Tt_string : Derived-O/mp_msg_context.o;
|
||||
text : .text%add_context__11_Tt_messageFR19_Tt_msg_context_ptr : Derived-O/mp_message.o;
|
||||
text : .text%append_ordered__20_Tt_msg_context_listFRC19_Tt_msg_context_ptr : Derived-O/mp_msg_context_utils.o;
|
||||
text : .text%append_ordered__16_Tt_context_listFRC15_Tt_context_ptr : Derived-O/mp_context_utils.o;
|
||||
text : .text%isEnvEntry__15_Tt_msg_contextCFv : Derived-O/mp_msg_context.o;
|
||||
text : .text%run_pattern_callbacks__20_Tt_api_handle_tableFP18_Tt_pattern_handleP18_Tt_message_handle : Derived-O/api_handle.o;
|
||||
text : .text%tt_message_accept : Derived-O/api_message.o;
|
||||
text : .text%unblock_ptype__12_Tt_c_procidFR10_Tt_string : Derived-O/mp_c_procid.o;
|
||||
text : .text%tt_message_sender : Derived-O/api_message.o;
|
||||
text : .text%tt_message_handler_set : Derived-O/api_message.o;
|
||||
text : .text%__ct__12_Tt_c_procidFRC10_Tt_string : Derived-O/mp_c_procid.o;
|
||||
text : .text%tt_message_op : Derived-O/api_message.o;
|
||||
text : .text%tt_message_arg_val_set : Derived-O/api_message.o;
|
||||
text : .text%tt_message_arg_ival_set : Derived-O/api_message.o;
|
||||
text : .text%__dt__12_Tt_c_procidFv : Derived-O/mp_c_procid.o;
|
||||
text : .text%__dt__20_Tt_typecb_table_ptrFv : Derived-O/api_typecb_utils.o;
|
||||
text : .text%tt_X_session : Derived-O/api_mp.o;
|
||||
text : .text%tt_default_session_set : Derived-O/api_default.o;
|
||||
text : .text%_tt_default_session_set__FPCc : Derived-O/api_default.o;
|
||||
text : .text%find_host_byname__10_Tt_globalF10_Tt_stringR12_Tt_host_ptr : Derived-O/tt_global_env.o;
|
||||
text : .text%__dt__14_Tt_rpc_clientFv : Derived-O/mp_rpc_client.o;
|
||||
text : .text%__dt__13_Tt_c_sessionFv : Derived-O/mp_c_session.o;
|
||||
text : .text%tt_ptype_declare : Derived-O/api_pattern.o;
|
||||
text : .text%declare_ptype__12_Tt_c_procidFR10_Tt_string : Derived-O/mp_c_procid.o;
|
||||
text : .text%set_default_ptype__12_Tt_c_procidFR10_Tt_string : Derived-O/mp_c_procid.o;
|
||||
text : .text%tt_session_join : Derived-O/api_mp.o;
|
||||
text : .text%set_default_session__12_Tt_c_procidFR10_Tt_string : Derived-O/mp_c_procid.o;
|
||||
text : .text%c_join__13_Tt_c_sessionFR14_Tt_procid_ptr : Derived-O/mp_c_session.o;
|
||||
text : .text%tt_message_file : Derived-O/api_message.o;
|
||||
text : .text%_tt_network_path_to_local_path__FRC10_Tt_string : Derived-O/tt_path.o;
|
||||
text : .text%tt_message_arg_bval : Derived-O/api_message.o;
|
||||
text : .text%_tt_strdup__FPCci : Derived-O/api_api.o;
|
||||
text : .text%is_match__7_Tt_argCFRC11_Tt_arg_ptr : Derived-O/mp_arg.o;
|
||||
text : .text%__ct__21_Tt_patlist_table_ptrFv : Derived-O/mp_pattern_utils.o;
|
||||
text : .text%__ct__22_Tt_pid_t_rec_list_ptrFv : Derived-O/tt_int_rec.o;
|
||||
text : .text%_tt_sigset__FiPFi_v : Derived-O/tt_port.o;
|
||||
text : .text%__ct__20_Tt_desktop_lock_ptrFv : Derived-O/mp_desktop_utils.o;
|
||||
text : .text%set_error_handler__11_Tt_desktopFPFPv_i : Derived-O/mp_desktop.o;
|
||||
text : .text%notify_fd__11_Tt_desktopFv : Derived-O/mp_desktop.o;
|
||||
text : .text%__ct__16_Tt_desktop_lockFRC15_Tt_desktop_ptr : Derived-O/mp_desktop.o;
|
||||
text : .text%lock__11_Tt_desktopFv : Derived-O/mp_desktop.o;
|
||||
text : .text%__ct__21_Tt_session_prop_listFv : Derived-O/mp_session_prop_utils.o;
|
||||
text : .text%set_prop__11_Tt_desktopF10_Tt_stringR10_Tt_string : Derived-O/mp_desktop.o;
|
||||
text : .text%__dt__20_Tt_desktop_lock_ptrFv : Derived-O/mp_desktop_utils.o;
|
||||
text : .text%__dt__16_Tt_desktop_lockFv : Derived-O/mp_desktop.o;
|
||||
text : .text%unlock__11_Tt_desktopFv : Derived-O/mp_desktop.o;
|
||||
text : .text%xdr__16_Tt_object_tableFP3XDRPFP3XDRP10_Tt_object_iPFv_P10_Tt_object : Derived-O/tt_object_table.o;
|
||||
text : .text%xdr_1__14_Tt_string_bufFP3XDR : Derived-O/tt_string.o;
|
||||
text : .text%__ct__23_Tt_object_table_cursorFv : Derived-O/tt_object_table.o;
|
||||
text : .text%reset__23_Tt_object_table_cursorFR20_Tt_object_table_ptr : Derived-O/tt_object_table.o;
|
||||
text : .text%next__23_Tt_object_table_cursorFv : Derived-O/tt_object_table.o;
|
||||
text : .text%__ml__23_Tt_object_table_cursorFv : Derived-O/tt_object_table.o;
|
||||
text : .text%__dt__23_Tt_object_table_cursorFv : Derived-O/tt_object_table.o;
|
||||
text : .text%__ct__22_Tt_string_list_cursorFv : Derived-O/tt_string.o;
|
||||
text : .text%__dt__6_Tt_mpFv : Derived-O/mp_mp.o;
|
||||
text : .text%__dt__21_Tt_session_table_ptrFv : Derived-O/mp_session_utils.o;
|
||||
text : .text%__dt__17_Tt_session_tableFv : Derived-O/mp_session_utils.o;
|
||||
text : .text%__dt__18_Tt_file_table_ptrFv : Derived-O/mp_file_utils.o;
|
||||
text : .text%__dt__20_Tt_procid_table_ptrFv : Derived-O/mp_procid_utils.o;
|
||||
text : .text%__dt__16_Tt_procid_tableFv : Derived-O/mp_procid_utils.o;
|
||||
text : .text%del_prop__11_Tt_desktopF10_Tt_string : Derived-O/mp_desktop.o;
|
||||
text : .text%__dt__11_Tt_desktopFv : Derived-O/mp_desktop.o;
|
||||
text : .text%close__11_Tt_desktopFv : Derived-O/mp_desktop.o;
|
||||
text : .text%__dt__21_Tt_session_prop_listFv : Derived-O/mp_session_prop_utils.o;
|
||||
text : .text%sock__17_Tt_stream_socketFv : Derived-O/mp_stream_socket.o;
|
||||
12
cde/lib/tt/lib/api/Imakefile
Normal file
12
cde/lib/tt/lib/api/Imakefile
Normal file
@@ -0,0 +1,12 @@
|
||||
XCOMM $TOG: Imakefile /main/6 1998/08/10 18:00:37 mgreess $
|
||||
#define IHaveSubdirs
|
||||
#define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)' 'CXXDEBUGFLAGS=$(CXXDEBUGFLAGS)'
|
||||
|
||||
SUBDIRS = c dnd
|
||||
DONES = c/DONE dnd/DONE
|
||||
|
||||
MakeSubdirs($(SUBDIRS))
|
||||
ForceSubdirs($(SUBDIRS))
|
||||
DependSubdirs($(SUBDIRS))
|
||||
|
||||
SubdirLibraryRule($(DONES))
|
||||
54
cde/lib/tt/lib/api/c/Imakefile
Normal file
54
cde/lib/tt/lib/api/c/Imakefile
Normal file
@@ -0,0 +1,54 @@
|
||||
XCOMM $TOG: Imakefile /main/9 1999/08/30 10:50:55 mgreess $
|
||||
#define DoNormalLib NormalLibTt
|
||||
#define DoSharedLib SharedLibTt
|
||||
#define DoDebugLib DebugLibTt
|
||||
#define DoProfileLib ProfileLibTt
|
||||
#define LibName tt
|
||||
#define SoRev SOTTREV
|
||||
#define IncSubdir Tt
|
||||
#define LibCreate NO
|
||||
#ifdef TtLargePICTable
|
||||
# define LargePICTable TtLargePICTable
|
||||
#endif
|
||||
|
||||
#define CplusplusSource YES
|
||||
DEPEND_DEFINES = $(CXXDEPENDINCLUDES)
|
||||
|
||||
#include <Threads.tmpl>
|
||||
|
||||
#include "../../../tooltalk.tmpl"
|
||||
|
||||
DEFINES =
|
||||
INCLUDES = -I../../../lib
|
||||
|
||||
/*** NOTE!
|
||||
*** Every time a .o is added below it needs to be added to
|
||||
*** the lib/tt/lib Imakefile in OBJS and SHARED_OBJS
|
||||
***/
|
||||
|
||||
HEADERS = tt_c.h
|
||||
|
||||
SRCS = api_api.C api_auth.C \
|
||||
api_default.C api_error.C \
|
||||
api_file.C api_filemap.C api_handle.C \
|
||||
api_message.C api_mp.C api_mp_io.C \
|
||||
api_mp_otype.C api_objid_spec.C api_pattern.C \
|
||||
api_session_prop.C api_spec.C api_spec_map_ref.C \
|
||||
api_storage.C api_typecb.C api_typecb_utils.C \
|
||||
api_utils.C api_xdr.C
|
||||
|
||||
OBJS = api_api.o api_auth.o \
|
||||
api_default.o api_error.o \
|
||||
api_file.o api_filemap.o api_handle.o \
|
||||
api_message.o api_mp.o api_mp_io.o \
|
||||
api_mp_otype.o api_objid_spec.o api_pattern.o \
|
||||
api_session_prop.o api_spec.o api_spec_map_ref.o \
|
||||
api_storage.o api_typecb.o api_typecb_utils.o \
|
||||
api_utils.o api_xdr.o
|
||||
|
||||
|
||||
#include <Library.tmpl>
|
||||
|
||||
SubdirLibraryRule($(OBJS))
|
||||
|
||||
DependTarget()
|
||||
1047
cde/lib/tt/lib/api/c/api_api.C
Normal file
1047
cde/lib/tt/lib/api/c/api_api.C
Normal file
File diff suppressed because it is too large
Load Diff
56
cde/lib/tt/lib/api/c/api_api.h
Normal file
56
cde/lib/tt/lib/api/c/api_api.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
|
||||
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
|
||||
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
|
||||
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
|
||||
/*%% $XConsortium: api_api.h /main/3 1995/10/23 09:51:46 rswiston $ */
|
||||
/*-*-C++-*-
|
||||
*
|
||||
* api_api.h
|
||||
*
|
||||
* Copyright (c) 1990 by Sun Microsystems, Inc.
|
||||
*
|
||||
* Declarations for "pure api" functions.
|
||||
*/
|
||||
#if !defined(_TT_API_API_H)
|
||||
#define _TT_API_API_H
|
||||
#include "api/c/tt_c.h"
|
||||
#include "util/tt_string.h"
|
||||
extern char _tt_api_status_page[(int)TT_STATUS_LAST];
|
||||
|
||||
int _tt_mark(void);
|
||||
void _tt_release(int mark);
|
||||
caddr_t _tt_malloc(size_t s);
|
||||
char *_tt_strdup(const _Tt_string &);
|
||||
char *_tt_strdup(const char * s);
|
||||
char *_tt_strdup(const char * s, int len);
|
||||
void _tt_free(caddr_t p);
|
||||
caddr_t _tt_take(caddr_t p);
|
||||
char *_tt_status_message(Tt_status ttrc);
|
||||
Tt_status _tt_errno_status(int err_no);
|
||||
Tt_status _tt_pointer_error(void *pointer);
|
||||
Tt_status _tt_int_error(int n);
|
||||
void *_tt_error_pointer(Tt_status s);
|
||||
int _tt_error_int(Tt_status s);
|
||||
void _prepend_P_to_sessid(const char *sessid,
|
||||
_Tt_string &sessid_with_P);
|
||||
#define error_pointer(ttrc) ((void *)(_tt_api_status_page+(int)(ttrc)))
|
||||
#define error_int(ttrc) (-(int)(ttrc))
|
||||
|
||||
//
|
||||
// Macro to commit the default_procid to its default session. Should
|
||||
// be called before any operation that requires communicating with the
|
||||
// default session.
|
||||
//
|
||||
|
||||
// cpp complains about using (char *) as an argument to a macro
|
||||
typedef char *char_ptr;
|
||||
|
||||
#define PCOMMIT \
|
||||
if (d_procid->commit() != TT_OK) \
|
||||
return(TT_ERR_SESSION);
|
||||
|
||||
#define PTR_PCOMMIT(tcast) \
|
||||
if (d_procid->commit() != TT_OK) \
|
||||
return((tcast)error_pointer(TT_ERR_SESSION));
|
||||
|
||||
#endif
|
||||
66
cde/lib/tt/lib/api/c/api_auth.C
Normal file
66
cde/lib/tt/lib/api/c/api_auth.C
Normal file
@@ -0,0 +1,66 @@
|
||||
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
//%% (c) Copyright 1993, 1994 Novell, Inc.
|
||||
//%% $TOG: api_auth.C /main/1 1999/08/30 13:41:59 mgreess $
|
||||
/* @(#)api_mp.C 1.48 93/07/30
|
||||
*
|
||||
* api_mp.cc
|
||||
*
|
||||
* Copyright (c) 1990 by Sun Microsystems, Inc.
|
||||
*
|
||||
* This file contains API functions related to the MP. For
|
||||
* each API function named tt_<name> there is a _tt_<name> function in
|
||||
* some file named api_mp_*.cc.
|
||||
*/
|
||||
|
||||
#include "api/c/tt_c.h"
|
||||
#include "api/c/api_auth.h"
|
||||
|
||||
char *
|
||||
tt_AuthFileName()
|
||||
{
|
||||
return _tt_AuthFileName();
|
||||
}
|
||||
|
||||
int
|
||||
tt_LockAuthFile(char *file_name, int retries, int timeout, long dead)
|
||||
{
|
||||
return _tt_LockAuthFile(file_name, retries, timeout, dead);
|
||||
}
|
||||
|
||||
void
|
||||
tt_UnlockAuthFile(char *file_name)
|
||||
{
|
||||
_tt_UnlockAuthFile(file_name);
|
||||
}
|
||||
|
||||
Tt_AuthFileEntry
|
||||
tt_ReadAuthFileEntry(FILE *auth_file)
|
||||
{
|
||||
return _tt_ReadAuthFileEntry(auth_file);
|
||||
}
|
||||
|
||||
void
|
||||
tt_FreeAuthFileEntry(Tt_AuthFileEntry auth)
|
||||
{
|
||||
_tt_FreeAuthFileEntry(auth);
|
||||
}
|
||||
|
||||
int
|
||||
tt_WriteAuthFileEntry(FILE *auth_file, Tt_AuthFileEntry auth)
|
||||
{
|
||||
return _tt_WriteAuthFileEntry(auth_file, auth);
|
||||
}
|
||||
|
||||
Tt_AuthFileEntry
|
||||
tt_GetAuthFileEntry(char *protocol_name, char *network_id, char *auth_name)
|
||||
{
|
||||
return _tt_GetAuthFileEntry(protocol_name, network_id, auth_name);
|
||||
}
|
||||
|
||||
char *
|
||||
tt_GenerateMagicCookie(int len)
|
||||
{
|
||||
return _tt_GenerateMagicCookie(len);
|
||||
}
|
||||
37
cde/lib/tt/lib/api/c/api_auth.h
Normal file
37
cde/lib/tt/lib/api/c/api_auth.h
Normal file
@@ -0,0 +1,37 @@
|
||||
/* $TOG: api_auth.h /main/1 1999/08/30 13:42:42 mgreess $ */
|
||||
/******************************************************************************
|
||||
|
||||
|
||||
Copyright 1993, 1998 The Open Group
|
||||
|
||||
All Rights Reserved.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of The Open Group shall not be
|
||||
used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from The Open Group.
|
||||
|
||||
Author: Ralph Mor, X Consortium
|
||||
******************************************************************************/
|
||||
/*
|
||||
* This file was copied and altered from libICE/ICEutil.h
|
||||
* The 'Ice' prefix has been replaced by tt_ for functions
|
||||
* and by _tt_ for data types.
|
||||
*/
|
||||
|
||||
#ifndef API_AUTH_H
|
||||
#define API_AUTH_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include "mp/mp_auth_functions.h"
|
||||
|
||||
#endif /* API_AUTH_H */
|
||||
626
cde/lib/tt/lib/api/c/api_default.C
Normal file
626
cde/lib/tt/lib/api/c/api_default.C
Normal file
@@ -0,0 +1,626 @@
|
||||
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
//%% (c) Copyright 1993, 1994 Novell, Inc.
|
||||
//%% $TOG: api_default.C /main/9 1999/10/14 18:39:00 mgreess $
|
||||
/*
|
||||
*
|
||||
* api_default.cc
|
||||
*
|
||||
* Copyright (c) 1990 by Sun Microsystems, Inc.
|
||||
*/
|
||||
#include "db/tt_db_file.h"
|
||||
#include "mp/mp_c.h"
|
||||
#include "util/tt_path.h"
|
||||
#include "api/c/tt_c.h"
|
||||
#include "api/c/api_api.h"
|
||||
#include "api/c/api_mp.h"
|
||||
#include <util/tt_audit.h>
|
||||
#include "util/tt_global_env.h"
|
||||
#include "util/tt_threadspecific.h"
|
||||
|
||||
char *
|
||||
tt_default_ptype(void)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("v", TT_DEFAULT_PTYPE, 0);
|
||||
char *retval;
|
||||
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit((char *) _tt_error_pointer(status));
|
||||
return (char *) _tt_error_pointer(status);
|
||||
}
|
||||
|
||||
retval = _tt_default_ptype();
|
||||
audit.exit(retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
Tt_status
|
||||
tt_default_ptype_set(const char *ptid)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("C", TT_DEFAULT_PTYPE_SET, ptid);
|
||||
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit(status);
|
||||
return status;
|
||||
}
|
||||
|
||||
status = _tt_default_ptype_set(ptid);
|
||||
|
||||
audit.exit(status);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
tt_default_file(void)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("v", TT_DEFAULT_FILE, 0);
|
||||
char *retval;
|
||||
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit((char *) _tt_error_pointer(status));
|
||||
return (char *) _tt_error_pointer(status);
|
||||
}
|
||||
|
||||
retval = _tt_default_file();
|
||||
audit.exit(retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
Tt_status
|
||||
tt_default_file_set(const char *docid)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("c", TT_DEFAULT_FILE_SET, docid);
|
||||
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit(status);
|
||||
return status;
|
||||
}
|
||||
|
||||
status = _tt_default_file_set(docid);
|
||||
audit.exit(status);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
tt_default_session(void)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("v", TT_DEFAULT_SESSION, 0);
|
||||
char *retval;
|
||||
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit((char *) _tt_error_pointer(status));
|
||||
return (char *) _tt_error_pointer(status);
|
||||
}
|
||||
|
||||
retval = _tt_default_session();
|
||||
audit.exit(retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
Tt_status
|
||||
tt_default_session_set(const char *sessid)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("C", TT_DEFAULT_SESSION_SET, sessid);
|
||||
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit(status);
|
||||
return status;
|
||||
}
|
||||
|
||||
status = _tt_default_session_set(sessid);
|
||||
audit.exit(status);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
tt_thread_session(void)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("v", TT_THREAD_SESSION, 0);
|
||||
char *retval;
|
||||
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit((char *) _tt_error_pointer(status));
|
||||
return (char *) _tt_error_pointer(status);
|
||||
}
|
||||
|
||||
#ifdef OPT_XTHREADS
|
||||
if (!_tt_global->multithreaded()) {
|
||||
// Multithreading not enabled, so this is the same
|
||||
// as tt_default_session
|
||||
retval = _tt_default_session();
|
||||
}
|
||||
else {
|
||||
retval = _tt_thread_session();
|
||||
}
|
||||
#else
|
||||
retval = _tt_default_session();
|
||||
#endif
|
||||
audit.exit(retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
Tt_status
|
||||
tt_thread_session_set(const char *sessid)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("C", TT_THREAD_SESSION_SET, sessid);
|
||||
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit(status);
|
||||
return status;
|
||||
}
|
||||
|
||||
#ifdef OPT_XTHREADS
|
||||
if (!_tt_global->multithreaded()) {
|
||||
// Multithreading not enabled, so this not legal
|
||||
status = TT_ERR_TOOLATE;
|
||||
}
|
||||
else {
|
||||
status = _tt_thread_session_set(sessid);
|
||||
}
|
||||
#else
|
||||
status = _tt_default_session_set(sessid);
|
||||
#endif
|
||||
audit.exit(status);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
tt_default_procid(void)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("v", TT_DEFAULT_PROCID, 0);
|
||||
char *retval;
|
||||
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit((char *) _tt_error_pointer(status));
|
||||
return (char *) _tt_error_pointer(status);
|
||||
}
|
||||
|
||||
retval = _tt_default_procid();
|
||||
audit.exit(retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
Tt_status
|
||||
tt_default_procid_set(const char *procid)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("C", TT_DEFAULT_PROCID_SET, procid);
|
||||
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit(status);
|
||||
return status;
|
||||
}
|
||||
|
||||
status = _tt_default_procid_set(procid);
|
||||
audit.exit(status);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
tt_thread_procid(void)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("v", TT_THREAD_PROCID, 0);
|
||||
char *retval;
|
||||
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit((char *) _tt_error_pointer(status));
|
||||
return (char *) _tt_error_pointer(status);
|
||||
}
|
||||
|
||||
#ifdef OPT_XTHREADS
|
||||
if (!_tt_global->multithreaded()) {
|
||||
// Multithreading not enabled, so this is the same
|
||||
// as tt_default_procid()
|
||||
retval = _tt_default_procid();
|
||||
}
|
||||
else {
|
||||
retval = _tt_thread_procid();
|
||||
}
|
||||
#else
|
||||
retval = _tt_default_procid();
|
||||
#endif
|
||||
|
||||
audit.exit(retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
Tt_status
|
||||
tt_thread_procid_set(const char *procid)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("C", TT_THREAD_PROCID_SET, procid);
|
||||
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit(status);
|
||||
return status;
|
||||
}
|
||||
|
||||
#ifdef OPT_XTHREADS
|
||||
if (!_tt_global->multithreaded()) {
|
||||
// Multithreading not enabled, so this is not legal
|
||||
status = TT_ERR_TOOLATE;
|
||||
}
|
||||
else {
|
||||
status = _tt_thread_procid_set(procid);
|
||||
}
|
||||
#else
|
||||
status = _tt_default_procid_set(procid);
|
||||
#endif
|
||||
|
||||
audit.exit(status);
|
||||
return status;
|
||||
}
|
||||
|
||||
char *
|
||||
tt_procid_session(const char* procid)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("C", TT_PROCID_SESSION, procid);
|
||||
char *retval;
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit((char *) _tt_error_pointer(status));
|
||||
return (char *) _tt_error_pointer(status);
|
||||
}
|
||||
|
||||
retval = _tt_procid_session(procid);
|
||||
|
||||
audit.exit(retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
Tt_status tt_feature_enabled(Tt_feature f)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("F", TT_FEATURE_ENABLED, f);
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit(status);
|
||||
return status;
|
||||
}
|
||||
|
||||
#ifdef OPT_XTHREADS
|
||||
status = _tt_feature_enabled(f);
|
||||
#else
|
||||
status = TT_ERR_UNIMP;
|
||||
#endif
|
||||
|
||||
// Hack down the event counter, since this call shouldn't count.
|
||||
|
||||
if (_tt_global->event_counter > 0) _tt_global->event_counter--;
|
||||
|
||||
audit.exit(status);
|
||||
return status;
|
||||
}
|
||||
|
||||
Tt_status tt_feature_required(Tt_feature f)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("F", TT_FEATURE_REQUIRED, f);
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit(status);
|
||||
return status;
|
||||
}
|
||||
|
||||
#ifdef OPT_XTHREADS
|
||||
status = _tt_feature_required(f);
|
||||
#else
|
||||
status = TT_ERR_UNIMP;
|
||||
#endif
|
||||
|
||||
audit.exit(status);
|
||||
return status;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the default ptype for the current proc or NULL if none has been
|
||||
* declared.
|
||||
*/
|
||||
char *
|
||||
_tt_default_ptype(void)
|
||||
{
|
||||
return _tt_strdup(_tt_c_mp->default_c_procid()->default_ptype());
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Sets the default ptype to ptid.
|
||||
*/
|
||||
Tt_status
|
||||
_tt_default_ptype_set(const char * ptid)
|
||||
{
|
||||
_Tt_string p = ptid;
|
||||
|
||||
_tt_c_mp->default_c_procid()->set_default_ptype(p);
|
||||
|
||||
return TT_OK;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Returns the default file or NULL if none has been declared.
|
||||
*/
|
||||
char *
|
||||
_tt_default_file(void)
|
||||
{
|
||||
_Tt_c_procid *d_procid = _tt_c_mp->default_c_procid().c_pointer();
|
||||
|
||||
return _tt_strdup(
|
||||
_tt_network_path_to_local_path(d_procid->default_file()));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Sets the default file
|
||||
*/
|
||||
Tt_status
|
||||
_tt_default_file_set(const char *filepath)
|
||||
{
|
||||
_Tt_string abspath = _Tt_db_file::getNetworkPath(filepath);
|
||||
if ((filepath != 0) && (abspath.len() <= 0)) {
|
||||
return TT_ERR_FILE;
|
||||
}
|
||||
_tt_c_mp->default_c_procid()->set_default_file(abspath);
|
||||
return TT_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the id of the default session.
|
||||
*/
|
||||
char *
|
||||
_tt_default_session()
|
||||
{
|
||||
if (_tt_c_mp->default_c_session.is_null()) {
|
||||
return (char *)_tt_error_pointer(TT_ERR_SESSION);
|
||||
}
|
||||
return _tt_strdup(_tt_c_mp->default_c_session->id());
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Sets the id of the default session.
|
||||
*/
|
||||
Tt_status
|
||||
_tt_default_session_set(const char *sessid)
|
||||
{
|
||||
_Tt_string strsessid = (char *)0;
|
||||
_Tt_c_session_ptr sptr = new _Tt_c_session;
|
||||
Tt_status status;
|
||||
|
||||
// Add the P on if isn't already.
|
||||
_prepend_P_to_sessid(sessid, strsessid);
|
||||
|
||||
_tt_internal_init();
|
||||
|
||||
status = _tt_c_mp->find_session(strsessid, sptr, 1, 1);
|
||||
if (TT_OK != status) return status;
|
||||
|
||||
_tt_c_mp->default_c_session = sptr;
|
||||
return (TT_OK);
|
||||
}
|
||||
|
||||
#ifdef OPT_XTHREADS
|
||||
|
||||
/*
|
||||
* Returns the id of the default session for the current thread.
|
||||
* NOTE: We only get into this routine if multithreading has been
|
||||
* turned on via a call to tt_feature_required
|
||||
*/
|
||||
char *
|
||||
_tt_thread_session()
|
||||
{
|
||||
// Try to get the default session out of thread-specific storage
|
||||
_Tt_threadspecific* tss = (_Tt_threadspecific *) 0;
|
||||
xthread_get_specific(_tt_global->threadkey, (void **) &tss);
|
||||
if (!tss) {
|
||||
// thread-specific storage not yet initialized -- do it
|
||||
tss = new _Tt_threadspecific(_tt_c_mp->default_c_session,
|
||||
(_Tt_c_procid *) 0);
|
||||
xthread_set_specific(_tt_global->threadkey, tss);
|
||||
}
|
||||
|
||||
_Tt_c_session_ptr thread_session = tss->thread_c_session();
|
||||
|
||||
if (!thread_session.is_null()) {
|
||||
return _tt_strdup(thread_session->id());
|
||||
}
|
||||
|
||||
// XXX: Probably should never happen....
|
||||
if (_tt_c_mp->default_c_session.is_null()) {
|
||||
return (char *)_tt_error_pointer(TT_ERR_SESSION);
|
||||
}
|
||||
return _tt_strdup(_tt_c_mp->default_c_session->id());
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Sets the id of the default session for the current thread.
|
||||
* NOTE: We only get into this routine if multithreading has been
|
||||
* turned on via a call to tt_feature_required
|
||||
*/
|
||||
Tt_status
|
||||
_tt_thread_session_set(const char *sessid)
|
||||
{
|
||||
_Tt_string strsessid = (char *)0;
|
||||
_Tt_c_session_ptr sptr = new _Tt_c_session;
|
||||
Tt_status status;
|
||||
|
||||
// Add the P on if isn't already.
|
||||
_prepend_P_to_sessid(sessid, strsessid);
|
||||
|
||||
_tt_internal_init();
|
||||
|
||||
status = _tt_c_mp->find_session(strsessid, sptr, 1, 1);
|
||||
if (TT_OK != status) return status;
|
||||
|
||||
_Tt_threadspecific* tss = (_Tt_threadspecific *) 0;
|
||||
xthread_get_specific(_tt_global->threadkey, (void **) &tss);
|
||||
if (!tss) {
|
||||
// thread-specific storage not yet initialized -- do it
|
||||
tss = new _Tt_threadspecific(_tt_c_mp->default_c_session,
|
||||
(_Tt_c_procid *) 0);
|
||||
xthread_set_specific(_tt_global->threadkey, tss);
|
||||
}
|
||||
|
||||
tss->set_thread_c_session(sptr);
|
||||
return TT_OK;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Returns the id of the default procid
|
||||
*/
|
||||
char *
|
||||
_tt_default_procid()
|
||||
{
|
||||
return _tt_strdup(_tt_c_mp->default_c_procid()->id());
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Sets the id of the default procid
|
||||
*/
|
||||
Tt_status
|
||||
_tt_default_procid_set(const char *procid)
|
||||
{
|
||||
return _tt_c_mp->set_default_procid(procid);
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
_tt_procid_session(const char* procid)
|
||||
{
|
||||
char* retval;
|
||||
char* _sessid;
|
||||
_Tt_string sessid;
|
||||
|
||||
_Tt_procid_ptr p = _tt_c_mp->active_procs->lookup(procid);
|
||||
|
||||
if (p.is_null()) {
|
||||
retval = (char *) _tt_error_pointer(TT_ERR_PROCID);
|
||||
} else {
|
||||
_Tt_c_procid_ptr pp = (_Tt_c_procid *) p.c_pointer();
|
||||
_sessid = (char *) pp->default_session()->address_string();
|
||||
_prepend_P_to_sessid((const char *) _sessid, sessid);
|
||||
retval = (char *) sessid;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
#ifdef OPT_XTHREADS
|
||||
|
||||
/*
|
||||
* Returns the id of the default procid for the current thread
|
||||
* NOTE: We only get into this routine if multithreading has been
|
||||
* turned on via a call to tt_feature_required
|
||||
*/
|
||||
char *
|
||||
_tt_thread_procid()
|
||||
{
|
||||
_Tt_threadspecific* tss = (_Tt_threadspecific *) 0;
|
||||
xthread_get_specific(_tt_global->threadkey, (void **) &tss);
|
||||
if (!tss) {
|
||||
// thread-specific storage not yet initialized -- do it
|
||||
tss = new _Tt_threadspecific(_tt_c_mp->default_c_session,
|
||||
(_Tt_c_procid *) 0);
|
||||
xthread_set_specific(_tt_global->threadkey, tss);
|
||||
}
|
||||
|
||||
_Tt_c_procid_ptr c_procid = tss->thread_c_procid();
|
||||
|
||||
if (!c_procid.is_null()) {
|
||||
return _tt_strdup(c_procid->id());
|
||||
}
|
||||
else {
|
||||
return _tt_strdup(_tt_c_mp->default_c_procid()->id());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Sets the id of the default procid for the current thread
|
||||
* NOTE: We only get into this routine if multithreading has been
|
||||
* turned on via a call to tt_feature_required
|
||||
*/
|
||||
Tt_status
|
||||
_tt_thread_procid_set(const char *procid)
|
||||
{
|
||||
return _tt_c_mp->set_default_procid(procid, 1);
|
||||
}
|
||||
|
||||
Tt_status _tt_feature_enabled(Tt_feature f)
|
||||
{
|
||||
switch (f) {
|
||||
case _TT_FEATURE_MULTITHREADED:
|
||||
if (_tt_global->multithreaded()) {
|
||||
return TT_OK;
|
||||
}
|
||||
else {
|
||||
return TT_WRN_NOT_ENABLED;
|
||||
}
|
||||
default:
|
||||
return TT_ERR_UNIMP;
|
||||
}
|
||||
}
|
||||
|
||||
Tt_status _tt_feature_required(Tt_feature f)
|
||||
{
|
||||
_tt_internal_init();
|
||||
|
||||
// Note that since we are within an API call the global
|
||||
// mutex has been grabbed from within Tt_trace::entry
|
||||
|
||||
switch (f) {
|
||||
case _TT_FEATURE_MULTITHREADED:
|
||||
if (!_tt_global->multithreaded()) {
|
||||
if (!_tt_global->set_multithreaded()) {
|
||||
return TT_ERR_TOOLATE;
|
||||
}
|
||||
else {
|
||||
_tt_c_mp->set_multithreaded();
|
||||
}
|
||||
}
|
||||
return TT_OK;
|
||||
default:
|
||||
return TT_ERR_UNIMP;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* OPT_XTHREADS */
|
||||
24
cde/lib/tt/lib/api/c/api_error.C
Normal file
24
cde/lib/tt/lib/api/c/api_error.C
Normal file
@@ -0,0 +1,24 @@
|
||||
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
//%% (c) Copyright 1993, 1994 Novell, Inc.
|
||||
//%% $TOG: api_error.C /main/6 1999/10/14 18:39:14 mgreess $
|
||||
/*
|
||||
*
|
||||
* api_error.cc
|
||||
*
|
||||
* Copyright (c) 1993 by Sun Microsystems, Inc.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#include "api/c/api_error.h"
|
||||
|
||||
// Users can create a call with the same name as this, and through
|
||||
// the magic of linking they can be notified when this call is
|
||||
// invoked, having their function invoked instead. This call will
|
||||
// be invoked whenever an API call is about to return an error.
|
||||
//
|
||||
void tt_error(const char *, Tt_status)
|
||||
{
|
||||
}
|
||||
29
cde/lib/tt/lib/api/c/api_error.h
Normal file
29
cde/lib/tt/lib/api/c/api_error.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
|
||||
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
|
||||
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
|
||||
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
|
||||
/*%% $XConsortium: api_error.h /main/3 1995/10/23 09:52:10 rswiston $ */
|
||||
/* -*-C++-*-
|
||||
*
|
||||
* api_error.h
|
||||
*
|
||||
* Copyright (c) 1990 by Sun Microsystems, Inc.
|
||||
*
|
||||
* error mapping class for use between api and spec db
|
||||
*/
|
||||
#ifndef _API_ERROR_H
|
||||
#define _API_ERROR_H
|
||||
|
||||
#include "db/tt_db_results.h"
|
||||
#include "api/c/tt_c.h"
|
||||
|
||||
typedef enum api_module {_TT_API_SPEC, // tt_spec_ calls
|
||||
_TT_API_FILE, // tt_file_ calls
|
||||
_TT_API_FILE_MAP, // filename mapping API calls
|
||||
_TT_API_API, // unused currently
|
||||
_TT_API_UNDEF // unused currently
|
||||
} _Tt_api_context;
|
||||
|
||||
Tt_status _tt_get_api_error(_Tt_db_results db_result, _Tt_api_context context);
|
||||
|
||||
#endif // _API_ERROR_H
|
||||
441
cde/lib/tt/lib/api/c/api_file.C
Normal file
441
cde/lib/tt/lib/api/c/api_file.C
Normal file
@@ -0,0 +1,441 @@
|
||||
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
//%% (c) Copyright 1993, 1994 Novell, Inc.
|
||||
//%% $XConsortium: api_file.C /main/4 1995/11/21 19:36:59 cde-sun $
|
||||
/*
|
||||
*
|
||||
* api_file.cc
|
||||
*
|
||||
* Copyright (c) 1990 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#include "mp/mp_c.h"
|
||||
#include "api/c/tt_c.h"
|
||||
#include "api/c/api_api.h"
|
||||
#include "api/c/api_error.h"
|
||||
#include "api/c/api_mp.h"
|
||||
#include "api/c/api_handle.h"
|
||||
#include "db/tt_db_network_path.h"
|
||||
#include "util/tt_global_env.h"
|
||||
#include "util/tt_audit.h"
|
||||
|
||||
static Tt_filter_action _tt_filter_callback(Tt_filter_function fn,
|
||||
_Tt_string nodeid,
|
||||
void *context,
|
||||
void *accumulator);
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* File Functions (FSpec A.3) *
|
||||
************************************************************************/
|
||||
|
||||
Tt_status
|
||||
tt_file_join(const char *path)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("C", TT_FILE_JOIN, path);
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit(status);
|
||||
return status;
|
||||
}
|
||||
|
||||
status = _tt_file_join(path);
|
||||
|
||||
audit.exit(status);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
Tt_status
|
||||
tt_file_quit(const char *path)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("C", TT_FILE_QUIT, path);
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit(status);
|
||||
return status;
|
||||
}
|
||||
|
||||
status = _tt_file_quit(path);
|
||||
|
||||
audit.exit(status);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
Tt_status
|
||||
tt_file_destroy(const char *path)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("C", TT_FILE_DESTROY, path);
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit(status);
|
||||
return status;
|
||||
}
|
||||
|
||||
status = _tt_file_destroy(path);
|
||||
|
||||
audit.exit(status);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
Tt_status
|
||||
tt_file_move(const char *old_path, const char *new_path)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("CC", TT_FILE_MOVE, old_path,
|
||||
new_path);
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit(status);
|
||||
return status;
|
||||
}
|
||||
|
||||
status = _tt_file_move(old_path, new_path);
|
||||
|
||||
audit.exit(status);
|
||||
return status;
|
||||
}
|
||||
|
||||
Tt_status
|
||||
tt_file_copy(const char *old_path, const char *new_path)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("CC", TT_FILE_COPY, old_path,
|
||||
new_path);
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit(status);
|
||||
return status;
|
||||
}
|
||||
|
||||
status = _tt_file_copy(old_path, new_path);
|
||||
|
||||
audit.exit(status);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
Tt_status
|
||||
tt_file_objects_query(const char *path, Tt_filter_function filter, void *context,
|
||||
void *accumulator)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("CXAA", TT_FILE_OBJECTS_QUERY, path, filter,
|
||||
context, accumulator);
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit(status);
|
||||
return status;
|
||||
}
|
||||
|
||||
status = _tt_file_objects_query(path, filter, context, accumulator);
|
||||
|
||||
audit.exit(status);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Joins the given file. This causes the file to be the default file and,
|
||||
* if a session has been joined, modifies the file scope patterns to
|
||||
* include this file explicitly.
|
||||
*
|
||||
* Possible errors:
|
||||
* TT_ERR_NOMP
|
||||
* TT_ERR_DBAVAIL
|
||||
* TT_ERR_DBEXIST
|
||||
* TT_ERR_PATH
|
||||
* TT_ERR_POINTER
|
||||
*/
|
||||
Tt_status
|
||||
_tt_file_join(const char *path)
|
||||
{
|
||||
_Tt_c_file_ptr file;
|
||||
Tt_status status;
|
||||
_Tt_c_procid *d_procid = _tt_c_mp->default_c_procid().c_pointer();
|
||||
|
||||
status = _tt_mp->find_file( path, file, 1 );
|
||||
if (status != TT_OK) {
|
||||
return status;
|
||||
}
|
||||
if (file.is_null()) {
|
||||
return TT_ERR_INTERNAL;
|
||||
}
|
||||
status = file->c_join( _tt_c_mp->default_procid() );
|
||||
if (status == TT_OK) {
|
||||
d_procid->set_default_file(file->getNetworkPath());
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
/*
|
||||
* Quits the file named by filepath. Any currently registered patterns
|
||||
* with file scope have the file removed from their file values. If the
|
||||
* named file is the default file, the file default is nulled. Returns:
|
||||
* TT_ERR_POINTER
|
||||
* TT_ERR_FILE
|
||||
*/
|
||||
Tt_status
|
||||
_tt_file_quit(const char *path)
|
||||
{
|
||||
_Tt_c_file_ptr file;
|
||||
Tt_status status;
|
||||
_Tt_c_procid *d_procid = _tt_c_mp->default_c_procid().c_pointer();
|
||||
|
||||
|
||||
status = _tt_mp->find_file( path, file, 0 );
|
||||
if (status != TT_OK) {
|
||||
return status;
|
||||
}
|
||||
if (file.is_null()) {
|
||||
return TT_ERR_FILE;
|
||||
}
|
||||
status = file->c_quit( _tt_c_mp->default_procid() );
|
||||
if (status == TT_OK) {
|
||||
if ( d_procid->default_file()
|
||||
== file->getNetworkPath())
|
||||
{
|
||||
_Tt_string null;
|
||||
d_procid->set_default_file( null );
|
||||
}
|
||||
}
|
||||
return(status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Tells TT the filetree rooted at filepath is gone.
|
||||
* All specs of objects in the filetree are destroyed.
|
||||
*
|
||||
* Possible errors:
|
||||
* TT_ERR_NOMP
|
||||
* TT_ERR_DBAVAIL
|
||||
* TT_ERR_DBEXIST
|
||||
* TT_ERR_ACCESS
|
||||
* TT_ERR_FILE
|
||||
* TT_ERR_POINTER
|
||||
* TT_ERR_PATH
|
||||
*/
|
||||
Tt_status
|
||||
_tt_file_destroy(const char *path)
|
||||
{
|
||||
_Tt_file_ptr file;
|
||||
Tt_status status;
|
||||
|
||||
status = _tt_mp->find_file( path, file, 1 );
|
||||
if (status != TT_OK) {
|
||||
return status;
|
||||
}
|
||||
if (file.is_null()) {
|
||||
return TT_ERR_INTERNAL;
|
||||
}
|
||||
_Tt_db_results dberr = file->remove();
|
||||
switch (dberr) { // XXX
|
||||
case TT_DB_OK:
|
||||
status = TT_OK;
|
||||
break;
|
||||
case TT_DB_ERR_DB_CONNECTION_FAILED:
|
||||
status = TT_ERR_DBEXIST;
|
||||
break;
|
||||
case TT_DB_ERR_RPC_CONNECTION_FAILED:
|
||||
status = TT_ERR_DBAVAIL;
|
||||
break;
|
||||
case TT_DB_ERR_ACCESS_DENIED:
|
||||
status = TT_ERR_ACCESS;
|
||||
break;
|
||||
default:
|
||||
status = TT_ERR_INTERNAL;
|
||||
break;
|
||||
}
|
||||
|
||||
if (status == TT_OK) {
|
||||
_tt_mp->remove_file(path);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Tells TT the filetree rooted at filepath has been moved.
|
||||
* All specs of objects in the filetree are moved.
|
||||
* Destroys the objects in the destination filetree,
|
||||
* since a spec-merging facility would be dangerous to use,
|
||||
* and no fun to write.
|
||||
*/
|
||||
Tt_status
|
||||
_tt_file_move(const char *oldPath, const char *newPath)
|
||||
{
|
||||
_Tt_file_ptr file;
|
||||
|
||||
Tt_status status = _tt_file_destroy( newPath );
|
||||
if (tt_is_err( status )) {
|
||||
return status;
|
||||
}
|
||||
|
||||
status = _tt_mp->find_file( oldPath, file, 1 );
|
||||
if (status != TT_OK) {
|
||||
return status;
|
||||
}
|
||||
_Tt_db_results dberr = file->move( newPath );
|
||||
switch (dberr) { // XXX
|
||||
case TT_DB_OK:
|
||||
status = TT_OK;
|
||||
break;
|
||||
case TT_DB_ERR_DB_CONNECTION_FAILED:
|
||||
status = TT_ERR_DBEXIST;
|
||||
break;
|
||||
case TT_DB_ERR_RPC_CONNECTION_FAILED:
|
||||
status = TT_ERR_DBAVAIL;
|
||||
break;
|
||||
case TT_DB_ERR_ACCESS_DENIED:
|
||||
status = TT_ERR_ACCESS;
|
||||
break;
|
||||
default:
|
||||
status = TT_ERR_INTERNAL;
|
||||
break;
|
||||
}
|
||||
|
||||
if (status == TT_OK) {
|
||||
_tt_mp->remove_file(oldPath);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/*
|
||||
* Tells TT the file named by filepath has been copied.
|
||||
* All specs of objects in the file are copied.
|
||||
*/
|
||||
Tt_status
|
||||
_tt_file_copy(const char *oldPath, const char *newPath)
|
||||
{
|
||||
_Tt_file_ptr file;
|
||||
Tt_status status;
|
||||
|
||||
status = _tt_mp->find_file( oldPath, file, 1 );
|
||||
if (status != TT_OK) {
|
||||
return status;
|
||||
}
|
||||
if (file.is_null()) {
|
||||
return TT_ERR_INTERNAL;
|
||||
}
|
||||
_Tt_db_results dberr = file->copy( newPath );
|
||||
switch (dberr) { // XXX
|
||||
case TT_DB_OK:
|
||||
status = TT_OK;
|
||||
break;
|
||||
case TT_DB_ERR_DB_CONNECTION_FAILED:
|
||||
status = TT_ERR_DBEXIST;
|
||||
break;
|
||||
case TT_DB_ERR_RPC_CONNECTION_FAILED:
|
||||
status = TT_ERR_DBAVAIL;
|
||||
break;
|
||||
case TT_DB_ERR_ACCESS_DENIED:
|
||||
status = TT_ERR_ACCESS;
|
||||
break;
|
||||
default:
|
||||
status = TT_ERR_INTERNAL;
|
||||
break;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
/*
|
||||
* Invokes filter on all the nodes contained in filepath until all the
|
||||
* nodes have been visited or filter returns "TT_FILTER_STOP". `context'
|
||||
* and `accumulator' can be used to pass in context information to the
|
||||
* filter and accumulate results.
|
||||
*/
|
||||
Tt_status
|
||||
_tt_file_objects_query(const char *path, Tt_filter_function filter, void *context,
|
||||
void *accumulator)
|
||||
{
|
||||
_Tt_file_ptr file;
|
||||
Tt_status status;
|
||||
|
||||
status = _tt_mp->find_file( path, file, 1 );
|
||||
if (status != TT_OK) {
|
||||
return status;
|
||||
}
|
||||
status = file->query( _tt_filter_callback, filter, context,
|
||||
accumulator );
|
||||
return status;
|
||||
}
|
||||
|
||||
Tt_filter_action
|
||||
_tt_filter_callback(Tt_filter_function fn, _Tt_string nodeid, void *context,
|
||||
void *accumulator)
|
||||
{
|
||||
//
|
||||
// The spec says that the char * we pass to the filter
|
||||
// function is only valid for a given invocation of the filter
|
||||
// function. Using a _tt_strdup()'d string delivers on this
|
||||
// guarantee.
|
||||
//
|
||||
char *temp_nodeid = _tt_strdup(nodeid);
|
||||
Tt_filter_action ret_val = (*fn)( temp_nodeid, context, accumulator );
|
||||
_tt_free( temp_nodeid );
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
// Temporary function so mailtool can do better diagnosis in S493.
|
||||
// Return the host on which the server for the file is.
|
||||
// See bug 1113489.
|
||||
|
||||
extern "C" {
|
||||
Tt_status _ttds_file_server(const char *filename, char **hostname);
|
||||
}
|
||||
|
||||
Tt_status
|
||||
_ttds_file_server(const char *filename, char **hostname)
|
||||
{
|
||||
_Tt_c_file_ptr file;
|
||||
_Tt_db_results dbresults;
|
||||
Tt_status status;
|
||||
_Tt_string filename_s;
|
||||
_Tt_string local_path;
|
||||
_Tt_string hostname_s;
|
||||
_Tt_string partition;
|
||||
_Tt_string network_path;
|
||||
|
||||
*hostname = "";
|
||||
if (filename==0 || hostname==0) {
|
||||
return TT_ERR_POINTER;
|
||||
}
|
||||
filename_s = filename;
|
||||
|
||||
dbresults = _tt_db_network_path(filename_s,
|
||||
local_path,
|
||||
hostname_s,
|
||||
partition,
|
||||
network_path);
|
||||
|
||||
// if this file\'s db has been redirected, it\'s the redirected
|
||||
// host, where the dbserver is, which is interesting to the caller.
|
||||
|
||||
_Tt_string temp_hostname = _tt_global->db_hr_map.findEntry(hostname_s);
|
||||
if (!temp_hostname.is_null() && 0<temp_hostname.len()) {
|
||||
hostname_s = temp_hostname;
|
||||
}
|
||||
*hostname = _tt_strdup((const char *)hostname_s);
|
||||
// Currently _tt_get_api_error translates
|
||||
// TT_DB_ERR_DB_CONNECTION_FAILED into TT_ERR_DBAVAIL.
|
||||
// This is wrong, at least in the common case of rpc program
|
||||
// not registered, which should be TT_ERR_DBEXIST.
|
||||
// Probably the clnt_create for db connections ought to be
|
||||
// doing more analysis of the clnt_create results.
|
||||
if (dbresults==TT_DB_ERR_DB_CONNECTION_FAILED) {
|
||||
status = TT_ERR_DBEXIST;
|
||||
} else {
|
||||
status = _tt_get_api_error(dbresults, _TT_API_FILE);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
546
cde/lib/tt/lib/api/c/api_filemap.C
Normal file
546
cde/lib/tt/lib/api/c/api_filemap.C
Normal file
@@ -0,0 +1,546 @@
|
||||
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
//%% (c) Copyright 1993, 1994 Novell, Inc.
|
||||
//%% $XConsortium: api_filemap.C /main/3 1995/10/23 09:52:27 rswiston $
|
||||
|
||||
/*
|
||||
*
|
||||
* @(#)api_filemap.C 1.21 95/02/21
|
||||
*
|
||||
* Copyright (c) 1990, 1993 by Sun Microsystems, Inc.
|
||||
*
|
||||
* THis file implements the api filename mapping calls to map to/from
|
||||
* canonical name formats of the form hostname:pathname to an
|
||||
* absolute pathname of the form /pathname.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/param.h>
|
||||
#include "api/c/api_filemap.h"
|
||||
#include "db/tt_db_file.h"
|
||||
#include "mp/mp_c.h"
|
||||
#include "util/tt_path.h"
|
||||
#include "api/c/tt_c.h"
|
||||
#include "api/c/api_api.h"
|
||||
#include "api/c/api_mp.h"
|
||||
#include "api/c/api_error.h"
|
||||
#include "util/tt_audit.h"
|
||||
#include "util/tt_port.h"
|
||||
#include "util/tt_host_equiv.h"
|
||||
|
||||
// "magic" (in the /etc/magic sense) prefix for netfile strings
|
||||
#define TT_NETFILE_PREFIX "TTN0"
|
||||
|
||||
// Include COMPATIBILITY code for earlier CDE snapshots
|
||||
|
||||
#define CDE_SNAPSHOT_COMPATIBILITY 1
|
||||
|
||||
char * _tt_host_file_netfile(const char * host, const char * filename);
|
||||
char * _tt_host_netfile_file(const char * host, const char * netfilename);
|
||||
char * _tt_file_netfile(const char * filename);
|
||||
char * _tt_netfile_file(const char * netfilename);
|
||||
static int get_keyword_value(_Tt_string s, const char * keyword,
|
||||
int &start, int &end);
|
||||
|
||||
/******************************************************************/
|
||||
/* filename mapping API calls implementation. */
|
||||
/******************************************************************/
|
||||
|
||||
// On the specified host, assemble a netfilename for the specified filename.
|
||||
char *
|
||||
tt_host_file_netfile(const char * host, const char * filename)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("CC", TT_HOST_FILE_NETFILE, host, filename);
|
||||
char *result;
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit((char *)_tt_error_pointer(status));
|
||||
return (char *)_tt_error_pointer(status);
|
||||
}
|
||||
|
||||
result = _tt_host_file_netfile(host, filename);
|
||||
audit.exit(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// On the specified host, create a filename for the specified netfilename.
|
||||
char *
|
||||
tt_host_netfile_file(const char * host, const char * netfilename)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("CC", TT_HOST_NETFILE_FILE, host, netfilename);
|
||||
char *result;
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit((char *)_tt_error_pointer(status));
|
||||
return (char *)_tt_error_pointer(status);
|
||||
}
|
||||
|
||||
result = _tt_host_netfile_file(host, netfilename);
|
||||
audit.exit(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// On the local host, create a netfilename for the specified filename.
|
||||
char *
|
||||
tt_file_netfile(const char *filename)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("C", TT_FILE_NETFILE, filename);
|
||||
char *result;
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit((char *)_tt_error_pointer(status));
|
||||
return (char *)_tt_error_pointer(status);
|
||||
}
|
||||
|
||||
result = _tt_file_netfile(filename);
|
||||
audit.exit(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// On the local host, create a filename for the specified netfilename.
|
||||
char *
|
||||
tt_netfile_file(const char *netfilename)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("C", TT_NETFILE_FILE, netfilename);
|
||||
char *result;
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit((char *)_tt_error_pointer(status));
|
||||
return (char *)_tt_error_pointer(status);
|
||||
}
|
||||
|
||||
result = _tt_netfile_file(netfilename);
|
||||
audit.exit(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// Do the following:
|
||||
//
|
||||
// 1) Make RPC call to remote host, and on that
|
||||
// host run tt_file_netfile(filename).
|
||||
//
|
||||
// 2) Return the result here.
|
||||
char *
|
||||
_tt_host_file_netfile(const char * host, const char * filename)
|
||||
{
|
||||
Tt_status status;
|
||||
_Tt_string hostname(host);
|
||||
_Tt_string local_host = _tt_gethostname();
|
||||
|
||||
_tt_internal_init();
|
||||
|
||||
// If this is an RPC call to our localhost, do
|
||||
// it directly and don't bother with RPC.
|
||||
|
||||
_Tt_host_equiv_ptr eq_p = new _Tt_host_equiv;
|
||||
|
||||
if (eq_p->hostname_equiv(hostname, local_host) == 1) {
|
||||
#ifdef notdef
|
||||
printf("DEBUG _tt_host_file_netfile: resolving locally.\n");
|
||||
#endif
|
||||
|
||||
// strdup already done in _tt_netfile_file()
|
||||
return _tt_file_netfile(filename);
|
||||
}
|
||||
|
||||
_Tt_string path(filename);
|
||||
_Tt_string netfile;
|
||||
|
||||
// Connect to dbserver on remote host.
|
||||
_Tt_db_results db_status;
|
||||
_Tt_db_client_ptr h_dbserv = new _Tt_db_client(hostname, db_status);
|
||||
|
||||
// run _tt_file_netfile() on the remote host.
|
||||
if ((status = _tt_get_api_error(h_dbserv->getConnectionResults(),
|
||||
_TT_API_FILE_MAP)) == TT_OK) {
|
||||
|
||||
status = _tt_get_api_error(h_dbserv->file_netfile(path, netfile),
|
||||
_TT_API_FILE_MAP);
|
||||
}
|
||||
|
||||
if (status != TT_OK) {
|
||||
return (char *)_tt_error_pointer(status);
|
||||
}
|
||||
|
||||
#if CDE_SNAPSHOT_COMPATIBILITY
|
||||
// For compatibility with development snapshots of CDE,
|
||||
// if the returned netfile does not start with TT_NETFILE_PREFIX,
|
||||
// put it on.
|
||||
|
||||
if (netfile.left(strlen(TT_NETFILE_PREFIX)) != TT_NETFILE_PREFIX) {
|
||||
path = netfile;
|
||||
netfile = TT_NETFILE_PREFIX;
|
||||
netfile = netfile.cat(path);
|
||||
}
|
||||
#endif /* CDE_SNAPSHOT_COMPATIBILITY */
|
||||
|
||||
return _tt_strdup((char *) netfile);
|
||||
}
|
||||
|
||||
|
||||
// Do the following:
|
||||
//
|
||||
// 1) Make RPC call to remote host, and on that
|
||||
// host run tt_netfile_file(netfilename).
|
||||
//
|
||||
// 2) Return the result here.
|
||||
char *
|
||||
_tt_host_netfile_file(const char * host, const char * netfilename)
|
||||
{
|
||||
Tt_status status;
|
||||
_Tt_string hostname(host);
|
||||
_Tt_string local_host = _tt_gethostname();
|
||||
|
||||
_tt_internal_init();
|
||||
|
||||
// If this is an RPC call to our localhost, do
|
||||
// it directly and don't bother with RPC.
|
||||
|
||||
_Tt_host_equiv_ptr eq_p = new _Tt_host_equiv;
|
||||
|
||||
if (eq_p->hostname_equiv(hostname, local_host) == 1) {
|
||||
#ifdef notdef
|
||||
printf("DEBUG _tt_host_netfile_file: resolving locally.\n");
|
||||
#endif
|
||||
|
||||
// strdup already done in _tt_netfile_file()
|
||||
return _tt_netfile_file(netfilename);
|
||||
}
|
||||
|
||||
#ifdef __osf__
|
||||
// hostname and localhost were not the same, so make one more check
|
||||
// of the environment variable created by /usr/dt/bin/Xsession. If
|
||||
// we have started the system without a network configured, this will
|
||||
// be true during an initial system installation.
|
||||
|
||||
if (getenv("DTNONETWORK")) {
|
||||
// strdup already done in _tt_netfile_file()
|
||||
return _tt_file_netfile(netfilename);
|
||||
}
|
||||
|
||||
#endif /* __osf__ */
|
||||
|
||||
_Tt_string path(netfilename);
|
||||
_Tt_string file;
|
||||
|
||||
|
||||
// Connect to dbserver on remote host.
|
||||
_Tt_db_results db_status;
|
||||
_Tt_db_client_ptr h_dbserv = new _Tt_db_client(hostname, db_status);
|
||||
|
||||
// run _tt_netfile_file() on the remote host.
|
||||
if ((status = _tt_get_api_error(h_dbserv->getConnectionResults(),
|
||||
_TT_API_FILE_MAP)) != TT_OK) {
|
||||
status = status == TT_ERR_PATH ? TT_ERR_NETFILE : status;
|
||||
return (char *)_tt_error_pointer(status);
|
||||
}
|
||||
|
||||
if ((status = _tt_get_api_error(h_dbserv->netfile_file(path, file),
|
||||
_TT_API_FILE_MAP)) == TT_OK) {
|
||||
return _tt_strdup((char *) file);
|
||||
}
|
||||
|
||||
#if CDE_SNAPSHOT_COMPATIBILITY
|
||||
// Mapping failed. It's just possible that it's a dbserver from
|
||||
// an earlier development snapshot which doesn't understand
|
||||
// netfiles with TT_NETFILE_PREFIX in front of them.
|
||||
|
||||
|
||||
if (path.left(strlen(TT_NETFILE_PREFIX)) == TT_NETFILE_PREFIX) {
|
||||
path = path.right(path.len()-strlen(TT_NETFILE_PREFIX));
|
||||
|
||||
if ((status = _tt_get_api_error(h_dbserv->netfile_file(path, file),
|
||||
_TT_API_FILE_MAP)) == TT_OK) {
|
||||
return _tt_strdup((char *) file);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CDE_SNAPSHOT_COMPATIBILITY */
|
||||
|
||||
status = status == TT_ERR_PATH ? TT_ERR_NETFILE : status;
|
||||
return (char *)_tt_error_pointer(status);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// given a filename in a valid file path format,
|
||||
// i.e. /a/b/..., return a string in the canonical
|
||||
// format of hostname:/x/y/....
|
||||
//
|
||||
char *
|
||||
_tt_file_netfile(const char *filename)
|
||||
{
|
||||
_Tt_string path(filename);
|
||||
|
||||
_tt_internal_init();
|
||||
|
||||
// Create the canonical filename.
|
||||
_Tt_api_filename_map_ptr mapp = new _Tt_api_filename_map;
|
||||
return _tt_strdup(mapp->set_filename(path));
|
||||
}
|
||||
|
||||
|
||||
// given a filename in the canonical format, i.e.
|
||||
// hostname:/x/y/.... return a string in the local
|
||||
// file path format, i.e. /a/b/...
|
||||
//
|
||||
char *
|
||||
_tt_netfile_file(const char *netfilename)
|
||||
{
|
||||
_Tt_string network_path(netfilename), result;
|
||||
_Tt_api_filename_map_ptr original_mapp = new _Tt_api_filename_map;
|
||||
_Tt_api_filename_map_ptr new_mapp = new _Tt_api_filename_map;
|
||||
|
||||
_tt_internal_init();
|
||||
|
||||
// We want to turn the rpath into a local path. We'd prefer
|
||||
// to use the same local path the creator of the netfile used,
|
||||
// if that works and means the same file. We do this by a two
|
||||
// step process:
|
||||
//
|
||||
// 1) generate a new rpath based on the original lpath.
|
||||
// If the new rpath == the original rpath, use the
|
||||
// original lpath.
|
||||
//
|
||||
// 2) If the new rpath isn't the same, then turn
|
||||
// the original rpath into a lpath by trudging through
|
||||
// the mount tables.
|
||||
|
||||
// parse the canonical filename into its' component parts.
|
||||
result = original_mapp->parse_netfilename(network_path);
|
||||
if (result.len() == 0) {
|
||||
return (char *)_tt_error_pointer(TT_ERR_NETFILE);
|
||||
}
|
||||
|
||||
// Do step 1 above: generate new rpath from old lpath.
|
||||
new_mapp->set_filename(original_mapp->lpath_val());
|
||||
|
||||
_Tt_string host = new_mapp->hostname_val();
|
||||
_Tt_string rpath = new_mapp->rpath_val();
|
||||
_Tt_string lpath = new_mapp->lpath_val();
|
||||
|
||||
// compare the new rpath with the old rpath.
|
||||
if (host == original_mapp->hostname_val()) {
|
||||
if (rpath == original_mapp->rpath_val()) {
|
||||
return _tt_strdup(original_mapp->lpath_val());
|
||||
}
|
||||
}
|
||||
|
||||
// Do step 2 above: convert the original rpath to a local path.
|
||||
result = _tt_network_path_to_local_path(original_mapp->hostname_val().cat(':').cat(original_mapp->rpath_val()));
|
||||
|
||||
return _tt_strdup(result);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************/
|
||||
/* _Tt_api_filename_map class implementation below. */
|
||||
/******************************************************************/
|
||||
|
||||
// A canonical pathname is of the following form:
|
||||
// "HOST=0-x,RPATH=x-y,LPATH=y-z:HostnameLpathRpath", where
|
||||
// x, y, and z are ASCII representations of the number
|
||||
// which is the position within the character array where
|
||||
// the concatenated strings begin and end.
|
||||
|
||||
// "pathname" should be an absolute or relative pathname.
|
||||
_Tt_string _Tt_api_filename_map::
|
||||
set_filename(const _Tt_string & filename)
|
||||
{
|
||||
_Tt_string absolute_path = filename;
|
||||
_Tt_string tmp_string(MAXPATHLEN * 3);
|
||||
int i;
|
||||
|
||||
if (filename[0] != '/') {
|
||||
// A relative path, make it absolute.
|
||||
char wd[MAXPATHLEN+1];
|
||||
|
||||
if (getcwd(wd, sizeof(wd))) {
|
||||
absolute_path = _Tt_string(wd).cat("/").cat(filename);
|
||||
}
|
||||
}
|
||||
|
||||
// Now get the network path of the file.
|
||||
tmp_string = _tt_local_network_path(absolute_path);
|
||||
|
||||
#ifdef notdef
|
||||
printf("DEBUG set_filename: _tt_local_network_path(%s) returned %s\n",
|
||||
(char *) absolute_path, (char *) tmp_string);
|
||||
#endif
|
||||
|
||||
_lpath = absolute_path; // what we know the file as.
|
||||
|
||||
// load hostname and rpath simultaneously
|
||||
_rpath = tmp_string.split(':', _hostname);
|
||||
|
||||
// construct a canonical pathname
|
||||
_canonical_path = TT_NETFILE_PREFIX;
|
||||
_canonical_path = _canonical_path.cat("HOST=0-").cat(_hostname.len() - 1).cat(',');
|
||||
i = _hostname.len();
|
||||
|
||||
_canonical_path =
|
||||
_canonical_path.cat("RPATH=").cat(i).cat('-').cat(i + _rpath.len() - 1).cat(',');
|
||||
i += _rpath.len();
|
||||
|
||||
_canonical_path =
|
||||
_canonical_path.cat("LPATH=").cat(i).cat('-').cat(i + _lpath.len() - 1).cat(':');
|
||||
|
||||
_canonical_path = _canonical_path.cat(_hostname).cat(_rpath).cat(_lpath);
|
||||
|
||||
#ifdef notdef
|
||||
printf("DEBUG set_filename: _canonical_path == %s\n", (char *) _canonical_path);
|
||||
#endif
|
||||
|
||||
return _canonical_path;
|
||||
}
|
||||
|
||||
|
||||
// "canonical_name" is of the format
|
||||
// "TTN0HOST=0-x,RPATH=x-y,LPATH=y-z:HostnameLpathRpath" as described above
|
||||
// If not, parse_netfilename returns (_Tt_string)0.
|
||||
_Tt_string _Tt_api_filename_map::
|
||||
parse_netfilename(const _Tt_string & canonical_name)
|
||||
{
|
||||
_Tt_string tmp_string, dummy;
|
||||
int i, h_begin, h_end, l_begin, l_end, r_begin, r_end;
|
||||
|
||||
// parse the canonical_path.
|
||||
|
||||
// It's important to do this in a way that is independent of the
|
||||
// order of the keywords, and which ignores any extraneous keywords
|
||||
// which may be introduced later.
|
||||
|
||||
// A canonical name should start with TT_NETFILE_PREFIX ("TTN0"),
|
||||
// which we ignore. However if CDE_SNAPSHOT_COMPATIBILITY is 1, and
|
||||
// it starts with HOST= it's from
|
||||
// a slightly older version of the code, and we accept that too.
|
||||
|
||||
i = strlen(TT_NETFILE_PREFIX);
|
||||
if (canonical_name.left(i) == TT_NETFILE_PREFIX) {
|
||||
tmp_string = canonical_name.mid(i, canonical_name.len()-i);
|
||||
#if CDE_SNAPSHOT_COMPATIBILITY
|
||||
} else if (canonical_name.left(5) == "HOST=") {
|
||||
tmp_string = canonical_name;
|
||||
#endif /* CDE_SNAPSHOT_COMPATIBILITY */
|
||||
} else {
|
||||
return (_Tt_string) 0;
|
||||
}
|
||||
|
||||
// All the keyword stuff is before the colon.
|
||||
|
||||
tmp_string.split(':',tmp_string);
|
||||
|
||||
if (!(get_keyword_value(tmp_string, "HOST", h_begin, h_end) &&
|
||||
get_keyword_value(tmp_string, "RPATH", r_begin, r_end) &&
|
||||
get_keyword_value(tmp_string, "LPATH", l_begin, l_end)))
|
||||
{
|
||||
return (_Tt_string)0;
|
||||
}
|
||||
|
||||
|
||||
// get the raw data in the canonical_path, and parse out
|
||||
// the components
|
||||
|
||||
_canonical_path = canonical_name;
|
||||
|
||||
#ifdef notdef
|
||||
printf("DEBUG parse_netfilename: _canonical_path == %s\n", (char *) _canonical_path);
|
||||
#endif
|
||||
|
||||
tmp_string = _canonical_path.split(':', dummy);
|
||||
|
||||
_hostname = tmp_string.mid(h_begin, h_end - h_begin + 1);
|
||||
|
||||
_rpath = tmp_string.mid(r_begin, r_end - r_begin + 1);
|
||||
|
||||
#ifdef notdef
|
||||
printf("DEBUG parse_netfilename: _rpath == %s\n", (char *) _rpath);
|
||||
#endif
|
||||
|
||||
_lpath = tmp_string.mid(l_begin, l_end - l_begin + 1);
|
||||
|
||||
#ifdef notdef
|
||||
printf("DEBUG parse_netfilename: _lpath == %s\n", (char *) _lpath);
|
||||
#endif
|
||||
|
||||
|
||||
return _canonical_path;
|
||||
}
|
||||
|
||||
|
||||
_Tt_string _Tt_api_filename_map::
|
||||
canonical_path_val()
|
||||
{
|
||||
return _canonical_path;
|
||||
}
|
||||
|
||||
_Tt_string _Tt_api_filename_map::
|
||||
lpath_val()
|
||||
{
|
||||
return _lpath;
|
||||
}
|
||||
|
||||
_Tt_string _Tt_api_filename_map::
|
||||
rpath_val()
|
||||
{
|
||||
return _rpath;
|
||||
}
|
||||
|
||||
_Tt_string _Tt_api_filename_map::
|
||||
hostname_val()
|
||||
{
|
||||
return _hostname;
|
||||
}
|
||||
|
||||
|
||||
// Find a keyword in the netfile prefix and return the associated start and
|
||||
// end byte offsets. If the keyword is not found, or the string is badly
|
||||
// formed, return 0. Else, if the parsing succeeds, return 1.
|
||||
// The TT_NETFILE_PREFIX and everything from the colon on are assumed
|
||||
// to already be lopped off s.
|
||||
|
||||
static int
|
||||
get_keyword_value(_Tt_string s, const char *keyword, int &start, int &end)
|
||||
{
|
||||
// It makes the parsing more uniform if we can always expect to
|
||||
// find the keyword preceded by a comma, which is true for all
|
||||
// but the first keyword. So put a comma on the front, and it
|
||||
// will be true for all keywords. Similarly, put a comma
|
||||
// in front of the keyword and an equals sign after it.
|
||||
// Similarly, add a comma at the end of s so even the last
|
||||
// keyword is terminated by one.
|
||||
|
||||
_Tt_string ts = ",";
|
||||
_Tt_string tk = ",";
|
||||
_Tt_string junk;
|
||||
int i;
|
||||
|
||||
ts = ts.cat(s).cat(",");
|
||||
tk = tk.cat(keyword).cat("=");
|
||||
|
||||
if (-1==(i=ts.index(tk))) {
|
||||
return 0;
|
||||
}
|
||||
// lop off extraneous stuff before the keyword
|
||||
ts = ts.mid(i,ts.len()-i);
|
||||
// lop off the keyword
|
||||
ts = ts.split('=',junk);
|
||||
// lop off extraneous stuff after the comma that terminates
|
||||
// this keyword
|
||||
ts.split(',',junk);
|
||||
i = sscanf((char *)ts, "%d-%d", &start, &end);
|
||||
return (i==2);
|
||||
}
|
||||
61
cde/lib/tt/lib/api/c/api_filemap.h
Normal file
61
cde/lib/tt/lib/api/c/api_filemap.h
Normal file
@@ -0,0 +1,61 @@
|
||||
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
|
||||
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
|
||||
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
|
||||
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
|
||||
/*%% $XConsortium: api_filemap.h /main/3 1995/10/23 09:52:36 rswiston $ */
|
||||
|
||||
/*
|
||||
*
|
||||
* @(#)api_filemap.h 1.5 94/11/17
|
||||
*
|
||||
* Copyright (c) 1990, 1993 by Sun Microsystems, Inc.
|
||||
*
|
||||
* This file implements the api filename mapping calls to map from
|
||||
* an absolute pathname of the form /pathname to canonical names
|
||||
* of the format hostname:/pathname.
|
||||
*/
|
||||
#ifndef _TT_API_FILEMAP_H
|
||||
#define _TT_API_FILEMAP_H
|
||||
|
||||
#include "api/c/tt_c.h"
|
||||
#include "util/tt_string.h"
|
||||
|
||||
class _Tt_api_filename_map : public _Tt_object {
|
||||
public:
|
||||
_Tt_api_filename_map() { };
|
||||
~_Tt_api_filename_map() { };
|
||||
|
||||
_Tt_string set_filename(const _Tt_string & filename);
|
||||
|
||||
_Tt_string parse_netfilename(const _Tt_string & netfilename);
|
||||
|
||||
_Tt_string canonical_path_val();
|
||||
|
||||
_Tt_string lpath_val();
|
||||
|
||||
_Tt_string rpath_val();
|
||||
|
||||
_Tt_string hostname_val();
|
||||
|
||||
|
||||
private:
|
||||
// local name of the file by the
|
||||
// machine that hosts it.
|
||||
_Tt_string _canonical_path;
|
||||
|
||||
// local name of the file by the
|
||||
// machine that hosts it.
|
||||
_Tt_string _lpath;
|
||||
|
||||
// exported name of the file by the
|
||||
// machine that hosts it.
|
||||
_Tt_string _rpath;
|
||||
|
||||
// name of the host which exports
|
||||
// the file.
|
||||
_Tt_string _hostname;
|
||||
};
|
||||
|
||||
declare_ptr_to(_Tt_api_filename_map)
|
||||
|
||||
#endif /* _TT_API_FILEMAP_H */
|
||||
617
cde/lib/tt/lib/api/c/api_handle.C
Normal file
617
cde/lib/tt/lib/api/c/api_handle.C
Normal file
@@ -0,0 +1,617 @@
|
||||
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
//%% (c) Copyright 1993, 1994 Novell, Inc.
|
||||
//%% $XConsortium: api_handle.C /main/6 1995/12/08 12:02:32 drk $
|
||||
/*
|
||||
*
|
||||
* api_handle.cc
|
||||
*
|
||||
* Copyright (c) 1990 by Sun Microsystems, Inc.
|
||||
*
|
||||
* Handle functions. Messages and patterns are passed over the
|
||||
* API layer by referring to "opaque handles". These opaque
|
||||
* handles are, abstractly, indexes into a list of "real"
|
||||
* _Tt_message_ptr and _Tt_pattern_ptr values.
|
||||
*/
|
||||
|
||||
#include "mp/mp_c.h"
|
||||
#include "api/c/api_api.h"
|
||||
#include "api/c/api_mp.h"
|
||||
#include "api/c/api_handle.h"
|
||||
#include "util/tt_trace.h"
|
||||
#include "util/tt_global_env.h"
|
||||
|
||||
/*
|
||||
* construct a new _Tt_api_handle_table. This is only done once per
|
||||
* process, when tt_open() is called.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
_Tt_api_handle_table::
|
||||
_Tt_api_handle_table()
|
||||
{
|
||||
content = new _Tt_api_handle_list;
|
||||
}
|
||||
|
||||
/*
|
||||
* Look up a _Tt_c_message given its API handle. Since the handle is
|
||||
* really the address of the _Tt_api_handle instance for the message,
|
||||
* this is quick, but obscure.
|
||||
*
|
||||
* Performance note: since the TT API encourages a style where
|
||||
* clusters of calls naming the same message handle appear, it's
|
||||
* actually fairly important to make this fast. In particular note
|
||||
* that we just cast to the C pointer (_Tt_api_handle *) instead
|
||||
* of constructing and destructing a _Tt_api_handle_ptr.
|
||||
*/
|
||||
_Tt_c_message_ptr _Tt_api_handle_table::
|
||||
lookup_msg(Tt_message h)
|
||||
{
|
||||
if ((Tt_message)0 == h) {
|
||||
return 0;
|
||||
} else {
|
||||
return ((_Tt_api_handle *)h)->mptr();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Look up a _Tt_pattern given its API handle. Since the handle is
|
||||
* really the address of the _Tt_api_handle instance for the pattern,
|
||||
* this is quick, but obscure.
|
||||
* See lookup_msg for a performance note.
|
||||
*/
|
||||
_Tt_pattern_ptr _Tt_api_handle_table::
|
||||
lookup_pat(Tt_pattern h)
|
||||
{
|
||||
if ((Tt_pattern)0 == h) {
|
||||
return 0;
|
||||
} else {
|
||||
return ((_Tt_api_handle *)h)->pptr();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Look up a _Tt_pattern given its pattern id.
|
||||
* Performance note: surprisingly, this is one of the bigger resource
|
||||
* consumers in a receive. Just to make simple benchmarks run better,
|
||||
* we cache the last one found so we can skip constructing the
|
||||
* cursor, etc. Also it turns out that the first thing the caller of
|
||||
* lookup_pat_by_id does is turn around and look for the handle, so
|
||||
* cache and return that too.
|
||||
*/
|
||||
_Tt_pattern_ptr _Tt_api_handle_table::
|
||||
lookup_pat_by_id(_Tt_string pat_id, Tt_pattern &phandle)
|
||||
{
|
||||
if (last_pat_id == pat_id) {
|
||||
phandle = last_phandle;
|
||||
return last_pattern;
|
||||
}
|
||||
|
||||
_Tt_api_handle_list_cursor c(content);
|
||||
_Tt_pattern_ptr x;
|
||||
_Tt_string x_id;
|
||||
|
||||
while (c.next()) {
|
||||
if (!c->pptr().is_null()) {
|
||||
x = c->pptr();
|
||||
x_id = x->id();
|
||||
if (pat_id == x_id) {
|
||||
phandle = (Tt_pattern)((*c).c_pointer());
|
||||
last_pat_id = x_id;
|
||||
last_pattern = x;
|
||||
last_phandle = phandle;
|
||||
return x;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
phandle = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Look up a handle for the given _Tt_c_message. Since the MP
|
||||
* layer may give us back a different instance of its _Tt_c_message
|
||||
* for a reply, we have to compare using the _Tt_c_message::is_equal()
|
||||
* method to compare the messages by id, not address. If the incoming
|
||||
* message_ptr is found, replace the mptr in the handle with the
|
||||
* new version, which may have updated values (e.g. out args filled
|
||||
* in.)
|
||||
*/
|
||||
Tt_message _Tt_api_handle_table::
|
||||
lookup_mhandle(_Tt_c_message_ptr m)
|
||||
{
|
||||
// keep a cache of our last hit to avoid lookups
|
||||
if (! last_mhandle.is_null()) {
|
||||
if (m->is_equal(last_mhandle->mptr())) {
|
||||
last_mhandle->mptr()->update_message(m);
|
||||
return((Tt_message)last_mhandle.c_pointer());
|
||||
}
|
||||
}
|
||||
|
||||
_Tt_api_handle_list_cursor c(content);
|
||||
_Tt_c_message_ptr x;
|
||||
|
||||
while (c.next()) {
|
||||
x = c->mptr();
|
||||
if (!x.is_null()) {
|
||||
if (x->is_equal(m)) {
|
||||
x->update_message(m);
|
||||
last_mhandle = *c;
|
||||
return (Tt_message)last_mhandle.c_pointer();
|
||||
}
|
||||
}
|
||||
}
|
||||
// not found, add an entry
|
||||
if (((_Tt_c_message *)m.c_pointer())->is_a_diff()) {
|
||||
return((Tt_message)0);
|
||||
}
|
||||
_Tt_api_handle_ptr n = new _Tt_api_handle;
|
||||
n->ptr_set(m);
|
||||
content->push(n);
|
||||
last_mhandle = n;
|
||||
|
||||
return (Tt_message)last_mhandle.c_pointer();
|
||||
}
|
||||
|
||||
/*
|
||||
* Look up a handle for the given _Tt_pattern. Since the MP
|
||||
* layer may give us back a different instance of its _Tt_pattern
|
||||
* after a match, we have to
|
||||
* compare the patterns by id, not address.
|
||||
*/
|
||||
Tt_pattern _Tt_api_handle_table::
|
||||
lookup_phandle(_Tt_pattern_ptr p)
|
||||
{
|
||||
_Tt_api_handle_list_cursor c(content);
|
||||
_Tt_pattern_ptr x;
|
||||
|
||||
while (c.next()) {
|
||||
x = c->pptr();
|
||||
if (!x.is_null()) {
|
||||
if (p->id() == x->id()) {
|
||||
c->ptr_set(p);
|
||||
return (Tt_pattern)((*c).c_pointer());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// not found, add an entry
|
||||
|
||||
_Tt_api_handle_ptr n = new _Tt_api_handle;
|
||||
n->ptr_set(p);
|
||||
content->push(n);
|
||||
|
||||
return (Tt_pattern)n.c_pointer();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Remove the handle for the given _Tt_c_message_ptr. Use the is_equal
|
||||
* method, as in lookup.
|
||||
*/
|
||||
void _Tt_api_handle_table::
|
||||
clear(_Tt_c_message_ptr m)
|
||||
{
|
||||
_Tt_api_handle_list_cursor c(content);
|
||||
_Tt_c_message_ptr x;
|
||||
|
||||
while (c.next()) {
|
||||
x = c->mptr();
|
||||
if (!x.is_null()) {
|
||||
if (x->is_equal(m)) {
|
||||
c.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Remove the handle for the given _Tt_pattern_ptr. Use the is_equal
|
||||
* method, as in lookup.
|
||||
*/
|
||||
void _Tt_api_handle_table::
|
||||
clear(_Tt_pattern_ptr p)
|
||||
{
|
||||
_Tt_api_handle_list_cursor c(content);
|
||||
_Tt_pattern_ptr pc;
|
||||
|
||||
if (last_pat_id == p->id()) {
|
||||
last_pat_id = 0;
|
||||
}
|
||||
while (c.next()) {
|
||||
pc = c->pptr();
|
||||
if (!pc.is_null()) {
|
||||
if (p->id() == pc->id()) {
|
||||
c.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Remove the handle for the given Tt_message. By hackish casting
|
||||
* we can get directly to the _Tt_api_handle element, but to delete
|
||||
* it we have to scan the whole list, as there is no cursor "GOTO".
|
||||
*/
|
||||
void _Tt_api_handle_table::
|
||||
clear(Tt_message p)
|
||||
{
|
||||
_Tt_api_handle_list_cursor c(content);
|
||||
|
||||
while (c.next()) {
|
||||
if ((void *)((*c).c_pointer()) == (void *)p) {
|
||||
if ((*c).is_eq(last_mhandle)) {
|
||||
last_mhandle = (_Tt_api_handle *)0;
|
||||
}
|
||||
c.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove the handle for the given Tt_pattern. By hackish casting
|
||||
* we can get directly to the _Tt_api_handle element, but to delete
|
||||
* it we have to scan the whole list, as there is no cursor "GOTO".
|
||||
*/
|
||||
void _Tt_api_handle_table::
|
||||
clear(Tt_pattern p)
|
||||
{
|
||||
_Tt_api_handle_list_cursor c(content);
|
||||
|
||||
while (c.next()) {
|
||||
if ((void *)((*c).c_pointer()) == (void *)p) {
|
||||
c.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Store userdata for a _Tt_c_message given its API handle.
|
||||
*/
|
||||
Tt_status _Tt_api_handle_table::
|
||||
store(Tt_message h, int key, void *userdata)
|
||||
{
|
||||
if ((Tt_message)0 == h) {
|
||||
return TT_ERR_POINTER;
|
||||
}
|
||||
|
||||
_Tt_api_handle_ptr t = (_Tt_api_handle *)h;
|
||||
t->store(key, userdata);
|
||||
return TT_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Store userdata for a _Tt_pattern given its API handle.
|
||||
*/
|
||||
Tt_status _Tt_api_handle_table::
|
||||
store(Tt_pattern h, int key, void *userdata)
|
||||
{
|
||||
if ((Tt_pattern)0 == h) {
|
||||
return TT_ERR_POINTER;
|
||||
}
|
||||
_Tt_api_handle_ptr t = (_Tt_api_handle *)h;
|
||||
t->store(key, userdata);
|
||||
return TT_OK;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Fetch userdata for a _Tt_c_message given its API handle.
|
||||
*/
|
||||
void * _Tt_api_handle_table::
|
||||
fetch(Tt_message h, int key)
|
||||
{
|
||||
if ((Tt_message)0 == h) {
|
||||
return error_pointer(TT_ERR_POINTER);
|
||||
}
|
||||
|
||||
_Tt_api_handle_ptr t = (_Tt_api_handle *)h;
|
||||
return t->fetch(key);
|
||||
}
|
||||
|
||||
/*
|
||||
* Fetch userdata for a _Tt_pattern given its API handle.
|
||||
*/
|
||||
void * _Tt_api_handle_table::
|
||||
fetch(Tt_pattern h, int key)
|
||||
{
|
||||
if ((Tt_pattern)0 == h) {
|
||||
return error_pointer(TT_ERR_POINTER);
|
||||
}
|
||||
|
||||
_Tt_api_handle_ptr t = (_Tt_api_handle *)h;
|
||||
return t->fetch(key);
|
||||
}
|
||||
|
||||
/*
|
||||
* Store callback for a _Tt_c_message given its API handle.
|
||||
*/
|
||||
Tt_status _Tt_api_handle_table::
|
||||
add_callback(Tt_message h, Tt_message_callback cb)
|
||||
{
|
||||
if ((Tt_message)0 == h || (Tt_message_callback)0 == cb) {
|
||||
return TT_ERR_POINTER;
|
||||
}
|
||||
_Tt_api_handle_ptr t = (_Tt_api_handle *)h;
|
||||
t->add_callback(cb);
|
||||
return TT_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Store callback for a _Tt_pattern given its API handle.
|
||||
*/
|
||||
Tt_status _Tt_api_handle_table::
|
||||
add_callback(Tt_pattern h, Tt_message_callback cb)
|
||||
{
|
||||
if ((Tt_pattern)0 == h || (Tt_message_callback)0 == cb) {
|
||||
return TT_ERR_POINTER;
|
||||
}
|
||||
_Tt_api_handle_ptr t = (_Tt_api_handle *)h;
|
||||
t->add_callback(cb);
|
||||
return TT_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Run callbacks for a Tt_message given its API handle and the handle
|
||||
* of the pattern it matched
|
||||
*/
|
||||
Tt_callback_action _Tt_api_handle_table::
|
||||
run_message_callbacks(Tt_message h, Tt_pattern ph)
|
||||
{
|
||||
if ((Tt_message)0 == h) {
|
||||
return TT_CALLBACK_CONTINUE;
|
||||
} else {
|
||||
_Tt_api_handle_ptr t = (_Tt_api_handle *)h;
|
||||
return t->run_callbacks(h,ph);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Run callbacks for a Tt_pattern given its API handle and the API handle
|
||||
* of the message that matched it.
|
||||
*/
|
||||
Tt_callback_action _Tt_api_handle_table::
|
||||
run_pattern_callbacks(Tt_pattern h, Tt_message mh)
|
||||
{
|
||||
if ((Tt_pattern)0 == h) {
|
||||
return TT_CALLBACK_CONTINUE;
|
||||
} else {
|
||||
_Tt_api_handle_ptr t = (_Tt_api_handle *)h;
|
||||
return t->run_callbacks(mh,h);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_tt_api_handle_print(FILE *fs, const _Tt_object *obj)
|
||||
{
|
||||
((_Tt_api_handle *)obj)->print(fs);
|
||||
}
|
||||
|
||||
/*
|
||||
* Print the whole table
|
||||
void _Tt_api_handle_table::
|
||||
print(FILE *f) const
|
||||
{
|
||||
(void)fprintf(f,"_Tt_api_handle_table at %#lx <\n",(long)this);
|
||||
content->print(_tt_api_handle_print, f);
|
||||
(void)fprintf(f,">\n");
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//
|
||||
// _Tt_api_handle methods
|
||||
//
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* Construct a _Tt_api_handle
|
||||
*/
|
||||
_Tt_api_handle::
|
||||
_Tt_api_handle()
|
||||
{
|
||||
udlp = new _Tt_api_userdata_list;
|
||||
cblp = new _Tt_api_callback_list;
|
||||
}
|
||||
|
||||
|
||||
_Tt_api_handle::
|
||||
~_Tt_api_handle()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Set to point to a message
|
||||
*/
|
||||
void _Tt_api_handle::
|
||||
ptr_set(_Tt_c_message_ptr p)
|
||||
{
|
||||
_mptr = p;
|
||||
_pptr = (_Tt_pattern *)0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set to point to a pattern
|
||||
*/
|
||||
void _Tt_api_handle::
|
||||
ptr_set(_Tt_pattern_ptr p)
|
||||
{
|
||||
|
||||
_pptr = p;
|
||||
_mptr = (_Tt_c_message *)0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Store userdata under a key
|
||||
*/
|
||||
void _Tt_api_handle::
|
||||
store(int key, void *userdata)
|
||||
{
|
||||
_Tt_api_userdata_list_cursor c(udlp);
|
||||
|
||||
while (c.next()) {
|
||||
if (c->key == key) {
|
||||
c->userdata = userdata;
|
||||
return;
|
||||
}
|
||||
}
|
||||
// No userdata list element exists for this key.
|
||||
_Tt_api_userdata_ptr n = new _Tt_api_userdata;
|
||||
n->key = key;
|
||||
n->userdata = userdata;
|
||||
udlp->push(n);
|
||||
}
|
||||
|
||||
/*
|
||||
* Fetch userdata previously stored under a key
|
||||
*/
|
||||
void * _Tt_api_handle::
|
||||
fetch(int key)
|
||||
{
|
||||
_Tt_api_userdata_list_cursor c(udlp);
|
||||
|
||||
while (c.next()) {
|
||||
if (c->key == key) {
|
||||
return c->userdata;
|
||||
}
|
||||
}
|
||||
|
||||
// No userdata list element exists for this key.
|
||||
return (void *) 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Store callback
|
||||
*/
|
||||
void _Tt_api_handle::
|
||||
add_callback(Tt_message_callback f)
|
||||
{
|
||||
// No userdata list element exists for this key.
|
||||
_Tt_api_callback_ptr n = new _Tt_api_callback;
|
||||
n->callback = f;
|
||||
cblp->push(n);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Run the callbacks stored on this handle, passing the message and
|
||||
* pattern handles to each
|
||||
*/
|
||||
Tt_callback_action _Tt_api_handle::
|
||||
run_callbacks(Tt_message mh, Tt_pattern ph)
|
||||
{
|
||||
Tt_callback_action result = TT_CALLBACK_CONTINUE;
|
||||
_Tt_api_callback_list_cursor c(cblp);
|
||||
_Tt_trace trace;
|
||||
|
||||
// Mutexes must be dropped around callbacks. Note that
|
||||
// _Tt_trace::entry does *not* grab a mutex for the callback
|
||||
// version, and exit does not drop one for the callback version.
|
||||
// See tt_trace.C
|
||||
|
||||
// XXX: The only reason we can get away with this here is because
|
||||
// of the global libtt lock, and the fact that the cursor used
|
||||
// here is a local variable.
|
||||
|
||||
_tt_global->drop_mutex();
|
||||
|
||||
while (result==TT_CALLBACK_CONTINUE && c.next()) {
|
||||
trace.entry(c->callback, mh, ph);
|
||||
result = (c->callback)(mh,ph);
|
||||
trace.exit(result);
|
||||
}
|
||||
|
||||
_tt_global->grab_mutex();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// These access functions are prime candidates for inlining, but
|
||||
// for now they're broken out since I need to set breakpoints
|
||||
// in them.
|
||||
|
||||
_Tt_c_message_ptr _Tt_api_handle::
|
||||
mptr()
|
||||
{
|
||||
return _mptr;
|
||||
}
|
||||
|
||||
_Tt_pattern_ptr _Tt_api_handle::
|
||||
pptr()
|
||||
{
|
||||
return _pptr;
|
||||
}
|
||||
|
||||
void
|
||||
_tt_api_userdata_print(FILE *fs, const _Tt_object *obj)
|
||||
{
|
||||
((_Tt_api_userdata *)obj)->print(fs);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Print a _Tt_api_handle
|
||||
*/
|
||||
void _Tt_api_handle::
|
||||
print(FILE *f) const
|
||||
{
|
||||
(void)fprintf(f,"_Tt_api_handle at %lx\n",(long)this);
|
||||
}
|
||||
|
||||
/*
|
||||
* Print userdata pairs
|
||||
*/
|
||||
void _Tt_api_userdata::
|
||||
print(FILE *f) const
|
||||
{
|
||||
(void)fprintf(f,"_Tt_api_userdata at %#lx < Key: %d, Value %#lx>\n",
|
||||
(long)this, key, (long)userdata);
|
||||
}
|
||||
|
||||
/*
|
||||
* Print callbacks
|
||||
*/
|
||||
void _Tt_api_callback::
|
||||
print(FILE *f) const
|
||||
{
|
||||
(void)fprintf(f,"_Tt_api_callback at %#lx < Callback at: %#lx>\n",
|
||||
(long)this, (long)callback);
|
||||
}
|
||||
|
||||
_Tt_api_callback::
|
||||
_Tt_api_callback()
|
||||
{
|
||||
}
|
||||
|
||||
_Tt_api_callback::
|
||||
~_Tt_api_callback()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
_Tt_api_handle_table::
|
||||
~_Tt_api_handle_table()
|
||||
{
|
||||
}
|
||||
|
||||
_Tt_api_userdata::
|
||||
_Tt_api_userdata()
|
||||
{
|
||||
}
|
||||
|
||||
_Tt_api_userdata::
|
||||
~_Tt_api_userdata()
|
||||
{
|
||||
}
|
||||
117
cde/lib/tt/lib/api/c/api_handle.h
Normal file
117
cde/lib/tt/lib/api/c/api_handle.h
Normal file
@@ -0,0 +1,117 @@
|
||||
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
|
||||
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
|
||||
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
|
||||
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
|
||||
/*%% $XConsortium: api_handle.h /main/4 1995/11/21 19:36:15 cde-sun $ */
|
||||
/*
|
||||
* api_handle.h
|
||||
*
|
||||
* Classes for managing mapping from API handles to internal structures,
|
||||
* and maintaining user data.
|
||||
*
|
||||
* Copyright (c) 1990 by Sun Microsystems, Inc.
|
||||
*/
|
||||
#ifndef _API_HANDLE_H
|
||||
#define _API_HANDLE_H
|
||||
|
||||
#include "util/tt_list.h"
|
||||
#include "mp/mp_pattern_utils.h"
|
||||
#include "mp/mp_c_message_utils.h"
|
||||
#include "mp/mp_c_message.h"
|
||||
#include "mp/mp_pattern.h"
|
||||
#ifndef FILE
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
declare_list_of(_Tt_api_handle)
|
||||
declare_list_of(_Tt_api_userdata)
|
||||
declare_list_of(_Tt_api_callback)
|
||||
|
||||
class _Tt_api_handle : public _Tt_object {
|
||||
public:
|
||||
_Tt_api_handle();
|
||||
virtual ~_Tt_api_handle();
|
||||
void ptr_set(_Tt_c_message_ptr p);
|
||||
void ptr_set(_Tt_pattern_ptr p);
|
||||
_Tt_c_message_ptr mptr();
|
||||
_Tt_pattern_ptr pptr();
|
||||
void store(int key, void *userdata);
|
||||
void * fetch(int key);
|
||||
void add_callback(Tt_message_callback f);
|
||||
Tt_callback_action run_callbacks(Tt_message mh, Tt_pattern ph);
|
||||
void print(FILE *fs = stdout) const;
|
||||
private:
|
||||
// Only one of the following 2 pointers will be non-null,
|
||||
// as this is either a message handle or a pattern handle.
|
||||
// If we wanted to be real object-oriented weenies we would
|
||||
// declare two subclasses of _TT_api_handle, one for patterns
|
||||
// and one for messages. But we're not.
|
||||
_Tt_c_message_ptr _mptr;
|
||||
_Tt_pattern_ptr _pptr;
|
||||
|
||||
_Tt_api_userdata_list_ptr udlp;
|
||||
_Tt_api_callback_list_ptr cblp;
|
||||
};
|
||||
|
||||
class _Tt_api_userdata : public _Tt_object {
|
||||
friend class _Tt_api_handle;
|
||||
friend class _Tt_typecb;
|
||||
public:
|
||||
_Tt_api_userdata();
|
||||
virtual ~_Tt_api_userdata();
|
||||
void print(FILE *fs = stdout) const;
|
||||
private:
|
||||
int key;
|
||||
void * userdata;
|
||||
};
|
||||
|
||||
class _Tt_api_callback : public _Tt_object {
|
||||
friend class _Tt_api_handle;
|
||||
friend class _Tt_typecb;
|
||||
public:
|
||||
_Tt_api_callback();
|
||||
virtual ~_Tt_api_callback();
|
||||
void print(FILE *fs = stdout) const;
|
||||
private:
|
||||
Tt_message_callback callback;
|
||||
};
|
||||
|
||||
class _Tt_api_handle_table : public _Tt_object {
|
||||
public:
|
||||
_Tt_api_handle_table();
|
||||
virtual ~_Tt_api_handle_table();
|
||||
_Tt_c_message_ptr lookup_msg(Tt_message h);
|
||||
_Tt_pattern_ptr lookup_pat(Tt_pattern h);
|
||||
_Tt_pattern_ptr lookup_pat_by_id(_Tt_string pattern_id,
|
||||
Tt_pattern &pat);
|
||||
Tt_message lookup_mhandle(_Tt_c_message_ptr m);
|
||||
Tt_pattern lookup_phandle(_Tt_pattern_ptr p);
|
||||
void clear(_Tt_c_message_ptr m);
|
||||
void clear(_Tt_pattern_ptr p);
|
||||
void clear(Tt_message p);
|
||||
void clear(Tt_pattern p);
|
||||
Tt_status store(Tt_message h, int key,
|
||||
void * userdata);
|
||||
Tt_status store(Tt_pattern h, int key,
|
||||
void * userdata);
|
||||
void *fetch(Tt_message h, int key);
|
||||
void *fetch(Tt_pattern h, int key);
|
||||
Tt_status add_callback(Tt_message h,
|
||||
Tt_message_callback f);
|
||||
Tt_status add_callback(Tt_pattern h,
|
||||
Tt_message_callback f);
|
||||
Tt_callback_action run_message_callbacks(Tt_message h,
|
||||
Tt_pattern ph);
|
||||
Tt_callback_action run_pattern_callbacks(Tt_pattern h,
|
||||
Tt_message mh);
|
||||
void print(FILE *fs = stdout) const;
|
||||
private:
|
||||
_Tt_api_handle_list_ptr content;
|
||||
_Tt_api_handle_ptr last_mhandle;
|
||||
_Tt_string last_pat_id;
|
||||
_Tt_pattern_ptr last_pattern;
|
||||
Tt_pattern last_phandle;
|
||||
};
|
||||
extern _Tt_api_handle_table *_tt_htab;
|
||||
#endif
|
||||
|
||||
3155
cde/lib/tt/lib/api/c/api_message.C
Normal file
3155
cde/lib/tt/lib/api/c/api_message.C
Normal file
File diff suppressed because it is too large
Load Diff
842
cde/lib/tt/lib/api/c/api_mp.C
Normal file
842
cde/lib/tt/lib/api/c/api_mp.C
Normal file
@@ -0,0 +1,842 @@
|
||||
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
//%% (c) Copyright 1993, 1994 Novell, Inc.
|
||||
//%% $XConsortium: api_mp.C /main/4 1995/11/28 19:21:30 cde-sun $
|
||||
/* @(#)api_mp.C 1.48 93/07/30
|
||||
*
|
||||
* api_mp.cc
|
||||
*
|
||||
* Copyright (c) 1990 by Sun Microsystems, Inc.
|
||||
*
|
||||
* This file contains API functions related to the MP. For
|
||||
* each API function named tt_<name> there is a _tt_<name> function in
|
||||
* some file named api_mp_*.cc.
|
||||
*/
|
||||
|
||||
#include "db/tt_db_hostname_global_map_ref.h"
|
||||
#include "db/tt_old_db_partition_map_ref.h"
|
||||
#include "mp/mp_c_global.h"
|
||||
#include "mp/mp_c.h"
|
||||
#include "api/c/tt_c.h"
|
||||
#include "api/c/api_api.h"
|
||||
#include "api/c/api_mp.h"
|
||||
#include "api/c/api_handle.h"
|
||||
#include "api/c/api_spec_map_ref.h"
|
||||
#include "api/c/api_typecb.h"
|
||||
#include "util/tt_file_system.h"
|
||||
#include "util/tt_global_env.h"
|
||||
#include "util/tt_audit.h"
|
||||
|
||||
//HACK: The following variable needs to be moved to the procid structure;
|
||||
//handles should be procid-dependent. RFM 11/12/90
|
||||
_Tt_api_handle_table *_tt_htab;
|
||||
|
||||
char * _tt_open();
|
||||
Tt_status _tt_close();
|
||||
Tt_status _tt_session_join(const char *);
|
||||
Tt_status _tt_session_quit(const char *);
|
||||
int _tt_fd();
|
||||
char * _tt_X_session(const char *);
|
||||
Tt_status _tt_session_join(const char *);
|
||||
char * _tt_initial_session();
|
||||
Tt_message _tt_pnotice_create(Tt_scope , const char *);
|
||||
Tt_message _tt_prequest_create(Tt_scope , const char *);
|
||||
Tt_message _tt_onotice_create(const char *, const char *);
|
||||
Tt_status _tt_ptype_opnum_callback_add(const char *, int,
|
||||
Tt_message_callback);
|
||||
Tt_status _tt_otype_opnum_callback_add(const char *, int,
|
||||
Tt_message_callback);
|
||||
Tt_message _tt_orequest_create(const char *, const char *);
|
||||
|
||||
char *
|
||||
tt_open()
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("v", TT_OPEN, 0);
|
||||
char *result;
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit((char *)error_pointer(status));
|
||||
return (char *)error_pointer(status);
|
||||
}
|
||||
|
||||
result = _tt_open();
|
||||
audit.exit(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Tt_status
|
||||
tt_close()
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("v", TT_CLOSE, 0);
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit(status);
|
||||
return status;
|
||||
}
|
||||
|
||||
status = _tt_close();
|
||||
audit.exit(status);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
tt_initial_session()
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("v", TT_INITIAL_SESSION, 0);
|
||||
char *result;
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit((char *)error_pointer(status));
|
||||
return (char *)error_pointer(status);
|
||||
}
|
||||
|
||||
result = _tt_initial_session();
|
||||
audit.exit(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
tt_X_session(const char *display_name)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("C", TT_X_SESSION, display_name);
|
||||
char *result;
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit((char *)error_pointer(status));
|
||||
return (char *)error_pointer(status);
|
||||
}
|
||||
|
||||
result = _tt_X_session(display_name);
|
||||
audit.exit(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Tt_status
|
||||
tt_session_join(const char * sessid)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("C", TT_SESSION_JOIN, sessid);
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit(status);
|
||||
return status;
|
||||
}
|
||||
|
||||
status = _tt_session_join(sessid);
|
||||
audit.exit(status);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
Tt_status
|
||||
tt_session_quit(const char * sessid)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("C", TT_SESSION_QUIT, sessid);
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit(status);
|
||||
return status;
|
||||
}
|
||||
|
||||
status = _tt_session_quit(sessid);
|
||||
audit.exit(status);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
tt_fd(void)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("v", TT_FD, 0);
|
||||
int result;
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit(error_int(status));
|
||||
return error_int(status);
|
||||
}
|
||||
|
||||
result = _tt_fd();
|
||||
audit.exit(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Tt_message
|
||||
tt_pnotice_create(Tt_scope scope, const char *op)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("SC", TT_PNOTICE_CREATE, scope, op);
|
||||
Tt_message result;
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit((Tt_message)error_pointer(status));
|
||||
return (Tt_message)error_pointer(status);
|
||||
}
|
||||
|
||||
result = _tt_pnotice_create(scope, op);
|
||||
|
||||
audit.exit(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Tt_message
|
||||
tt_prequest_create(Tt_scope scope, const char *op)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("SC", TT_PREQUEST_CREATE, scope, op);
|
||||
Tt_message result;
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit((Tt_message)error_pointer(status));
|
||||
return (Tt_message)error_pointer(status);
|
||||
}
|
||||
|
||||
result = _tt_prequest_create(scope, op);
|
||||
|
||||
audit.exit(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Tt_message
|
||||
tt_onotice_create(const char *objid, const char *op)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("oC", TT_ONOTICE_CREATE, objid, op);
|
||||
Tt_message result;
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit((Tt_message)error_pointer(status));
|
||||
return (Tt_message)error_pointer(status);
|
||||
}
|
||||
|
||||
result = _tt_onotice_create(objid, op);
|
||||
|
||||
audit.exit(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Tt_message
|
||||
tt_orequest_create(const char *objid, const char *op)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("oC", TT_OREQUEST_CREATE, objid, op);
|
||||
Tt_message result;
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit((Tt_message)error_pointer(status));
|
||||
return (Tt_message)error_pointer(status);
|
||||
}
|
||||
|
||||
result = _tt_orequest_create(objid, op);
|
||||
|
||||
audit.exit(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Tt_status
|
||||
tt_ptype_opnum_callback_add(const char *ptid, int opnum, Tt_message_callback f)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("CiX", TT_PTYPE_OPNUM_CALLBACK_ADD,
|
||||
ptid, opnum, f);
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit(status);
|
||||
return status;
|
||||
}
|
||||
|
||||
status = _tt_ptype_opnum_callback_add(ptid, opnum, f);
|
||||
audit.exit(status);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
Tt_status
|
||||
tt_otype_opnum_callback_add(const char *otid, int opnum, Tt_message_callback f)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("CiX", TT_OTYPE_OPNUM_CALLBACK_ADD,
|
||||
otid, opnum, f);
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit(status);
|
||||
return status;
|
||||
}
|
||||
|
||||
status = _tt_otype_opnum_callback_add(otid, opnum, f);
|
||||
audit.exit(status);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Allocates a procid which is a ToolTalk message port. Can be called
|
||||
* multiple times if a process wants to have multiple procids.
|
||||
* Also initialize all the needed data structures. This function will set
|
||||
* the default procid and the default session (if not set).
|
||||
*/
|
||||
char *
|
||||
_tt_open()
|
||||
{
|
||||
Tt_status ttrc;
|
||||
|
||||
|
||||
_tt_internal_init();
|
||||
|
||||
ttrc=_tt_c_mp->c_init();
|
||||
if (ttrc != TT_OK && ttrc != TT_ERR_NOMP) {
|
||||
return (char *)error_pointer(ttrc);
|
||||
}
|
||||
if (TT_OK != (ttrc=_tt_c_mp->create_new_procid())) {
|
||||
return (char *)error_pointer(ttrc);
|
||||
}
|
||||
// Refresh the DB hostname redirection map
|
||||
_tt_global->db_hr_map.refresh();
|
||||
return _tt_strdup(_tt_c_mp->default_procid()->id());
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_tt_internal_init()
|
||||
{
|
||||
if (! _tt_mp) {
|
||||
if (! _tt_global) {
|
||||
_tt_global = new _Tt_global();
|
||||
}
|
||||
_tt_c_mp = new _Tt_c_mp();
|
||||
_tt_mp = (_Tt_mp *)_tt_c_mp;
|
||||
if (! _tt_htab) {
|
||||
_tt_htab = new _Tt_api_handle_table;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Destroys any open connections for the current default procid. If this
|
||||
* is the last procid for this process then all mp resources will be
|
||||
* destroyed.
|
||||
*/
|
||||
Tt_status
|
||||
_tt_close()
|
||||
{
|
||||
// destroy any state related to the current procid
|
||||
// and set the default procid to the next available
|
||||
// procid
|
||||
|
||||
// XXX: Note that this passes in the *thread-specific* default
|
||||
// procid. The process-wide default procid will be left
|
||||
// unset if it is the same as the thread-specific procid.
|
||||
_tt_c_mp->c_remove_procid(_tt_c_mp->default_procid());
|
||||
|
||||
// if there are no more procids, then we go ahead and destroy
|
||||
// everything else.
|
||||
if (_tt_c_mp->procid_count() == 0) {
|
||||
// XXX why? not necessary. Try removing this line.
|
||||
// 7/30/95 STR -- okay, since I'm mucking in here for
|
||||
// the MT-safe stuff anyway, I'll give it a try....
|
||||
//_tt_c_mp->default_c_session = (_Tt_c_session *)0;
|
||||
|
||||
// We used to delete _tt_global here, but we
|
||||
// no longer do that because it's possible that
|
||||
// someone may do another tt_open() in this same
|
||||
// process later.
|
||||
|
||||
delete _tt_htab;
|
||||
delete _tt_c_mp;
|
||||
_tt_c_mp = 0;
|
||||
_tt_mp = 0;
|
||||
_tt_htab = 0;
|
||||
|
||||
// XXX: if we were to make these classes have instances
|
||||
// pointed to out of _tt_global, instead of having a
|
||||
// static pointer internal to them, we wouldn\'t have to
|
||||
// put individual flush calls here. RFM 93/12/10.
|
||||
|
||||
_Tt_db_hostname_global_map_ref db_map;
|
||||
db_map.flush();
|
||||
|
||||
// This map is only required for old DB server compatibility
|
||||
_Tt_old_db_partition_map_ref old_db_map;
|
||||
old_db_map.flush();
|
||||
|
||||
_Tt_api_spec_map_ref spec_map;
|
||||
spec_map.flush();
|
||||
}
|
||||
|
||||
return TT_OK;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Returns the id of the initial session (the process tree session if
|
||||
* specified, else the session associated with the X display named in
|
||||
* the DISPLAY environment variable.
|
||||
*/
|
||||
char *
|
||||
_tt_initial_session()
|
||||
{
|
||||
_Tt_string s = _tt_c_mp->initial_session->id();
|
||||
return _tt_strdup((const char *) s);
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
_tt_X_session(const char *display_name)
|
||||
{
|
||||
_Tt_string id;
|
||||
|
||||
_tt_internal_init();
|
||||
|
||||
id = _tt_c_mp->initial_session->Xid(display_name);
|
||||
|
||||
if (id.len() == 0) {
|
||||
return((char *)error_pointer(TT_ERR_SESSION));
|
||||
}
|
||||
|
||||
return _tt_strdup(id);
|
||||
}
|
||||
|
||||
/*
|
||||
* Session functions (FSpec A.11)
|
||||
*/
|
||||
Tt_status
|
||||
_tt_session_join(const char * sessid)
|
||||
{
|
||||
Tt_status status;
|
||||
_Tt_c_procid *d_procid = _tt_c_mp->default_c_procid().c_pointer();
|
||||
_Tt_string sessidstr = (char *)0;
|
||||
|
||||
|
||||
// Add the P on if isn't already.
|
||||
_prepend_P_to_sessid(sessid, sessidstr);
|
||||
|
||||
status = d_procid->set_default_session(sessidstr);
|
||||
if (status != TT_OK) {
|
||||
return(status);
|
||||
}
|
||||
|
||||
PCOMMIT;
|
||||
|
||||
status = d_procid->default_session()->
|
||||
c_join(_tt_c_mp->default_c_procid());
|
||||
|
||||
return(status);
|
||||
}
|
||||
|
||||
|
||||
Tt_status
|
||||
_tt_session_quit(const char * sessid)
|
||||
{
|
||||
Tt_status status;
|
||||
_Tt_c_procid *d_procid = _tt_c_mp->default_c_procid().c_pointer();
|
||||
_Tt_c_session *d_session;
|
||||
|
||||
d_session = d_procid->default_session().c_pointer();
|
||||
if (d_session->id() != sessid) {
|
||||
return(TT_ERR_SESSION);
|
||||
}
|
||||
status = d_session->c_quit(_tt_c_mp->default_c_procid());
|
||||
|
||||
return(status);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Message arrival notification methods (FSpec A.13)
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Returns a file descriptor that will become active for input whenever a
|
||||
* message arrives for the process, and will stay active until the
|
||||
* message is received.
|
||||
*/
|
||||
int
|
||||
_tt_fd(void)
|
||||
{
|
||||
int result;
|
||||
_Tt_c_procid *d_procid = _tt_c_mp->default_c_procid().c_pointer();
|
||||
|
||||
PCOMMIT;
|
||||
|
||||
if (d_procid->set_fd_channel()) {
|
||||
result = d_procid->fd();
|
||||
} else {
|
||||
result = error_int(TT_ERR_NOMP);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* The following are "macros" which provide a simpler high level
|
||||
* interface to the above low level calls.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Create a procedural notification with the given scope and op
|
||||
*/
|
||||
Tt_message
|
||||
_tt_pnotice_create(Tt_scope scope, const char *op)
|
||||
{
|
||||
Tt_message result;
|
||||
Tt_status err;
|
||||
_Tt_c_procid *d_procid = _tt_c_mp->default_c_procid().c_pointer();
|
||||
|
||||
|
||||
// tt_message_create
|
||||
_Tt_c_message_ptr msg = new _Tt_c_message();
|
||||
|
||||
msg->set_state(TT_CREATED);
|
||||
msg->set_sender(_tt_c_mp->default_c_procid());
|
||||
msg->set_id();
|
||||
msg->set_file(d_procid->default_file());
|
||||
msg->set_session(d_procid->default_session());
|
||||
msg->set_sender_ptype(d_procid->default_ptype());
|
||||
// tt_message_address_set
|
||||
err = msg->set_paradigm(TT_PROCEDURE);
|
||||
if (err != TT_OK) {
|
||||
return (Tt_message)error_pointer(err);
|
||||
}
|
||||
// tt_message_class_set
|
||||
err = msg->set_message_class(TT_NOTICE);
|
||||
if (err != TT_OK) {
|
||||
return (Tt_message)error_pointer(err);
|
||||
}
|
||||
// tt_message_op_set
|
||||
err = msg->set_op(op);
|
||||
if (err != TT_OK) {
|
||||
return (Tt_message)error_pointer(err);
|
||||
}
|
||||
// tt_message_scope_set
|
||||
err = msg->set_scope(scope);
|
||||
if (err != TT_OK) {
|
||||
return (Tt_message)error_pointer(err);
|
||||
}
|
||||
result = _tt_htab->lookup_mhandle(msg);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Create a procedural request with the given scope and op
|
||||
*/
|
||||
Tt_message
|
||||
_tt_prequest_create(Tt_scope scope, const char *op)
|
||||
{
|
||||
Tt_message result;
|
||||
Tt_status err;
|
||||
_Tt_c_procid *d_procid = _tt_c_mp->default_c_procid().c_pointer();
|
||||
|
||||
// tt_message_create
|
||||
_Tt_c_message_ptr msg = new _Tt_c_message();
|
||||
msg->set_state(TT_CREATED);
|
||||
msg->set_sender(_tt_c_mp->default_c_procid());
|
||||
msg->set_id();
|
||||
msg->set_file(d_procid->default_file());
|
||||
msg->set_session(d_procid->default_session());
|
||||
msg->set_sender_ptype(d_procid->default_ptype());
|
||||
// tt_message_address_set
|
||||
err = msg->set_paradigm(TT_PROCEDURE);
|
||||
if (err != TT_OK) {
|
||||
return (Tt_message)error_pointer(err);
|
||||
}
|
||||
// tt_message_class_set
|
||||
err = msg->set_message_class(TT_REQUEST);
|
||||
if (err != TT_OK) {
|
||||
return (Tt_message)error_pointer(err);
|
||||
}
|
||||
// tt_message_op_set
|
||||
err = msg->set_op(op);
|
||||
if (err != TT_OK) {
|
||||
return (Tt_message)error_pointer(err);
|
||||
}
|
||||
// tt_message_scope_set
|
||||
err = msg->set_scope(scope);
|
||||
if (err != TT_OK) {
|
||||
return (Tt_message)error_pointer(err);
|
||||
}
|
||||
result = _tt_htab->lookup_mhandle(msg);
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Create an object oriented notification with the given node and op
|
||||
*/
|
||||
Tt_message
|
||||
_tt_onotice_create(const char *objid, const char *op)
|
||||
{
|
||||
Tt_message result;
|
||||
Tt_status err;
|
||||
_Tt_c_procid *d_procid = _tt_c_mp->default_c_procid().c_pointer();
|
||||
|
||||
// tt_message_create
|
||||
_Tt_c_message_ptr msg = new _Tt_c_message();
|
||||
msg->set_state(TT_CREATED);
|
||||
msg->set_sender(_tt_c_mp->default_c_procid());
|
||||
msg->set_id();
|
||||
msg->set_file(d_procid->default_file());
|
||||
msg->set_session(d_procid->default_session());
|
||||
msg->set_sender_ptype(d_procid->default_ptype());
|
||||
// tt_message_address_set
|
||||
err = msg->set_paradigm(TT_OBJECT);
|
||||
if (err != TT_OK) {
|
||||
return (Tt_message)error_pointer(err);
|
||||
}
|
||||
// tt_message_class_set
|
||||
err = msg->set_message_class(TT_NOTICE);
|
||||
if (err != TT_OK) {
|
||||
return (Tt_message)error_pointer(err);
|
||||
}
|
||||
// tt_message_op_set
|
||||
err = msg->set_op(op);
|
||||
if (err != TT_OK) {
|
||||
return (Tt_message)error_pointer(err);
|
||||
}
|
||||
// tt_message_object_set
|
||||
_Tt_string oid(objid);
|
||||
err = msg->set_object(oid.unquote_nulls());
|
||||
if (err != TT_OK) {
|
||||
return (Tt_message)error_pointer(err);
|
||||
}
|
||||
result = _tt_htab->lookup_mhandle(msg);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Create an object oriented request with the given node and op
|
||||
*/
|
||||
Tt_message
|
||||
_tt_orequest_create(const char *objid, const char *op)
|
||||
{
|
||||
Tt_message result;
|
||||
Tt_status err;
|
||||
_Tt_c_procid *d_procid = _tt_c_mp->default_c_procid().c_pointer();
|
||||
|
||||
|
||||
// tt_message_create
|
||||
_Tt_c_message_ptr msg = new _Tt_c_message();
|
||||
msg->set_state(TT_CREATED);
|
||||
msg->set_sender(_tt_c_mp->default_c_procid());
|
||||
msg->set_id();
|
||||
msg->set_file(d_procid->default_file());
|
||||
msg->set_session(d_procid->default_session());
|
||||
msg->set_sender_ptype(d_procid->default_ptype());
|
||||
// tt_message_address_set
|
||||
err = msg->set_paradigm(TT_OBJECT);
|
||||
if (err != TT_OK) {
|
||||
return (Tt_message)error_pointer(err);
|
||||
}
|
||||
// tt_message_class_set
|
||||
err = msg->set_message_class(TT_REQUEST);
|
||||
if (err != TT_OK) {
|
||||
return (Tt_message)error_pointer(err);
|
||||
}
|
||||
// tt_message_op_set
|
||||
err = msg->set_op(op);
|
||||
if (err != TT_OK) {
|
||||
return (Tt_message)error_pointer(err);
|
||||
}
|
||||
// tt_message_object_set
|
||||
_Tt_string oid(objid);
|
||||
err = msg->set_object(oid.unquote_nulls());
|
||||
if (err != TT_OK) {
|
||||
return (Tt_message)error_pointer(err);
|
||||
}
|
||||
result = _tt_htab->lookup_mhandle(msg);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Register ptype and otype callbacks.
|
||||
*/
|
||||
|
||||
static Tt_status
|
||||
type_opnum_callback_add(_Tt_typecb_table_ptr &callbacks,
|
||||
const char *tid, int opnum, Tt_message_callback f);
|
||||
|
||||
Tt_status
|
||||
_tt_ptype_opnum_callback_add(const char *ptid, int opnum,
|
||||
Tt_message_callback f)
|
||||
{
|
||||
_Tt_c_procid *d_procid = _tt_c_mp->default_c_procid().c_pointer();
|
||||
|
||||
_Tt_typecb_table_ptr & tcbt = d_procid->ptype_callbacks();
|
||||
return type_opnum_callback_add(tcbt, ptid, opnum, f);
|
||||
}
|
||||
|
||||
|
||||
Tt_status
|
||||
_tt_otype_opnum_callback_add(const char *otid, int opnum,
|
||||
Tt_message_callback f)
|
||||
{
|
||||
Tt_status result;
|
||||
_Tt_c_procid *d_procid = _tt_c_mp->default_c_procid().c_pointer();
|
||||
|
||||
_Tt_typecb_table_ptr & tcbt = d_procid->otype_callbacks();
|
||||
result = type_opnum_callback_add(tcbt, otid, opnum, f);
|
||||
|
||||
if (TT_ERR_PTYPE==result) {
|
||||
result = TT_ERR_OTYPE;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
static Tt_status
|
||||
type_opnum_callback_add(_Tt_typecb_table_ptr &callbacks,
|
||||
const char *tid, int opnum, Tt_message_callback f)
|
||||
{
|
||||
if (0==tid) {
|
||||
return TT_ERR_PTYPE;
|
||||
}
|
||||
|
||||
if (0==f) {
|
||||
return TT_ERR_POINTER;
|
||||
}
|
||||
|
||||
if (callbacks.is_null()) {
|
||||
callbacks = new _Tt_typecb_table(_tt_typecb_key);
|
||||
}
|
||||
|
||||
_Tt_string key = _tt_typecb_key(tid,opnum);
|
||||
_Tt_typecb_ptr tcb = callbacks->lookup(key);
|
||||
if (tcb.is_null()) {
|
||||
tcb = new _Tt_typecb(tid,opnum);
|
||||
callbacks->insert(tcb);
|
||||
}
|
||||
|
||||
tcb->add_callback(f);
|
||||
|
||||
return TT_OK;
|
||||
}
|
||||
|
||||
Tt_status
|
||||
_tt_ptype_opnum_user_set(const char *ptype, int opnum, void *clientdata)
|
||||
{
|
||||
// XXX if ever promoted to real API, use auditing instead
|
||||
if ((ptype == 0) || (tt_ptr_error(ptype) != TT_OK)) {
|
||||
return TT_ERR_POINTER;
|
||||
}
|
||||
|
||||
_Tt_c_procid *d_procid = _tt_c_mp->default_c_procid().c_pointer();
|
||||
_Tt_typecb_table_ptr &callbacks = d_procid->ptype_callbacks();
|
||||
_Tt_string key = _tt_typecb_key( ptype, opnum );
|
||||
_Tt_typecb_ptr tcb = callbacks->lookup( key );
|
||||
if (tcb.is_null()) {
|
||||
tcb = new _Tt_typecb( ptype, opnum );
|
||||
if (tcb.is_null()) {
|
||||
return TT_ERR_NOMEM;
|
||||
}
|
||||
callbacks->insert( tcb );
|
||||
}
|
||||
tcb->clientdata = clientdata;
|
||||
return TT_OK;
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
_tt_ptype_opnum_user(const char *ptype, int opnum)
|
||||
{
|
||||
// XXX if ever promoted to real API, use auditing instead
|
||||
if ((ptype == 0) || (tt_ptr_error( ptype ) != TT_OK)) {
|
||||
return error_pointer( TT_ERR_POINTER );
|
||||
}
|
||||
|
||||
_Tt_c_procid *d_procid = _tt_c_mp->default_c_procid().c_pointer();
|
||||
_Tt_typecb_table_ptr &callbacks = d_procid->ptype_callbacks();
|
||||
_Tt_string key = _tt_typecb_key( ptype, opnum );
|
||||
_Tt_typecb_ptr tcb = callbacks->lookup( key );
|
||||
if (tcb.is_null()) {
|
||||
return error_pointer( TT_WRN_NOTFOUND );
|
||||
}
|
||||
return tcb->clientdata;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
tt_trace_control() - toggle tracing
|
||||
|
||||
trace states:
|
||||
Unitialized
|
||||
Off
|
||||
On
|
||||
Suspended
|
||||
|
||||
Note: a zero-length $TT_TRACE_SCRIPT is the same as TT_TRACE_SCRIPT
|
||||
not being in the environment at all. (This is because there is
|
||||
no MT-safe way to unset environment variables.) Below, TT_TRACE_SCRIPT
|
||||
is considered "unset" if getenv() returns NULL or "".
|
||||
|
||||
Uninit Off On Suspended
|
||||
-------------------------------------------
|
||||
tt_trace_control( 0 ) | - Uninit Uninit Uninit
|
||||
tt_trace_control( 1 ) | On On - On
|
||||
tt_trace_control( -1 )| On On Suspended On
|
||||
tt_*, unset script | Off - - -
|
||||
tt_*, script | On - - -
|
||||
|
||||
Uninit => On
|
||||
Uninit => Off
|
||||
Off => On
|
||||
Reads $TT_TRACE_SCRIPT and unsets it if unless it specifies
|
||||
"follow on".
|
||||
|
||||
Suspended => On
|
||||
Does not reread $TT_TRACE_SCRIPT.
|
||||
|
||||
Returns:
|
||||
0 State was On before the call
|
||||
1 State was ! On before the call
|
||||
*/
|
||||
int
|
||||
tt_trace_control(int onoff)
|
||||
{
|
||||
int was_on = _Tt_trace::any_tracing();
|
||||
switch (onoff) {
|
||||
case 0:
|
||||
_Tt_trace::fini();
|
||||
break;
|
||||
case -1:
|
||||
_Tt_trace::toggle();
|
||||
break;
|
||||
default:
|
||||
_Tt_trace::init( 1 );
|
||||
break;
|
||||
}
|
||||
return was_on;
|
||||
}
|
||||
221
cde/lib/tt/lib/api/c/api_mp.h
Normal file
221
cde/lib/tt/lib/api/c/api_mp.h
Normal file
@@ -0,0 +1,221 @@
|
||||
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
|
||||
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
|
||||
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
|
||||
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
|
||||
/*%% $XConsortium: api_mp.h /main/4 1995/11/28 19:22:43 cde-sun $ */
|
||||
/* @(#)api_mp.h 1.14 93/07/30 SMI
|
||||
* api_mp.h
|
||||
*
|
||||
* Copyright (c) 1993 by Sun Microsystems, Inc.
|
||||
*/
|
||||
#ifndef _TT_API_MP_H
|
||||
#define _TT_API_MP_H
|
||||
#include <api/c/tt_c.h>
|
||||
#include <util/tt_string.h>
|
||||
|
||||
|
||||
char *_tt_default_ptype(void);
|
||||
Tt_status _tt_default_ptype_set(const char *ptid);
|
||||
char *_tt_default_file(void);
|
||||
Tt_status _tt_default_file_set(const char *docid);
|
||||
|
||||
Tt_status _tt_file_join(const char *filepath);
|
||||
|
||||
Tt_status _tt_file_objects_query(const char *filepath, Tt_filter_function filter,
|
||||
void *context, void *accumulator);
|
||||
char *_tt_file_procid(const char *filepath, int n);
|
||||
Tt_status _tt_file_quit(const char *filepath);
|
||||
|
||||
Tt_status _tt_file_destroy(const char *filepath);
|
||||
Tt_status _tt_file_move(const char *oldfilepath,
|
||||
const char *newfilepath);
|
||||
Tt_status _tt_file_copy(const char *oldfilepath,
|
||||
const char *newfilepath);
|
||||
|
||||
Tt_status _tt_filelist_objects_query(const char **filepathlist,
|
||||
Tt_filter_function filter,
|
||||
void *context, void *accumulator);
|
||||
Tt_status _tt_message_accept(Tt_message m);
|
||||
Tt_status _tt_message_arg_add(Tt_message m, Tt_mode n,
|
||||
const char *vtype, const char *value);
|
||||
char *_tt_message_arg_val(Tt_message m, int n);
|
||||
Tt_status _tt_message_arg_val_set(Tt_message m, int n,
|
||||
const char *value);
|
||||
Tt_status _tt_message_barg_add(Tt_message m, Tt_mode n,
|
||||
const char *vtype,
|
||||
const unsigned char *value, int len);
|
||||
Tt_status _tt_message_arg_bval(Tt_message m, int n,
|
||||
unsigned char **value, int *len);
|
||||
Tt_status _tt_message_arg_bval_set(Tt_message m, int n,
|
||||
const unsigned char *value, int len);
|
||||
Tt_status _tt_message_iarg_add(Tt_message m, Tt_mode n,
|
||||
const char *vtype, int value);
|
||||
Tt_status _tt_message_arg_ival(Tt_message m, int n, int *value);
|
||||
Tt_status _tt_message_arg_ival_set(Tt_message m, int n, int value);
|
||||
int _tt_message_args_count(Tt_message m);
|
||||
Tt_mode _tt_message_arg_mode(Tt_message m, int n);
|
||||
char * _tt_message_arg_type(Tt_message m, int n);
|
||||
Tt_status _tt_message_callback_add(Tt_message m,
|
||||
Tt_message_callback f);
|
||||
Tt_class _tt_message_class(Tt_message m);
|
||||
Tt_status _tt_message_class_set(Tt_message m, Tt_class c);
|
||||
Tt_message _tt_message_create(void);
|
||||
Tt_message _tt_message_create_super(Tt_message m);
|
||||
Tt_status _tt_message_destroy(Tt_message m);
|
||||
Tt_status _tt_message_fail(Tt_message m);
|
||||
char *_tt_message_file(Tt_message m);
|
||||
Tt_status _tt_message_file_set(Tt_message m, const char *filepath);
|
||||
char *_tt_message_object(Tt_message m);
|
||||
Tt_status _tt_message_object_set(Tt_message m, const char *objid);
|
||||
char *_tt_message_observer(Tt_message m);
|
||||
char *_tt_message_op(Tt_message m);
|
||||
Tt_status _tt_message_op_set(Tt_message m, const char *opname);
|
||||
int _tt_message_opnum(Tt_message m);
|
||||
char *_tt_message_otype(Tt_message m);
|
||||
Tt_status _tt_message_otype_set(Tt_message m, const char *otype);
|
||||
Tt_address _tt_message_address(Tt_message m);
|
||||
Tt_status _tt_message_address_set(Tt_message m, Tt_address p);
|
||||
Tt_pattern _tt_message_pattern(Tt_message m);
|
||||
Tt_message _tt_message_receive(void);
|
||||
char *_tt_message_handler(Tt_message m);
|
||||
Tt_status _tt_message_handler_set(Tt_message m, const char *procid);
|
||||
char *_tt_message_handler_ptype(Tt_message m);
|
||||
Tt_status _tt_message_handler_ptype_set(Tt_message m, const char *ptid);
|
||||
Tt_status _tt_message_reject(Tt_message m);
|
||||
Tt_disposition _tt_message_disposition(Tt_message m);
|
||||
Tt_status _tt_message_disposition_set(Tt_message m, Tt_disposition r);
|
||||
Tt_status _tt_message_reply(Tt_message m);
|
||||
Tt_scope _tt_message_scope(Tt_message m);
|
||||
Tt_status _tt_message_scope_set(Tt_message m, Tt_scope s);
|
||||
Tt_status _tt_message_send(Tt_message m);
|
||||
Tt_status _tt_message_send_on_exit(Tt_message m);
|
||||
char *_tt_message_sender(Tt_message m);
|
||||
char *_tt_message_sender_ptype(Tt_message m);
|
||||
Tt_status _tt_message_sender_ptype_set(Tt_message m, const char *ptid);
|
||||
char *_tt_message_session(Tt_message m);
|
||||
Tt_status _tt_message_session_set(Tt_message m, const char *sessid);
|
||||
Tt_state _tt_message_state(Tt_message m);
|
||||
int _tt_message_status(Tt_message m);
|
||||
Tt_status _tt_message_status_set(Tt_message m, int status);
|
||||
char *_tt_message_status_string(Tt_message m);
|
||||
Tt_status _tt_message_status_string_set(Tt_message m, const char *status_str);
|
||||
uid_t _tt_message_uid(Tt_message m);
|
||||
gid_t _tt_message_gid(Tt_message m);
|
||||
void *_tt_message_user(Tt_message m, int key);
|
||||
Tt_status _tt_message_user_set(Tt_message m, int key, void *v);
|
||||
|
||||
int _tt_otype_deriveds_count(const char *otype);
|
||||
char * _tt_otype_derived(const char *otype, int i);
|
||||
char * _tt_otype_base(const char *otype);
|
||||
int _tt_otype_is_derived(const char *derivedotype,
|
||||
const char *baseotype);
|
||||
int _tt_otype_osig_count(const char * otype);
|
||||
int _tt_otype_hsig_count(const char * otype);
|
||||
char * _tt_otype_osig_op(const char * otype, int sig);
|
||||
char * _tt_otype_hsig_op(const char * otype, int sig);
|
||||
int _tt_otype_osig_args_count(const char * otype, int sig);
|
||||
int _tt_otype_hsig_args_count(const char * otype, int sig);
|
||||
Tt_mode _tt_otype_osig_arg_mode(const char * otype,
|
||||
int sig, int arg);
|
||||
Tt_mode _tt_otype_hsig_arg_mode(const char * otype,
|
||||
int sig, int arg);
|
||||
char * _tt_otype_osig_arg_type(const char * otype,
|
||||
int sig, int arg);
|
||||
char * _tt_otype_hsig_arg_type(const char * otype,
|
||||
int sig, int arg);
|
||||
Tt_status _tt_valid_otype(const char *otype);
|
||||
|
||||
Tt_status _tt_spec_bprop(const char *nodeid, const char *propname, int i,
|
||||
unsigned char **value, int *length);
|
||||
Tt_status _tt_spec_bprop_add(const char *nodeid, const char *propname,
|
||||
unsigned const char *value, int length);
|
||||
Tt_status _tt_spec_bprop_set(const char *nodeid, const char *propname,
|
||||
unsigned const char *value, int length);
|
||||
char *_tt_spec_create(const char *filepath);
|
||||
Tt_status _tt_spec_destroy(const char *nodeid);
|
||||
char *_tt_spec_file(const char *nodeid);
|
||||
char *_tt_spec_move(const char *nodeid, const char *newfilepath);
|
||||
Tt_status _tt_spec_type_set(const char * nodeid, const char * otid);
|
||||
char *_tt_spec_type(const char * nodeid);
|
||||
char *_tt_spec_prop(const char *nodeid, const char *propname, int i);
|
||||
Tt_status _tt_spec_prop_add(const char *nodeid, const char *propname, const char *value);
|
||||
int _tt_spec_prop_count(const char *nodeid, const char *propname);
|
||||
Tt_status _tt_spec_prop_set(const char *nodeid, const char *propname, const char *value);
|
||||
char *_tt_spec_propname(const char *nodeid, int n);
|
||||
int _tt_spec_propnames_count(const char *nodeid);
|
||||
Tt_status _tt_spec_write(const char *nodeid);
|
||||
|
||||
int _tt_objid_equal(const char *nodeid1, const char *nodeid2);
|
||||
char *_tt_objid_objkey(const char *nodeid);
|
||||
Tt_status _tt_pattern_arg_add(Tt_pattern p, Tt_mode n,
|
||||
const char *vtype, const char *value);
|
||||
Tt_status _tt_pattern_barg_add(Tt_pattern p, Tt_mode n,
|
||||
const char *vtype,
|
||||
const unsigned char *value, int len);
|
||||
Tt_status _tt_pattern_iarg_add(Tt_pattern p, Tt_mode n,
|
||||
const char *vtype, int value);
|
||||
|
||||
Tt_status _tt_pattern_callback_add(Tt_pattern m,
|
||||
Tt_message_callback f);
|
||||
Tt_category _tt_pattern_category(Tt_pattern p);
|
||||
Tt_status _tt_pattern_category_set(Tt_pattern p, Tt_category c);
|
||||
Tt_status _tt_pattern_class_add(Tt_pattern p, Tt_class c);
|
||||
Tt_pattern _tt_pattern_create(void);
|
||||
Tt_status _tt_pattern_destroy(Tt_pattern p);
|
||||
Tt_status _tt_pattern_file_add(Tt_pattern p, const char *filepath);
|
||||
Tt_status _tt_pattern_object_add(Tt_pattern p, const char *objid);
|
||||
Tt_status _tt_pattern_op_add(Tt_pattern p, const char *opname);
|
||||
Tt_status _tt_pattern_otype_add(Tt_pattern p, const char *otype);
|
||||
Tt_status _tt_pattern_address_add(Tt_pattern p, Tt_address d);
|
||||
Tt_status _tt_pattern_register(Tt_pattern p);
|
||||
Tt_status _tt_pattern_unregister(Tt_pattern p);
|
||||
Tt_status _tt_pattern_disposition_add(Tt_pattern p, Tt_disposition r);
|
||||
Tt_status _tt_pattern_scope_add(Tt_pattern p, Tt_scope s);
|
||||
Tt_status _tt_pattern_sender_add(Tt_pattern p, const char *procid);
|
||||
Tt_status _tt_pattern_sender_ptype_add(Tt_pattern p, const char *ptid);
|
||||
Tt_status _tt_pattern_session_add(Tt_pattern p, const char *sessid);
|
||||
Tt_status _tt_pattern_state_add(Tt_pattern p, Tt_state s);
|
||||
void *_tt_pattern_user(Tt_pattern p, int key);
|
||||
Tt_status _tt_pattern_user_set(Tt_pattern p, int key, void *v);
|
||||
|
||||
Tt_status _tt_ptype_declare(const char *ptid);
|
||||
Tt_status _tt_ptype_undeclare(const char *ptid);
|
||||
Tt_status _tt_ptype_exists(const char *ptid);
|
||||
|
||||
|
||||
char *_tt_session_prop(const char *sessid, const char *propname,
|
||||
int i);
|
||||
Tt_status _tt_session_prop_add(const char *sessid, const char *propname,
|
||||
const char *value);
|
||||
int _tt_session_prop_count(const char *sessid,
|
||||
const char *propname);
|
||||
Tt_status _tt_session_prop_set(const char *sessid, const char *propname,
|
||||
const char *value);
|
||||
Tt_status _tt_session_bprop(const char *sessid, const char *propname,
|
||||
int i,
|
||||
unsigned char **value, int *length);
|
||||
Tt_status _tt_session_bprop_add(const char *sessid, const char *propname,
|
||||
unsigned const char *value, int length);
|
||||
Tt_status _tt_session_bprop_set(const char *sessid, const char *propname,
|
||||
unsigned const char *value, int length);
|
||||
char *_tt_session_propname(const char *sessid, int n);
|
||||
int _tt_session_propnames_count(const char *sessid);
|
||||
|
||||
char *_tt_default_session(void);
|
||||
Tt_status _tt_default_session_set(const char *sessid);
|
||||
|
||||
char *_tt_default_procid(void);
|
||||
Tt_status _tt_default_procid_set(const char *procid);
|
||||
|
||||
char *_tt_thread_session(void);
|
||||
Tt_status _tt_thread_session_set(const char *sessid);
|
||||
|
||||
char *_tt_thread_procid(void);
|
||||
Tt_status _tt_thread_procid_set(const char *procid);
|
||||
|
||||
char *_tt_procid_session(const char *);
|
||||
Tt_status _tt_feature_enabled(Tt_feature f);
|
||||
Tt_status _tt_feature_required(Tt_feature f);
|
||||
|
||||
void _tt_internal_init();
|
||||
#endif
|
||||
33
cde/lib/tt/lib/api/c/api_mp_io.C
Normal file
33
cde/lib/tt/lib/api/c/api_mp_io.C
Normal file
@@ -0,0 +1,33 @@
|
||||
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
//%% (c) Copyright 1993, 1994 Novell, Inc.
|
||||
//%% $XConsortium: api_mp_io.C /main/3 1995/10/23 09:53:36 rswiston $
|
||||
/*
|
||||
*
|
||||
* api_mp_oi.cc
|
||||
*
|
||||
* Copyright (c) 1990 by Sun Microsystems, Inc.
|
||||
*
|
||||
* Functions for changing mp objects like procids, oids, etc. to and from
|
||||
* character strings, for presentation at the API level
|
||||
*/
|
||||
|
||||
#include "mp/mp_c.h"
|
||||
|
||||
//
|
||||
// output procid as string
|
||||
//
|
||||
_Tt_string _Tt_c_procid::
|
||||
api_out()
|
||||
{
|
||||
return id();
|
||||
}
|
||||
|
||||
|
||||
Tt_status _Tt_c_procid::
|
||||
api_in(_Tt_string &id)
|
||||
{
|
||||
_id = id;
|
||||
return(TT_OK);
|
||||
}
|
||||
657
cde/lib/tt/lib/api/c/api_mp_otype.C
Normal file
657
cde/lib/tt/lib/api/c/api_mp_otype.C
Normal file
@@ -0,0 +1,657 @@
|
||||
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
//%% (c) Copyright 1993, 1994 Novell, Inc.
|
||||
//%% $XConsortium: api_mp_otype.C /main/4 1995/11/21 19:34:39 cde-sun $
|
||||
/*
|
||||
*
|
||||
* mp_api_otype.cc
|
||||
*
|
||||
* Copyright (c) 1990 by Sun Microsystems, Inc.
|
||||
*
|
||||
* This file contains API functions related to the MP. For
|
||||
* each API function named tt_<name> there is a _tt_<name> function in
|
||||
* some file named api_mp_*.cc.
|
||||
*/
|
||||
|
||||
#include "mp/mp_c.h"
|
||||
#include "mp/mp_rpc_interface.h"
|
||||
#include "api/c/tt_c.h"
|
||||
#include "api/c/api_api.h"
|
||||
#include "api/c/api_mp.h"
|
||||
#include "api/c/api_handle.h"
|
||||
#include "util/tt_audit.h"
|
||||
|
||||
/*
|
||||
* These functions differ from the usual layering in the API/MP interface.
|
||||
* Usually, we would realize the _Tt_otype and _Tt_otype_table objects on
|
||||
* the client side, with the methods split up so the client side makes
|
||||
* RPC calls and the server side does the work. In this case, this would
|
||||
* end up caching most of the otype information in the client side, which
|
||||
* would give us cache-coherency problems we don't have time to deal with
|
||||
* right now. So we have a simpler interface of the API routines just
|
||||
* making RPC calls to the server. RFM 11/7/90.
|
||||
*/
|
||||
|
||||
extern _Tt_c_mp *_tt_c_mp;
|
||||
|
||||
|
||||
int
|
||||
tt_otype_deriveds_count(const char *otype)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("o", TT_OTYPE_DERIVEDS_COUNT, otype);
|
||||
int result;
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit(error_int(status));
|
||||
return error_int(status);
|
||||
}
|
||||
|
||||
result = _tt_otype_deriveds_count(otype);
|
||||
audit.exit(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
tt_otype_derived(const char *otype, int i)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("oi", TT_OTYPE_DERIVED, otype, i);
|
||||
char *result;
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit((char *)error_pointer(status));
|
||||
return (char *)error_pointer(status);
|
||||
}
|
||||
|
||||
result = _tt_otype_derived(otype, i);
|
||||
audit.exit(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
tt_otype_base(const char *otype)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("o", TT_OTYPE_BASE, otype);
|
||||
char *result;
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit((char *)error_pointer(status));
|
||||
return (char *)error_pointer(status);
|
||||
}
|
||||
|
||||
result = _tt_otype_base(otype);
|
||||
audit.exit(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
tt_otype_is_derived(const char *derivedotype, const char *baseotype)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("oo", TT_OTYPE_IS_DERIVED,
|
||||
derivedotype, baseotype);
|
||||
int result;
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit(error_int(status));
|
||||
return error_int(status);
|
||||
}
|
||||
|
||||
result = _tt_otype_is_derived(derivedotype, baseotype);
|
||||
audit.exit(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
tt_otype_osig_count(const char *otype)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("o", TT_OTYPE_OSIG_COUNT, otype);
|
||||
int result;
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit(error_int(status));
|
||||
return error_int(status);
|
||||
}
|
||||
|
||||
result = _tt_otype_osig_count(otype);
|
||||
audit.exit(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
tt_otype_hsig_count(const char *otype)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("o", TT_OTYPE_HSIG_COUNT, otype);
|
||||
int result;
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit(error_int(status));
|
||||
return error_int(status);
|
||||
}
|
||||
|
||||
result = _tt_otype_hsig_count(otype);
|
||||
audit.exit(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
tt_otype_osig_op(const char *otype, int sig)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("oi", TT_OTYPE_OSIG_OP, otype, sig);
|
||||
char *result;
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit((char *)error_pointer(status));
|
||||
return (char *)error_pointer(status);
|
||||
}
|
||||
|
||||
result = _tt_otype_osig_op(otype, sig);
|
||||
audit.exit(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
tt_otype_hsig_op(const char *otype, int sig)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("oi", TT_OTYPE_HSIG_OP, otype, sig);
|
||||
char *result;
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit((char *)error_pointer(status));
|
||||
return (char *)error_pointer(status);
|
||||
}
|
||||
|
||||
result = _tt_otype_hsig_op(otype, sig);
|
||||
audit.exit(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
tt_otype_osig_args_count(const char *otype, int sig)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("oi", TT_OTYPE_OSIG_ARGS_COUNT, otype, sig);
|
||||
int result;
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit(error_int(status));
|
||||
return error_int(status);
|
||||
}
|
||||
|
||||
result = _tt_otype_osig_args_count(otype, sig);
|
||||
audit.exit(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
tt_otype_hsig_args_count(const char *otype, int sig)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("oi", TT_OTYPE_HSIG_ARGS_COUNT, otype, sig);
|
||||
int result;
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit(error_int(status));
|
||||
return error_int(status);
|
||||
}
|
||||
|
||||
result = _tt_otype_hsig_args_count(otype, sig);
|
||||
audit.exit(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Tt_mode
|
||||
tt_otype_osig_arg_mode(const char *otype, int sig, int arg)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("oii", TT_OTYPE_OSIG_ARG_MODE, otype, sig, arg);
|
||||
Tt_mode result;
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit((Tt_mode)error_int(status));
|
||||
return (Tt_mode) error_int(status);
|
||||
}
|
||||
|
||||
result = _tt_otype_osig_arg_mode(otype, sig, arg);
|
||||
audit.exit(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Tt_mode
|
||||
tt_otype_hsig_arg_mode(const char *otype, int sig, int arg)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("oii", TT_OTYPE_HSIG_ARG_MODE, otype, sig, arg);
|
||||
Tt_mode result;
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit((Tt_mode)error_int(status));
|
||||
return (Tt_mode)error_int(status);
|
||||
}
|
||||
|
||||
result = _tt_otype_hsig_arg_mode(otype, sig, arg);
|
||||
audit.exit(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
tt_otype_osig_arg_type(const char *otype, int sig, int arg)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("oii", TT_OTYPE_OSIG_ARG_TYPE, otype, sig, arg);
|
||||
char *result;
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit((char *)error_pointer(status));
|
||||
return (char *)error_pointer(status);
|
||||
}
|
||||
|
||||
result = _tt_otype_osig_arg_type(otype, sig, arg);
|
||||
audit.exit(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
tt_otype_hsig_arg_type(const char *otype, int sig, int arg)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("oii", TT_OTYPE_HSIG_ARG_TYPE, otype, sig, arg);
|
||||
char *result;
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit((char *)error_pointer(status));
|
||||
return (char *)error_pointer(status);
|
||||
}
|
||||
|
||||
result = _tt_otype_hsig_arg_type(otype, sig, arg);
|
||||
audit.exit(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* otype retrieval functions
|
||||
*/
|
||||
|
||||
int
|
||||
_tt_otype_deriveds_count(const char * otype)
|
||||
{
|
||||
_Tt_otype_args args;
|
||||
_Tt_rpc_result result;
|
||||
_Tt_c_session *d_session;
|
||||
|
||||
d_session = _tt_c_mp->default_c_procid()->default_session().c_pointer();
|
||||
|
||||
args.base_otid = otype;
|
||||
d_session->call(TT_RPC_OTYPE_DERIVEDS_COUNT,
|
||||
(xdrproc_t)tt_xdr_otype_args,
|
||||
(char *)&args,
|
||||
(xdrproc_t)tt_xdr_rpc_result,
|
||||
(char *)&result);
|
||||
if (result.status!=TT_OK) {
|
||||
return error_int(result.status);
|
||||
} else {
|
||||
return result.int_val;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
_tt_otype_derived(const char * otype, int i)
|
||||
{
|
||||
_Tt_otype_args args;
|
||||
_Tt_rpc_result result;
|
||||
_Tt_c_session *d_session;
|
||||
|
||||
d_session = _tt_c_mp->default_c_procid()->default_session().c_pointer();
|
||||
|
||||
args.base_otid = otype;
|
||||
args.num = i;
|
||||
d_session->call(TT_RPC_OTYPE_DERIVED,
|
||||
(xdrproc_t)tt_xdr_otype_args,
|
||||
(char *)&args,
|
||||
(xdrproc_t)tt_xdr_rpc_result,
|
||||
(char *)&result);
|
||||
if (result.status!=TT_OK) {
|
||||
return (char *)error_pointer(result.status);
|
||||
} else {
|
||||
return _tt_strdup(result.str_val);
|
||||
}
|
||||
}
|
||||
|
||||
char *
|
||||
_tt_otype_base(const char *otype)
|
||||
{
|
||||
_Tt_otype_args args;
|
||||
_Tt_rpc_result result;
|
||||
_Tt_c_session *d_session = _tt_c_mp->default_c_procid()->default_session().c_pointer();
|
||||
|
||||
args.derived_otid = otype;
|
||||
d_session->call(TT_RPC_OTYPE_BASE,
|
||||
(xdrproc_t)tt_xdr_otype_args,
|
||||
(char *)&args,
|
||||
(xdrproc_t)tt_xdr_rpc_result,
|
||||
(char *)&result);
|
||||
if (result.status!=TT_OK) {
|
||||
return (char *)error_pointer(result.status);
|
||||
} else {
|
||||
return _tt_strdup(result.str_val);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
_tt_otype_is_derived(const char *derivedotype,
|
||||
const char *baseotype)
|
||||
{
|
||||
_Tt_otype_args args;
|
||||
_Tt_rpc_result result;
|
||||
_Tt_c_session *d_session = _tt_c_mp->default_c_procid()->default_session().c_pointer();
|
||||
|
||||
|
||||
args.derived_otid = derivedotype;
|
||||
args.base_otid = baseotype;
|
||||
|
||||
d_session->call(TT_RPC_OTYPE_IS_DERIVED,
|
||||
(xdrproc_t)tt_xdr_otype_args,
|
||||
(char *)&args,
|
||||
(xdrproc_t)tt_xdr_rpc_result,
|
||||
(char *)&result);
|
||||
if (result.status!=TT_OK) {
|
||||
return 0; // Predicates that return failure are a pain
|
||||
} else {
|
||||
return result.int_val;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
_tt_otype_osig_count(const char *otype)
|
||||
{
|
||||
_Tt_otype_args args;
|
||||
_Tt_rpc_result result;
|
||||
_Tt_c_session *d_session = _tt_c_mp->default_c_procid()->default_session().c_pointer();
|
||||
|
||||
args.base_otid = otype;
|
||||
|
||||
d_session->call(TT_RPC_OTYPE_OSIG_COUNT,
|
||||
(xdrproc_t)tt_xdr_otype_args,
|
||||
(char *)&args,
|
||||
(xdrproc_t)tt_xdr_rpc_result,
|
||||
(char *)&result);
|
||||
if (result.status!=TT_OK) {
|
||||
return error_int(result.status);
|
||||
} else {
|
||||
return result.int_val;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
_tt_otype_hsig_count(const char *otype)
|
||||
{
|
||||
_Tt_otype_args args;
|
||||
_Tt_rpc_result result;
|
||||
_Tt_c_session *d_session = _tt_c_mp->default_c_procid()->default_session().c_pointer();
|
||||
|
||||
args.base_otid = otype;
|
||||
|
||||
d_session->call(TT_RPC_OTYPE_HSIG_COUNT,
|
||||
(xdrproc_t)tt_xdr_otype_args,
|
||||
(char *)&args,
|
||||
(xdrproc_t)tt_xdr_rpc_result,
|
||||
(char *)&result);
|
||||
if (result.status!=TT_OK) {
|
||||
return error_int(result.status);
|
||||
} else {
|
||||
return result.int_val;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
_tt_otype_osig_op(const char *otype, int sig)
|
||||
{
|
||||
_Tt_otype_args args;
|
||||
_Tt_rpc_result result;
|
||||
_Tt_c_session *d_session = _tt_c_mp->default_c_procid()->default_session().c_pointer();
|
||||
|
||||
args.base_otid = otype;
|
||||
args.num = sig;
|
||||
|
||||
d_session->call(TT_RPC_OTYPE_OSIG_OP,
|
||||
(xdrproc_t)tt_xdr_otype_args,
|
||||
(char *)&args,
|
||||
(xdrproc_t)tt_xdr_rpc_result,
|
||||
(char *)&result);
|
||||
if (result.status!=TT_OK) {
|
||||
return (char *)error_pointer(result.status);
|
||||
} else {
|
||||
return _tt_strdup(result.str_val);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
_tt_otype_hsig_op(const char *otype, int sig)
|
||||
{
|
||||
_Tt_otype_args args;
|
||||
_Tt_rpc_result result;
|
||||
_Tt_c_session *d_session = _tt_c_mp->default_c_procid()->default_session().c_pointer();
|
||||
|
||||
args.base_otid = otype;
|
||||
args.num = sig;
|
||||
|
||||
d_session->call(TT_RPC_OTYPE_HSIG_OP,
|
||||
(xdrproc_t)tt_xdr_otype_args,
|
||||
(char *)&args,
|
||||
(xdrproc_t)tt_xdr_rpc_result,
|
||||
(char *)&result);
|
||||
if (result.status!=TT_OK) {
|
||||
return (char *)error_pointer(result.status);
|
||||
} else {
|
||||
return _tt_strdup(result.str_val);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
_tt_otype_osig_args_count(const char *otype, int sig)
|
||||
{
|
||||
_Tt_otype_args args;
|
||||
_Tt_rpc_result result;
|
||||
_Tt_c_session *d_session = _tt_c_mp->default_c_procid()->default_session().c_pointer();
|
||||
|
||||
args.base_otid = otype;
|
||||
args.num = sig;
|
||||
|
||||
d_session->call(TT_RPC_OTYPE_OSIG_ARGS_COUNT,
|
||||
(xdrproc_t)tt_xdr_otype_args,
|
||||
(char *)&args,
|
||||
(xdrproc_t)tt_xdr_rpc_result,
|
||||
(char *)&result);
|
||||
if (result.status!=TT_OK) {
|
||||
return error_int(result.status);
|
||||
} else {
|
||||
return result.int_val;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
_tt_otype_hsig_args_count(const char *otype, int sig)
|
||||
{
|
||||
_Tt_otype_args args;
|
||||
_Tt_rpc_result result;
|
||||
_Tt_c_session *d_session;
|
||||
|
||||
d_session = _tt_c_mp->default_c_procid()->default_session().c_pointer();
|
||||
|
||||
args.base_otid = otype;
|
||||
args.num = sig;
|
||||
|
||||
d_session->call(TT_RPC_OTYPE_HSIG_ARGS_COUNT,
|
||||
(xdrproc_t)tt_xdr_otype_args,
|
||||
(char *)&args,
|
||||
(xdrproc_t)tt_xdr_rpc_result,
|
||||
(char *)&result);
|
||||
if (result.status!=TT_OK) {
|
||||
return error_int(result.status);
|
||||
} else {
|
||||
return result.int_val;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Tt_mode
|
||||
_tt_otype_osig_arg_mode(const char *otype, int sig, int arg)
|
||||
{
|
||||
_Tt_otype_args args;
|
||||
_Tt_rpc_result result;
|
||||
_Tt_c_session *d_session = _tt_c_mp->default_c_procid()->default_session().c_pointer();
|
||||
|
||||
args.base_otid = otype;
|
||||
args.num = sig;
|
||||
args.num2 = arg;
|
||||
|
||||
d_session->call(TT_RPC_OTYPE_OSIG_ARG_MODE,
|
||||
(xdrproc_t)tt_xdr_otype_args,
|
||||
(char *)&args,
|
||||
(xdrproc_t)tt_xdr_rpc_result,
|
||||
(char *)&result);
|
||||
if (result.status!=TT_OK) {
|
||||
return (Tt_mode)error_int(result.status);
|
||||
} else {
|
||||
return (Tt_mode)result.int_val;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Tt_mode
|
||||
_tt_otype_hsig_arg_mode(const char *otype, int sig, int arg)
|
||||
{
|
||||
_Tt_otype_args args;
|
||||
_Tt_rpc_result result;
|
||||
_Tt_c_session *d_session;
|
||||
|
||||
d_session = _tt_c_mp->default_c_procid()->default_session().c_pointer();
|
||||
|
||||
args.base_otid = otype;
|
||||
args.num = sig;
|
||||
args.num2 = arg;
|
||||
|
||||
d_session->call(TT_RPC_OTYPE_HSIG_ARG_MODE,
|
||||
(xdrproc_t)tt_xdr_otype_args,
|
||||
(char *)&args,
|
||||
(xdrproc_t)tt_xdr_rpc_result,
|
||||
(char *)&result);
|
||||
if (result.status!=TT_OK) {
|
||||
return (Tt_mode)error_int(result.status);
|
||||
} else {
|
||||
return (Tt_mode)result.int_val;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
_tt_otype_osig_arg_type(const char *otype, int sig, int arg)
|
||||
{
|
||||
_Tt_otype_args args;
|
||||
_Tt_rpc_result result;
|
||||
_Tt_c_session *d_session = _tt_c_mp->default_c_procid()->default_session().c_pointer();
|
||||
|
||||
args.base_otid = otype;
|
||||
args.num = sig;
|
||||
args.num2 = arg;
|
||||
|
||||
d_session->call(TT_RPC_OTYPE_OSIG_ARG_TYPE,
|
||||
(xdrproc_t)tt_xdr_otype_args,
|
||||
(char *)&args,
|
||||
(xdrproc_t)tt_xdr_rpc_result,
|
||||
(char *)&result);
|
||||
if (result.status!=TT_OK) {
|
||||
return (char *)error_pointer(result.status);
|
||||
} else {
|
||||
return _tt_strdup(result.str_val);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
_tt_otype_hsig_arg_type(const char *otype, int sig, int arg)
|
||||
{
|
||||
_Tt_otype_args args;
|
||||
_Tt_rpc_result result;
|
||||
_Tt_c_session *d_session = _tt_c_mp->default_c_procid()->default_session().c_pointer();
|
||||
|
||||
args.base_otid = otype;
|
||||
args.num = sig;
|
||||
args.num2 = arg;
|
||||
|
||||
d_session->call(TT_RPC_OTYPE_HSIG_ARG_TYPE,
|
||||
(xdrproc_t)tt_xdr_otype_args,
|
||||
(char *)&args,
|
||||
(xdrproc_t)tt_xdr_rpc_result,
|
||||
(char *)&result);
|
||||
if (result.status!=TT_OK) {
|
||||
return (char *)error_pointer(result.status);
|
||||
} else {
|
||||
return _tt_strdup(result.str_val);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Check to see if the given typename is a valid otype by getting its
|
||||
* base class. If the otype doesn't exist, an error will be returned.
|
||||
*/
|
||||
Tt_status
|
||||
_tt_valid_otype(const char *otype)
|
||||
{
|
||||
_Tt_otype_args args;
|
||||
_Tt_rpc_result result;
|
||||
_Tt_c_session *d_session;
|
||||
|
||||
d_session = _tt_c_mp->default_c_procid()->default_session().c_pointer();
|
||||
|
||||
args.derived_otid = otype;
|
||||
d_session->call(TT_RPC_OTYPE_BASE,
|
||||
(xdrproc_t)tt_xdr_otype_args,
|
||||
(char *)&args,
|
||||
(xdrproc_t)tt_xdr_rpc_result,
|
||||
(char *)&result);
|
||||
return result.status;
|
||||
}
|
||||
66
cde/lib/tt/lib/api/c/api_objid_spec.C
Normal file
66
cde/lib/tt/lib/api/c/api_objid_spec.C
Normal file
@@ -0,0 +1,66 @@
|
||||
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
//%% (c) Copyright 1993, 1994 Novell, Inc.
|
||||
//%% $XConsortium: api_objid_spec.C /main/3 1995/10/23 09:53:54 rswiston $
|
||||
/* -*-C++-*-
|
||||
*
|
||||
* api_objid_spec.cc
|
||||
*
|
||||
* Copyright (c) 1990 by Sun Microsystems, Inc.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "api/c/api_objid_spec.h"
|
||||
|
||||
|
||||
_Tt_objid_spec ::
|
||||
_Tt_objid_spec()
|
||||
{
|
||||
onDiskFlag = FALSE;
|
||||
} // end -_Tt_objid_spec()-
|
||||
|
||||
_Tt_objid_spec ::
|
||||
_Tt_objid_spec(_Tt_string objid)
|
||||
|
||||
: _Tt_db_object(objid)
|
||||
{
|
||||
onDiskFlag = TRUE;
|
||||
} // end -_Tt_objid_spec()-
|
||||
|
||||
|
||||
_Tt_objid_spec ::
|
||||
~_Tt_objid_spec()
|
||||
{
|
||||
// nothing special
|
||||
} // end -~_Tt_objid_spec()-
|
||||
|
||||
|
||||
// onDiskFlag - Rules for flag value are:
|
||||
//
|
||||
// 1) Set sync flag to TRUE by default, if the
|
||||
// object is already on disk. If it is a
|
||||
// brand new object that has never been written
|
||||
// to disk, set the flag to FALSE.
|
||||
// 2) If a memory only set is done, set sync
|
||||
// flag to FALSE.
|
||||
// 3) If a write to disk is done, set sync flag
|
||||
// to TRUE.
|
||||
// 4) If sync flag is TRUE, read from disk by
|
||||
// refreshing memory version and calling read
|
||||
// member functions.
|
||||
// 5) If sync flag is FALSE, read from memory.
|
||||
//
|
||||
|
||||
void _Tt_objid_spec ::
|
||||
setOnDiskFlag(bool_t flag)
|
||||
{
|
||||
onDiskFlag = flag;
|
||||
} // end -setOnDiskFlag()-
|
||||
|
||||
|
||||
bool_t _Tt_objid_spec ::
|
||||
getOnDiskFlag()
|
||||
{
|
||||
return onDiskFlag;
|
||||
} // end -getOnDiskFlag()-
|
||||
35
cde/lib/tt/lib/api/c/api_objid_spec.h
Normal file
35
cde/lib/tt/lib/api/c/api_objid_spec.h
Normal file
@@ -0,0 +1,35 @@
|
||||
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
|
||||
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
|
||||
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
|
||||
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
|
||||
/*%% $XConsortium: api_objid_spec.h /main/3 1995/10/23 09:54:02 rswiston $ */
|
||||
/* -*-C++-*-
|
||||
*
|
||||
* api_objid_spec.h
|
||||
*
|
||||
* Copyright (c) 1990 by Sun Microsystems, Inc.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _API_OBJID_SPEC_H
|
||||
#define _API_OBJID_SPEC_H
|
||||
|
||||
#include "db/tt_db_object_utils.h"
|
||||
|
||||
class _Tt_objid_spec : public _Tt_db_object {
|
||||
public:
|
||||
_Tt_objid_spec();
|
||||
_Tt_objid_spec(_Tt_string objid);
|
||||
~_Tt_objid_spec();
|
||||
|
||||
void setOnDiskFlag(bool_t flag);
|
||||
bool_t getOnDiskFlag();
|
||||
|
||||
private:
|
||||
bool_t onDiskFlag; // memory refresh flag
|
||||
};
|
||||
|
||||
declare_derived_ptr_to(_Tt_objid_spec, _Tt_db_object)
|
||||
declare_table_of(_Tt_objid_spec)
|
||||
|
||||
#endif // _API_OBJID_SPEC_H
|
||||
1782
cde/lib/tt/lib/api/c/api_pattern.C
Normal file
1782
cde/lib/tt/lib/api/c/api_pattern.C
Normal file
File diff suppressed because it is too large
Load Diff
397
cde/lib/tt/lib/api/c/api_session_prop.C
Normal file
397
cde/lib/tt/lib/api/c/api_session_prop.C
Normal file
@@ -0,0 +1,397 @@
|
||||
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
//%% (c) Copyright 1993, 1994 Novell, Inc.
|
||||
//%% $XConsortium: api_session_prop.C /main/4 1995/11/28 19:22:54 cde-sun $
|
||||
/*
|
||||
*
|
||||
* api_session_prop.cc
|
||||
*
|
||||
* Copyright (c) 1990 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#include "mp/mp_c.h"
|
||||
#include "api/c/tt_c.h"
|
||||
#include "api/c/api_api.h"
|
||||
#include "api/c/api_mp.h"
|
||||
#include "api/c/api_handle.h"
|
||||
#include "util/tt_audit.h"
|
||||
|
||||
|
||||
char *
|
||||
tt_session_prop(const char *sessid, const char *propname, int i)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("Cri", TT_SESSION_PROP, sessid,
|
||||
propname, i);
|
||||
char *result;
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit((char *)error_pointer(status));
|
||||
return (char *)error_pointer(status);
|
||||
}
|
||||
|
||||
result = _tt_session_prop(sessid, propname, i);
|
||||
audit.exit(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Tt_status
|
||||
tt_session_prop_add(const char *sessid, const char *propname, const char *value)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("CrnI", TT_SESSION_PROP_ADD, sessid,
|
||||
propname, value,
|
||||
(char *) 0 == value ? 0 : strlen(value));
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit(status);
|
||||
return status;
|
||||
}
|
||||
|
||||
status = _tt_session_prop_add(sessid, propname, value);
|
||||
audit.exit(status);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
tt_session_prop_count(const char *sessid, const char *propname)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("Cr", TT_SESSION_PROP_COUNT,
|
||||
sessid, propname);
|
||||
int result;
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit(error_int(status));
|
||||
return error_int(status);
|
||||
}
|
||||
|
||||
result = _tt_session_prop_count(sessid, propname);
|
||||
audit.exit(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Tt_status
|
||||
tt_session_prop_set(const char *sessid, const char *propname,
|
||||
const char *value)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("CrnI", TT_SESSION_PROP_SET, sessid,
|
||||
propname, value,
|
||||
(char *) 0 == value ? 0 : strlen(value));
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit(status);
|
||||
return status;
|
||||
}
|
||||
|
||||
status = _tt_session_prop_set(sessid, propname, value);
|
||||
audit.exit(status);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
Tt_status
|
||||
tt_session_bprop(const char *sessid, const char *propname, int i,
|
||||
unsigned char **value, int *length)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("Cri", TT_SESSION_BPROP, sessid,
|
||||
propname, i);
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit(status);
|
||||
return status;
|
||||
}
|
||||
|
||||
status = _tt_session_bprop(sessid, propname, i, value, length);
|
||||
audit.exit(status);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
Tt_status
|
||||
tt_session_bprop_add(const char *sessid, const char *propname,
|
||||
const unsigned char *value, int length)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("CrnI", TT_SESSION_BPROP_ADD, sessid,
|
||||
propname, value, length);
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit(status);
|
||||
return status;
|
||||
}
|
||||
|
||||
status = _tt_session_bprop_add(sessid, propname, value, length);
|
||||
audit.exit(status);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
Tt_status
|
||||
tt_session_bprop_set(const char *sessid, const char *propname,
|
||||
const unsigned char *value, int length)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("CrnI", TT_SESSION_BPROP_ADD, sessid,
|
||||
propname, value, length);
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit(status);
|
||||
return status;
|
||||
}
|
||||
|
||||
status = _tt_session_bprop_set(sessid, propname, value, length);
|
||||
audit.exit(status);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
tt_session_propname(const char *sessid, int n)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("Ci", TT_SESSION_PROPNAME, sessid, n);
|
||||
char *result;
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit((char *)error_pointer(status));
|
||||
return (char *)error_pointer(status);
|
||||
}
|
||||
|
||||
result = _tt_session_propname(sessid, n);
|
||||
audit.exit(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
tt_session_propnames_count(const char *sessid)
|
||||
{
|
||||
_Tt_audit audit;
|
||||
Tt_status status = audit.entry("C", TT_SESSION_PROPNAMES_COUNT,
|
||||
sessid);
|
||||
int result;
|
||||
|
||||
if (status != TT_OK) {
|
||||
audit.exit(error_int(status));
|
||||
return error_int(status);
|
||||
}
|
||||
|
||||
result = _tt_session_propnames_count(sessid);
|
||||
audit.exit(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* return the character string value of the specified property on the session
|
||||
*/
|
||||
char *
|
||||
_tt_session_prop(const char *sessid, const char *propname, int i)
|
||||
{
|
||||
unsigned char *v;
|
||||
int junk;
|
||||
Tt_status rc;
|
||||
|
||||
rc = _tt_session_bprop(sessid,propname,i, &v, &junk);
|
||||
if (rc==TT_OK) {
|
||||
return (char *)v;
|
||||
} else {
|
||||
return (char *)error_pointer(rc);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the ith value of the specified property on the session
|
||||
*/
|
||||
Tt_status
|
||||
_tt_session_bprop(const char *sessid, const char *propname,
|
||||
int i, unsigned char **value, int *length)
|
||||
{
|
||||
_Tt_string val;
|
||||
Tt_status err;
|
||||
_Tt_c_session *d_session;
|
||||
_Tt_c_procid *d_procid = _tt_c_mp->default_c_procid().c_pointer();
|
||||
|
||||
|
||||
PCOMMIT;
|
||||
|
||||
d_session = _tt_c_mp->default_c_procid()->default_session().c_pointer();
|
||||
if (!strcmp(sessid,(char *)(d_session->id()))) {
|
||||
err = d_session->c_getprop(propname, i, val);
|
||||
if (err != TT_OK) {
|
||||
return err;
|
||||
}
|
||||
if (val.len() == 0) {
|
||||
*value = (unsigned char *)tt_malloc(1);
|
||||
**value = '\0';
|
||||
*length = 0;
|
||||
} else {
|
||||
*length = val.len();
|
||||
*value = (unsigned char *)_tt_strdup(val, *length);
|
||||
}
|
||||
return TT_OK;
|
||||
} else {
|
||||
return TT_ERR_POINTER;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Add the character string value to the property for the session
|
||||
*/
|
||||
Tt_status
|
||||
_tt_session_prop_add(const char *sessid, const char *propname,
|
||||
const char *value)
|
||||
{
|
||||
return _tt_session_bprop_add(sessid, propname,
|
||||
(unsigned char *)value,
|
||||
(char *)0==value?0:strlen(value));
|
||||
}
|
||||
|
||||
/*
|
||||
* Add the value to the property for the session
|
||||
*/
|
||||
Tt_status
|
||||
_tt_session_bprop_add(const char *sessid, const char *propname,
|
||||
unsigned const char *value, int length)
|
||||
{
|
||||
_Tt_c_session *d_session;
|
||||
_Tt_string val(value, length);
|
||||
_Tt_c_procid *d_procid = _tt_c_mp->default_c_procid().c_pointer();
|
||||
|
||||
PCOMMIT;
|
||||
|
||||
d_session = _tt_c_mp->default_c_procid()->default_session().c_pointer();
|
||||
if (!strcmp(sessid, (char *)(d_session->id()))) {
|
||||
return d_session->c_addprop(propname, val);
|
||||
} else {
|
||||
return TT_ERR_POINTER;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the number of values for the property on the session
|
||||
*/
|
||||
int
|
||||
_tt_session_prop_count(const char *sessid, const char *propname)
|
||||
{
|
||||
int cnt;
|
||||
Tt_status err;
|
||||
_Tt_c_session *d_session;
|
||||
_Tt_c_procid *d_procid = _tt_c_mp->default_c_procid().c_pointer();
|
||||
|
||||
PCOMMIT;
|
||||
|
||||
d_session = d_procid->default_session().c_pointer();
|
||||
if (!strcmp(sessid,(char *)(d_session->id()))) {
|
||||
err = d_session->c_propcount(propname, cnt);
|
||||
if (err != TT_OK) {
|
||||
return error_int(err);
|
||||
} else {
|
||||
return cnt;
|
||||
}
|
||||
} else {
|
||||
return error_int(TT_ERR_POINTER);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Replace all the values of the property of the session with the
|
||||
* supplied character string value
|
||||
*/
|
||||
Tt_status
|
||||
_tt_session_prop_set(const char *sessid, const char *propname,
|
||||
const char *value)
|
||||
{
|
||||
return _tt_session_bprop_set(sessid, propname,
|
||||
(unsigned char *)value,
|
||||
(char *) 0 == value ? 0 : strlen(value));
|
||||
}
|
||||
|
||||
/*
|
||||
* Replace all of the values of the property of the session
|
||||
*/
|
||||
Tt_status
|
||||
_tt_session_bprop_set(const char *sessid, const char *propname,
|
||||
unsigned const char *value, int length)
|
||||
{
|
||||
_Tt_string val(value, length);
|
||||
_Tt_c_session *d_session;
|
||||
_Tt_c_procid *d_procid = _tt_c_mp->default_c_procid().c_pointer();
|
||||
|
||||
PCOMMIT;
|
||||
|
||||
d_session = d_procid->default_session().c_pointer();
|
||||
if (!strcmp(sessid,(char *)(d_session->id()))) {
|
||||
return(d_session->c_setprop(propname, val));
|
||||
} else {
|
||||
return TT_ERR_POINTER;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the nth propname of the session
|
||||
*/
|
||||
char *
|
||||
_tt_session_propname(const char *sessid, int n)
|
||||
{
|
||||
_Tt_string prop;
|
||||
Tt_status err;
|
||||
_Tt_c_session *d_session;
|
||||
_Tt_c_procid *d_procid = _tt_c_mp->default_c_procid().c_pointer();
|
||||
|
||||
PTR_PCOMMIT(char_ptr);
|
||||
|
||||
d_session = d_procid->default_session().c_pointer();
|
||||
if (!strcmp(sessid,(char *)(d_session->id()))) {
|
||||
err = d_session->c_propname(n, prop);
|
||||
if (err != TT_OK) {
|
||||
return (char *)error_pointer(err);
|
||||
}
|
||||
return _tt_strdup(prop);
|
||||
} else {
|
||||
return (char *)error_pointer(TT_ERR_POINTER);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the number of properties on the session
|
||||
*/
|
||||
int
|
||||
_tt_session_propnames_count(const char *sessid)
|
||||
{
|
||||
int cnt;
|
||||
Tt_status err;
|
||||
_Tt_c_session *d_session;
|
||||
_Tt_c_procid *d_procid = _tt_c_mp->default_c_procid().c_pointer();
|
||||
|
||||
PCOMMIT;
|
||||
|
||||
d_session = d_procid->default_session().c_pointer();
|
||||
if (!strcmp(sessid,(char *)(d_session->id()))) {
|
||||
err = d_session->c_propnames_count(cnt);
|
||||
if (err != TT_OK) {
|
||||
return error_int(err);
|
||||
} else {
|
||||
return cnt;
|
||||
}
|
||||
} else {
|
||||
return error_int(TT_ERR_POINTER);
|
||||
}
|
||||
}
|
||||
1036
cde/lib/tt/lib/api/c/api_spec.C
Normal file
1036
cde/lib/tt/lib/api/c/api_spec.C
Normal file
File diff suppressed because it is too large
Load Diff
128
cde/lib/tt/lib/api/c/api_spec_map_ref.C
Normal file
128
cde/lib/tt/lib/api/c/api_spec_map_ref.C
Normal file
@@ -0,0 +1,128 @@
|
||||
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
//%% (c) Copyright 1993, 1994 Novell, Inc.
|
||||
//%% $TOG: api_spec_map_ref.C /main/4 1999/10/14 18:39:43 mgreess $
|
||||
/* -*-C++-*-
|
||||
*
|
||||
* api_spec_map_ref.cc
|
||||
*
|
||||
* Copyright (c) 1990 by Sun Microsystems, Inc.
|
||||
*
|
||||
* implement a class which maps specs to tt_db_objects
|
||||
*/
|
||||
|
||||
#include "api/c/api_error.h"
|
||||
#include "api/c/api_spec_map_ref.h"
|
||||
#include "db/tt_db_objid_to_key.h"
|
||||
|
||||
_Tt_objid_spec_table_ptr *_Tt_api_spec_map_ref :: apiSpecMapP = (_Tt_objid_spec_table_ptr *) 0;
|
||||
|
||||
_Tt_api_spec_map_ref ::
|
||||
_Tt_api_spec_map_ref()
|
||||
{
|
||||
if (apiSpecMapP == NULL) {
|
||||
apiSpecMapP = new _Tt_objid_spec_table_ptr;
|
||||
*apiSpecMapP =
|
||||
new _Tt_objid_spec_table ((_Tt_object_table_keyfn)
|
||||
&_Tt_api_spec_map_ref::apiSpecKey);
|
||||
}
|
||||
} // end -_Tt_api_spec_map_ref()-
|
||||
|
||||
|
||||
_Tt_api_spec_map_ref ::
|
||||
~_Tt_api_spec_map_ref()
|
||||
{
|
||||
} // end -~_Tt_db_spec_map_ref()-
|
||||
|
||||
|
||||
// Call this at tt_close() only.
|
||||
//
|
||||
void _Tt_api_spec_map_ref ::
|
||||
flush()
|
||||
{
|
||||
if (apiSpecMapP != NULL) {
|
||||
delete apiSpecMapP;
|
||||
apiSpecMapP = NULL;
|
||||
}
|
||||
} // end flush()-
|
||||
|
||||
|
||||
// addSpec is done after a C++ `new' has been done to create a spec,
|
||||
// and after that spec has been used to initialize the associated
|
||||
// _Tt_db_object via the _Tt_db_object.create() call.
|
||||
//
|
||||
Tt_status _Tt_api_spec_map_ref ::
|
||||
addSpec(_Tt_objid_spec_ptr specP)
|
||||
{
|
||||
_Tt_objid_spec_ptr foundSpecP;
|
||||
|
||||
foundSpecP = (*apiSpecMapP)->lookup(specP->getObjectKey());
|
||||
if (!foundSpecP.is_null()) {
|
||||
return TT_ERR_INVALID;
|
||||
}
|
||||
|
||||
(*apiSpecMapP)->insert(specP); // add spec to table
|
||||
specP->setOnDiskFlag(FALSE);
|
||||
|
||||
return TT_OK;
|
||||
} // end -addSpec()-
|
||||
|
||||
|
||||
// Delete a spec from the spec map
|
||||
//
|
||||
void _Tt_api_spec_map_ref ::
|
||||
deleteSpec(_Tt_string objid)
|
||||
{
|
||||
_Tt_objid_spec_ptr foundSpecP;
|
||||
_Tt_string objkey = _tt_db_objid_to_key(objid);
|
||||
|
||||
// check memory
|
||||
foundSpecP = (*apiSpecMapP)->lookup(objkey);
|
||||
if (foundSpecP.is_null()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// remove spec from table
|
||||
(*apiSpecMapP)->remove(objkey);
|
||||
|
||||
} // end -deleteSpec()-
|
||||
|
||||
|
||||
// Check for memory version first, returning it if found.
|
||||
// Else, look for it on disk. If it's found on disk add
|
||||
// it to memory copy, and return it. If it's not on disk,
|
||||
// return null and set apiError to reflect Tt_db_result.
|
||||
//
|
||||
_Tt_objid_spec_ptr _Tt_api_spec_map_ref ::
|
||||
getSpec(_Tt_string objid)
|
||||
{
|
||||
_Tt_string objkey = _tt_db_objid_to_key(objid);
|
||||
_Tt_objid_spec_ptr foundSpecP = (*apiSpecMapP)->lookup(objkey);
|
||||
|
||||
if (!foundSpecP.is_null()) {
|
||||
if (foundSpecP->getOnDiskFlag()) {
|
||||
foundSpecP->refresh();
|
||||
}
|
||||
} else {
|
||||
// search tt_db on disk for spec
|
||||
_Tt_objid_spec_ptr foundSpecP = new _Tt_objid_spec(objid);
|
||||
_Tt_db_results status;
|
||||
|
||||
status = foundSpecP->getDBResults();
|
||||
if (_tt_get_api_error(status, _TT_API_SPEC) > TT_WRN_LAST) {
|
||||
return (_Tt_objid_spec_ptr) 0;
|
||||
}
|
||||
|
||||
// found it
|
||||
addSpec(foundSpecP); // add spec to spec table
|
||||
foundSpecP->setOnDiskFlag(TRUE);
|
||||
}
|
||||
return foundSpecP;
|
||||
} // end -getSpec()-
|
||||
|
||||
_Tt_string _Tt_api_spec_map_ref ::
|
||||
apiSpecKey (_Tt_object_ptr &obj)
|
||||
{
|
||||
return (((_Tt_objid_spec *)obj.c_pointer())->getObjectKey());
|
||||
} // end -apiSpecKey()-
|
||||
46
cde/lib/tt/lib/api/c/api_spec_map_ref.h
Normal file
46
cde/lib/tt/lib/api/c/api_spec_map_ref.h
Normal file
@@ -0,0 +1,46 @@
|
||||
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
|
||||
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
|
||||
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
|
||||
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
|
||||
/*%% $XConsortium: api_spec_map_ref.h /main/3 1995/10/23 09:54:47 rswiston $ */
|
||||
/* -*-C++-*-
|
||||
*
|
||||
* api_spec_map_ref.h
|
||||
*
|
||||
* Copyright (c) 1990 by Sun Microsystems, Inc.
|
||||
*
|
||||
* define a class which maps objids to specs (tt_db_objects)
|
||||
*/
|
||||
|
||||
#ifndef _API_SPEC_MAP_REF_H
|
||||
#define _API_SPEC_MAP_REF_H
|
||||
|
||||
#include "api/c/api_objid_spec.h"
|
||||
|
||||
class _Tt_api_spec_map_ref : public _Tt_allocated {
|
||||
public:
|
||||
_Tt_api_spec_map_ref();
|
||||
~_Tt_api_spec_map_ref();
|
||||
|
||||
// Add the supplied spec to the tt_db_object table.
|
||||
Tt_status addSpec(_Tt_objid_spec_ptr specP);
|
||||
|
||||
// Delete the associated spec from the tt_db_object
|
||||
// table.
|
||||
void deleteSpec(_Tt_string objid);
|
||||
|
||||
// Return the spec associated w/ supplied objid
|
||||
_Tt_objid_spec_ptr getSpec(_Tt_string objid);
|
||||
|
||||
// de-allocate the table associated with apiSpecMapP
|
||||
// below, when tt_close() is called.
|
||||
static void flush();
|
||||
|
||||
// hash function
|
||||
static _Tt_string apiSpecKey(_Tt_object_ptr &Obj);
|
||||
private:
|
||||
static _Tt_objid_spec_table_ptr *apiSpecMapP;
|
||||
|
||||
};
|
||||
|
||||
#endif // _API_SPEC_MAP_REF_H
|
||||
164
cde/lib/tt/lib/api/c/api_storage.C
Normal file
164
cde/lib/tt/lib/api/c/api_storage.C
Normal file
@@ -0,0 +1,164 @@
|
||||
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
//%% (c) Copyright 1993, 1994 Novell, Inc.
|
||||
//%% $XConsortium: api_storage.C /main/3 1995/10/23 09:54:55 rswiston $
|
||||
/*
|
||||
*
|
||||
* api_storage.cc
|
||||
*
|
||||
* Copyright (c) 1990 by Sun Microsystems, Inc.
|
||||
*
|
||||
* implementation of api storage classes
|
||||
*
|
||||
* NOTE: this implementation is rather over-abstract, using the
|
||||
* generic list classes to manage the stack. If this turns out
|
||||
* to be too expensive, a very simple array-of-void* could
|
||||
* be used; the marks could just be special entries (since malloc()
|
||||
* always returns addresses on a doubleword boundary, any void* that's
|
||||
* not a multiple of 8 would be distinguishable.) The only problem would
|
||||
* be growing the array when out of room.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "api/c/api_storage.h"
|
||||
|
||||
_Tt_api_stg_stack::
|
||||
_Tt_api_stg_stack(){
|
||||
mark_counter = 0;
|
||||
stack = new _Tt_api_stg_stack_elm_list;
|
||||
}
|
||||
|
||||
_Tt_api_stg_stack::
|
||||
~_Tt_api_stg_stack(){
|
||||
}
|
||||
|
||||
int _Tt_api_stg_stack::
|
||||
mark()
|
||||
{
|
||||
int result = ++mark_counter;
|
||||
_Tt_api_stg_stack_elm_ptr e = new _Tt_api_stg_stack_elm;
|
||||
|
||||
e->entry_type = _Tt_api_stg_stack_elm::STACK_MARK;
|
||||
e->addr = (caddr_t) result;
|
||||
stack->push(e);
|
||||
return result;
|
||||
}
|
||||
|
||||
void _Tt_api_stg_stack::
|
||||
release(int mark)
|
||||
{
|
||||
// it's tempting to just pop and free until we get to the
|
||||
// matching mark, but that would be terrible if the mark
|
||||
// didn't exist (e.g. two releases for the same mark):
|
||||
// we'd free *everything*.
|
||||
|
||||
_Tt_api_stg_stack_elm_list_cursor c(stack);
|
||||
int found = 0;
|
||||
|
||||
while(!found && c.next()) {
|
||||
if (c->entry_type == _Tt_api_stg_stack_elm::STACK_MARK)
|
||||
/* It is better to promote mark to caddr_t than to demote addr
|
||||
field for a 64 bit arch */
|
||||
if (c->addr == (caddr_t) mark) {
|
||||
found = 1;
|
||||
}
|
||||
}
|
||||
if (!found) return;
|
||||
do {
|
||||
if (c->entry_type == _Tt_api_stg_stack_elm::STACK_STORAGE) {
|
||||
::free((MALLOCTYPE *)c->addr);
|
||||
}
|
||||
c.remove();
|
||||
} while(c.prev());
|
||||
return;
|
||||
}
|
||||
|
||||
caddr_t _Tt_api_stg_stack::
|
||||
#ifdef _DEBUG_MALLOC_INC
|
||||
debug_malloc(char *fname, int lnum, size_t size)
|
||||
#else
|
||||
malloc(size_t size)
|
||||
#endif
|
||||
{
|
||||
caddr_t p = (caddr_t)::malloc(size);
|
||||
if (p==0) return p;
|
||||
|
||||
_Tt_api_stg_stack_elm_ptr e = new _Tt_api_stg_stack_elm;
|
||||
e->entry_type = _Tt_api_stg_stack_elm::STACK_STORAGE;
|
||||
e->addr = p;
|
||||
stack->push(e);
|
||||
return p;
|
||||
}
|
||||
|
||||
caddr_t _Tt_api_stg_stack::
|
||||
take(caddr_t addr)
|
||||
{
|
||||
_Tt_api_stg_stack_elm_ptr e = new _Tt_api_stg_stack_elm;
|
||||
e->entry_type = _Tt_api_stg_stack_elm::STACK_STORAGE;
|
||||
e->addr = addr;
|
||||
stack->push(e);
|
||||
return addr;
|
||||
}
|
||||
|
||||
void _Tt_api_stg_stack::
|
||||
#ifdef _DEBUG_MALLOC_INC
|
||||
debug_free(char *fname, int lnum, caddr_t addr)
|
||||
#else
|
||||
free(caddr_t addr)
|
||||
#endif
|
||||
{
|
||||
_Tt_api_stg_stack_elm_list_cursor c(stack);
|
||||
|
||||
while(c.prev()) {
|
||||
if (c->entry_type == _Tt_api_stg_stack_elm::STACK_STORAGE)
|
||||
if (c->addr == addr) {
|
||||
::free((MALLOCTYPE *)c->addr);
|
||||
c.remove();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_tt_api_stg_stack_elm_print(FILE *fs, const _Tt_object *obj)
|
||||
{
|
||||
((_Tt_api_stg_stack_elm *)obj)->print(fs);
|
||||
}
|
||||
|
||||
/*
|
||||
* Print a _Tt_api_stg_stack
|
||||
void _Tt_api_stg_stack::
|
||||
print(FILE *f) const
|
||||
{
|
||||
(void)fprintf(f,"_Tt_api_stg_stack at %lx <\n",this);
|
||||
(void)fprintf(f,"mark_counter: %d\n",mark_counter);
|
||||
stack->print(_tt_api_stg_stack_elm_print);
|
||||
(void)fprintf(f,"> _Tt_api_stg_stack at %lx\n",this);
|
||||
}
|
||||
*/
|
||||
|
||||
_Tt_api_stg_stack_elm::
|
||||
~_Tt_api_stg_stack_elm()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* Print a _Tt_api_stg_stack_elm
|
||||
*/
|
||||
void _Tt_api_stg_stack_elm::
|
||||
print(FILE *f) const
|
||||
{
|
||||
|
||||
(void)fprintf(f,"_Tt_api_stg_stack_elm at %lx <",this);
|
||||
switch (entry_type) {
|
||||
case STACK_MARK:
|
||||
(void)fprintf(f,"mark %ld>\n",addr);
|
||||
break;
|
||||
case STACK_STORAGE:
|
||||
(void)fprintf(f,"addr 0x%lx>\n",(long)addr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
59
cde/lib/tt/lib/api/c/api_storage.h
Normal file
59
cde/lib/tt/lib/api/c/api_storage.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
|
||||
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
|
||||
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
|
||||
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
|
||||
/*%% $XConsortium: api_storage.h /main/3 1995/10/23 09:55:04 rswiston $ */
|
||||
/* -*-C++-*-
|
||||
*
|
||||
* api_storage.h
|
||||
*
|
||||
* Copyright (c) 1990 by Sun Microsystems, Inc.
|
||||
*
|
||||
* mark/release storage management for storage returned over api
|
||||
*/
|
||||
#if !defined(_API_STORAGE_H)
|
||||
#define _API_STORAGE_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <malloc.h>
|
||||
#include "util/tt_object.h"
|
||||
#include "util/tt_list.h"
|
||||
|
||||
declare_list_of(_Tt_api_stg_stack_elm)
|
||||
declare_ptr_to(_Tt_api_stg_stack)
|
||||
|
||||
class _Tt_api_stg_stack_elm : public _Tt_object {
|
||||
public:
|
||||
_Tt_api_stg_stack_elm() {};
|
||||
~_Tt_api_stg_stack_elm();
|
||||
enum {STACK_MARK, STACK_STORAGE} entry_type;
|
||||
caddr_t addr;
|
||||
void print(FILE *fs = stdout) const;
|
||||
};
|
||||
|
||||
class _Tt_api_stg_stack : public _Tt_object {
|
||||
public:
|
||||
_Tt_api_stg_stack();
|
||||
virtual ~_Tt_api_stg_stack();
|
||||
int mark();
|
||||
void release(int mark);
|
||||
#ifdef _DEBUG_MALLOC_INC
|
||||
caddr_t debug_malloc(char *fname,int lnum,size_t size);
|
||||
#else
|
||||
caddr_t malloc(size_t size);
|
||||
#endif
|
||||
// take(p,s) is for taking a normally ::malloc'ed chunk of
|
||||
// storage and putting it under mark/release control.
|
||||
caddr_t take(caddr_t addr);
|
||||
#ifdef _DEBUG_MALLOC_INC
|
||||
void debug_free(char *fname,int lnum,caddr_t addr);
|
||||
#else
|
||||
void free(caddr_t addr);
|
||||
#endif
|
||||
void print(FILE *fs = stdout) const;
|
||||
private:
|
||||
_Tt_api_stg_stack_elm_list_ptr stack;
|
||||
int mark_counter;
|
||||
};
|
||||
|
||||
#endif
|
||||
91
cde/lib/tt/lib/api/c/api_typecb.C
Normal file
91
cde/lib/tt/lib/api/c/api_typecb.C
Normal file
@@ -0,0 +1,91 @@
|
||||
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
//%% (c) Copyright 1993, 1994 Novell, Inc.
|
||||
//%% $TOG: api_typecb.C /main/5 1999/10/14 18:39:57 mgreess $
|
||||
/* @(#)api_typecb.C 1.2 93/07/30 SMI
|
||||
*
|
||||
* Copyright (c) 1993
|
||||
*
|
||||
* Implementation of the class that holds <typename,opnum,callbacklist>
|
||||
* triples that are attached to the _Tt_c_procid instance to hold callbacks
|
||||
* registered by tt_ptype_opnum_callback_add and tt_otype_opnum_callback_add.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "api/c/api_typecb.h"
|
||||
#include "api/c/api_handle.h"
|
||||
#include "util/tt_trace.h"
|
||||
#include "util/tt_global_env.h"
|
||||
|
||||
_Tt_typecb::
|
||||
_Tt_typecb()
|
||||
{
|
||||
clientdata = 0;
|
||||
}
|
||||
|
||||
_Tt_typecb::
|
||||
_Tt_typecb(const _Tt_string &typenm, int opnum)
|
||||
{
|
||||
_typename = typenm;
|
||||
_opnum = opnum;
|
||||
clientdata = 0;
|
||||
}
|
||||
|
||||
_Tt_typecb::
|
||||
~_Tt_typecb()
|
||||
{
|
||||
}
|
||||
|
||||
_Tt_string & _Tt_typecb::
|
||||
get_typename()
|
||||
{
|
||||
return _typename;
|
||||
}
|
||||
|
||||
int _Tt_typecb::
|
||||
opnum()
|
||||
{
|
||||
return _opnum;
|
||||
}
|
||||
|
||||
// XXX: these functions are copies of _Tt_api_handle::add_callback
|
||||
// and _Tt_api_handle::run_callbacks.
|
||||
// Should there be a common parent class of _Tt_api_handle and _Tt_typecb
|
||||
// to reflect that they both contain lists of callbacks?
|
||||
// Or should there be a "smart" callback-list class that wraps around
|
||||
// the _Tt_api_callback_list class and implements add_ and run_?
|
||||
|
||||
void _Tt_typecb::
|
||||
add_callback(Tt_message_callback f)
|
||||
{
|
||||
if (cblp.is_null()) {
|
||||
cblp = new _Tt_api_callback_list;
|
||||
}
|
||||
|
||||
_Tt_api_callback_ptr cb = new _Tt_api_callback;
|
||||
cb->callback = f;
|
||||
|
||||
cblp->push(cb);
|
||||
}
|
||||
|
||||
Tt_callback_action _Tt_typecb::
|
||||
run_callbacks(Tt_message mh, Tt_pattern ph)
|
||||
{
|
||||
Tt_callback_action result = TT_CALLBACK_CONTINUE;
|
||||
_Tt_api_callback_list_cursor c(cblp);
|
||||
_Tt_trace trace;
|
||||
|
||||
_tt_global->drop_mutex();
|
||||
|
||||
while (result==TT_CALLBACK_CONTINUE && c.next()) {
|
||||
trace.entry(c->callback, mh, ph);
|
||||
result = (c->callback)(mh,ph);
|
||||
trace.exit(result);
|
||||
}
|
||||
|
||||
_tt_global->grab_mutex();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
48
cde/lib/tt/lib/api/c/api_typecb.h
Normal file
48
cde/lib/tt/lib/api/c/api_typecb.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
|
||||
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
|
||||
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
|
||||
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
|
||||
/*%% $TOG: api_typecb.h /main/5 1999/10/14 18:40:11 mgreess $ */
|
||||
/* -*-C++-*-
|
||||
*
|
||||
* @(#)api_typecb.h 1.2 93/07/30 SMI
|
||||
*
|
||||
* Copyright (c) 1993 by Sun Microsystems, Inc.
|
||||
*
|
||||
* _Tt_typecb is a class which holds a <typename, opnum, callback list>
|
||||
* triple. Tables of these are attached to _Tt_c_procid instances to hold
|
||||
* the callbacks registerd by tt_ptype_opnum_callback_add and
|
||||
* tt_otype_opnum_callback_add.
|
||||
*/
|
||||
|
||||
#ifndef _API_TYPECB_H
|
||||
#define _API_TYPECB_H
|
||||
|
||||
#include "util/tt_object.h"
|
||||
#include "api/c/tt_c.h"
|
||||
#include "api/c/api_handle.h"
|
||||
|
||||
#if defined(linux)
|
||||
// Avoid g++ compiler errors on linux.
|
||||
#define typename typenm
|
||||
#endif
|
||||
|
||||
class _Tt_typecb : public _Tt_object {
|
||||
public:
|
||||
_Tt_typecb();
|
||||
_Tt_typecb(const _Tt_string &typenm, int opnum);
|
||||
virtual ~_Tt_typecb();
|
||||
_Tt_string & get_typename();
|
||||
int opnum();
|
||||
void add_callback(Tt_message_callback f);
|
||||
Tt_callback_action run_callbacks(Tt_message mh, Tt_pattern ph);
|
||||
void *clientdata;
|
||||
private:
|
||||
_Tt_string _typename;
|
||||
int _opnum;
|
||||
_Tt_api_callback_list_ptr cblp;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* _MP_PATTERN_H */
|
||||
36
cde/lib/tt/lib/api/c/api_typecb_utils.C
Normal file
36
cde/lib/tt/lib/api/c/api_typecb_utils.C
Normal file
@@ -0,0 +1,36 @@
|
||||
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
//%% (c) Copyright 1993, 1994 Novell, Inc.
|
||||
//%% $TOG: api_typecb_utils.C /main/4 1999/10/14 18:40:24 mgreess $
|
||||
/* @(#)api_typecb_utils.C 1.2 93/07/30 SMI
|
||||
*
|
||||
* api_typecb_utils.cc
|
||||
*
|
||||
* Copyright (c) 1993 by Sun Microsystems, Inc.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include "api/c/api_typecb_utils.h"
|
||||
#include "api/c/api_typecb.h"
|
||||
|
||||
class _Tt_typecb;
|
||||
_Tt_string
|
||||
_tt_typecb_key(_Tt_object_ptr &o)
|
||||
{
|
||||
_Tt_string name;
|
||||
int num;
|
||||
name = ((_Tt_typecb *)o.c_pointer())->get_typename();
|
||||
num = ((_Tt_typecb *)o.c_pointer())->opnum();
|
||||
return _tt_typecb_key(name, num);
|
||||
}
|
||||
|
||||
_Tt_string
|
||||
_tt_typecb_key(const _Tt_string &tid, int opnum)
|
||||
{
|
||||
return tid.cat("#").cat(opnum);
|
||||
}
|
||||
|
||||
|
||||
implement_list_of(_Tt_typecb)
|
||||
|
||||
implement_table_of(_Tt_typecb)
|
||||
27
cde/lib/tt/lib/api/c/api_typecb_utils.h
Normal file
27
cde/lib/tt/lib/api/c/api_typecb_utils.h
Normal file
@@ -0,0 +1,27 @@
|
||||
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
|
||||
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
|
||||
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
|
||||
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
|
||||
/*%% $XConsortium: api_typecb_utils.h /main/3 1995/10/23 09:55:34 rswiston $ */
|
||||
/* @(#)api_typecb_utils.h 1.2 93/07/30 SMI
|
||||
*
|
||||
* api_typecb_utils.h
|
||||
*
|
||||
* Copyright (c) 1993 by Sun Microsystems, Inc.
|
||||
*
|
||||
* Utilities declarations for _Tt_typecb
|
||||
*/
|
||||
#ifndef _API_TYPECB__UTILS_H
|
||||
#define _API_TYPECB_UTILS_H
|
||||
#include "util/tt_object.h"
|
||||
#include "util/tt_list.h"
|
||||
#include "util/tt_table.h"
|
||||
#include "util/tt_string.h"
|
||||
|
||||
declare_list_of(_Tt_typecb)
|
||||
declare_table_of(_Tt_typecb)
|
||||
|
||||
_Tt_string _tt_typecb_key(_Tt_object_ptr &o);
|
||||
_Tt_string _tt_typecb_key(const _Tt_string &tid, int opnum);
|
||||
|
||||
#endif /* MP_PATTERN_UTILS_H */
|
||||
29
cde/lib/tt/lib/api/c/api_utils.C
Normal file
29
cde/lib/tt/lib/api/c/api_utils.C
Normal file
@@ -0,0 +1,29 @@
|
||||
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
//%% (c) Copyright 1993, 1994 Novell, Inc.
|
||||
//%% $XConsortium: api_utils.C /main/3 1995/10/23 09:55:42 rswiston $
|
||||
/*
|
||||
*
|
||||
* api_utils.cc
|
||||
*
|
||||
* Copyright (c) 1990 by Sun Microsystems, Inc.
|
||||
*/
|
||||
#include "util/tt_object.h"
|
||||
#include "util/tt_list.h"
|
||||
#include "mp/mp_c.h"
|
||||
#include "api/c/api_api.h"
|
||||
#include "api/c/api_mp.h"
|
||||
#include "api/c/api_filemap.h"
|
||||
#include "api/c/api_handle.h"
|
||||
#include "api/c/api_storage.h"
|
||||
#include "api/c/api_objid_spec.h"
|
||||
|
||||
implement_list_of(_Tt_api_handle)
|
||||
implement_list_of(_Tt_api_userdata)
|
||||
implement_list_of(_Tt_api_callback)
|
||||
implement_list_of(_Tt_api_stg_stack_elm)
|
||||
implement_ptr_to(_Tt_api_stg_stack)
|
||||
implement_derived_ptr_to(_Tt_objid_spec, _Tt_db_object)
|
||||
implement_table_of(_Tt_objid_spec)
|
||||
implement_ptr_to(_Tt_api_filename_map)
|
||||
54
cde/lib/tt/lib/api/c/api_xdr.C
Normal file
54
cde/lib/tt/lib/api/c/api_xdr.C
Normal file
@@ -0,0 +1,54 @@
|
||||
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
//%% (c) Copyright 1993, 1994 Novell, Inc.
|
||||
//%% $XConsortium: api_xdr.C /main/3 1995/10/23 09:55:50 rswiston $
|
||||
/*
|
||||
*
|
||||
* api_xdr.cc
|
||||
*
|
||||
* XDR routines for datatypes visible at the API level.
|
||||
*
|
||||
* Copyright (c) 1990 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#include "tt_options.h"
|
||||
#if defined(OPT_BUG_SUNOS_4) && defined(__GNUG__)
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
#include <rpc/rpc.h>
|
||||
#include "api/c/api_xdr.h"
|
||||
#include <mp/mp_xdr_functions.h>
|
||||
#include <malloc.h>
|
||||
|
||||
bool_t
|
||||
_tt_xdr_cstring_list(XDR *xdrs, char ***ar)
|
||||
{
|
||||
int count;
|
||||
char **tar;
|
||||
int i;
|
||||
|
||||
if (xdrs->x_op == XDR_ENCODE) {
|
||||
// count the number of entries in the list
|
||||
tar = *ar;
|
||||
while (*tar++);
|
||||
count = tar-*ar;
|
||||
}
|
||||
if (!xdr_int(xdrs, &count)) return 0;
|
||||
if (xdrs->x_op == XDR_DECODE) {
|
||||
// allocate a new list
|
||||
tar = (char **)malloc((count+1)*sizeof(char *));
|
||||
if (tar==(char **)0) return 0;
|
||||
tar[count] = (char *)0;
|
||||
*ar = tar;
|
||||
} else {
|
||||
tar = *ar;
|
||||
}
|
||||
for (i=0;i<count;++i) {
|
||||
if (!tt_xdr_bstring(xdrs, &tar[i])) return 0;
|
||||
}
|
||||
if (xdrs->x_op == XDR_FREE) {
|
||||
free((MALLOCTYPE *)tar);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
29
cde/lib/tt/lib/api/c/api_xdr.h
Normal file
29
cde/lib/tt/lib/api/c/api_xdr.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
|
||||
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
|
||||
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
|
||||
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
|
||||
/*%% $XConsortium: api_xdr.h /main/3 1995/10/23 09:55:57 rswiston $ */
|
||||
/*
|
||||
*
|
||||
* api_xdr.h
|
||||
*
|
||||
* XDR routines for datatypes visible at the API level.
|
||||
*
|
||||
* Copyright (c) 1990 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#ifndef _API_XDR_H
|
||||
#define _API_XDR_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <rpc/xdr.h>
|
||||
#include <util/tt_rpc_xdr.h>
|
||||
|
||||
#if defined(ultrix)
|
||||
#include <rpc/xdr.h>
|
||||
#define bool_t int
|
||||
#endif
|
||||
|
||||
bool_t _tt_xdr_cstring_list(XDR *xdrs, char ***ar);
|
||||
|
||||
#endif /* _API_XDR_H */
|
||||
681
cde/lib/tt/lib/api/c/tt_c.h
Normal file
681
cde/lib/tt/lib/api/c/tt_c.h
Normal file
@@ -0,0 +1,681 @@
|
||||
/* $TOG: tt_c.h /main/10 1999/09/16 13:46:20 mgreess $ */
|
||||
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
|
||||
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
|
||||
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
|
||||
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
|
||||
|
||||
/*
|
||||
* ToolTalk 1.2 API C language headers.
|
||||
*/
|
||||
|
||||
#ifndef _tt_c_h
|
||||
#define _tt_c_h
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* ToolTalk version - Format:
|
||||
*
|
||||
* <Major Release #><Minor Release #: 2 digits><Dot Release #: 2 digits>
|
||||
*
|
||||
* For example:
|
||||
* 10100 --> Version 1.1.0
|
||||
* 100102 --> Version 10.1.2
|
||||
*/
|
||||
#define TT_VERSION 10300
|
||||
|
||||
#if defined(_EXTERN_) && defined(__STDC__)
|
||||
# define _TT_CONST
|
||||
# define _TT_EXTERN_FUNC(type,name,list) extern XS_LVAL x##name ()
|
||||
#else
|
||||
#if defined(_EXTERN_)
|
||||
# define _TT_CONST
|
||||
# define _TT_EXTERN_FUNC(type,name,list) extern XS_LVAL x/**/name ()
|
||||
#else
|
||||
#if defined(_NAMES_)
|
||||
# define _TT_CONST
|
||||
# define _TT_EXTERN_FUNC(type,name,list)name
|
||||
#else
|
||||
#if defined(_XSCHEME_)
|
||||
# define _TT_CONST const
|
||||
# define _TT_EXTERN_FUNC(type,name,list)type; name; list
|
||||
#else
|
||||
#if defined(__cplusplus)
|
||||
/* C++ 2.0 or later*/
|
||||
# define _TT_CONST const
|
||||
# define _TT_EXTERN_FUNC(type,name,list) extern "C" { type name list; }
|
||||
#else
|
||||
#if defined(__STDC__)
|
||||
/* ANSI C */
|
||||
# define _TT_CONST const
|
||||
# define _TT_EXTERN_FUNC(type,name,list) type name list;
|
||||
#else
|
||||
/* Sun C (K&R C, almost) */
|
||||
# define _TT_CONST
|
||||
# define _TT_EXTERN_FUNC(type,name,list) type name();
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(_EXTERN_) && !defined(_NAMES_) && !defined(_XSCHEME_)
|
||||
|
||||
#if !defined(_XENUMS_) && !defined(_TYPES_)
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#include <rpc/types.h>
|
||||
#include <rpc/xdr.h>
|
||||
|
||||
/* former status 1030 removed, but not used, for backward compatibility. */
|
||||
typedef enum tt_status {
|
||||
TT_OK = 0,
|
||||
TT_WRN_NOTFOUND = 1,
|
||||
TT_WRN_STALE_OBJID = 2,
|
||||
TT_WRN_STOPPED = 3,
|
||||
TT_WRN_SAME_OBJID = 4,
|
||||
TT_WRN_START_MESSAGE = 5,
|
||||
TT_WRN_NOT_ENABLED = 6,
|
||||
TT_WRN_APPFIRST = 512,
|
||||
TT_WRN_LAST = 1024,
|
||||
TT_ERR_CLASS = 1025,
|
||||
TT_ERR_DBAVAIL = 1026,
|
||||
TT_ERR_DBEXIST = 1027,
|
||||
TT_ERR_FILE = 1028,
|
||||
TT_ERR_INVALID = 1029,
|
||||
TT_ERR_MODE = 1031,
|
||||
TT_ERR_ACCESS = 1032,
|
||||
TT_ERR_NOMP = 1033,
|
||||
TT_ERR_NOTHANDLER = 1034,
|
||||
TT_ERR_NUM = 1035,
|
||||
TT_ERR_OBJID = 1036,
|
||||
TT_ERR_OP = 1037,
|
||||
TT_ERR_OTYPE = 1038,
|
||||
TT_ERR_ADDRESS = 1039,
|
||||
TT_ERR_PATH = 1040,
|
||||
TT_ERR_POINTER = 1041,
|
||||
TT_ERR_PROCID = 1042,
|
||||
TT_ERR_PROPLEN = 1043,
|
||||
TT_ERR_PROPNAME = 1044,
|
||||
TT_ERR_PTYPE = 1045,
|
||||
TT_ERR_DISPOSITION = 1046,
|
||||
TT_ERR_SCOPE = 1047,
|
||||
TT_ERR_SESSION = 1048,
|
||||
TT_ERR_VTYPE = 1049,
|
||||
TT_ERR_NO_VALUE = 1050,
|
||||
TT_ERR_INTERNAL = 1051,
|
||||
TT_ERR_READONLY = 1052,
|
||||
TT_ERR_NO_MATCH = 1053,
|
||||
TT_ERR_UNIMP = 1054,
|
||||
TT_ERR_OVERFLOW = 1055,
|
||||
TT_ERR_PTYPE_START = 1056,
|
||||
TT_ERR_CATEGORY = 1057,
|
||||
TT_ERR_DBUPDATE = 1058,
|
||||
TT_ERR_DBFULL = 1059,
|
||||
TT_ERR_DBCONSIST = 1060,
|
||||
TT_ERR_STATE = 1061,
|
||||
TT_ERR_NOMEM = 1062,
|
||||
TT_ERR_SLOTNAME = 1063,
|
||||
TT_ERR_XDR = 1064,
|
||||
TT_ERR_NETFILE = 1065,
|
||||
TT_ERR_TOOLATE = 1066,
|
||||
TT_ERR_AUTHORIZATION = 1067,
|
||||
TT_ERR_VERSION_MISMATCH = 1068,
|
||||
TT_DESKTOP_ = 1100,
|
||||
TT_DESKTOP_EPERM = 1101,
|
||||
TT_DESKTOP_ENOENT = 1102,
|
||||
TT_DESKTOP_EINTR = 1104,
|
||||
TT_DESKTOP_EIO = 1105,
|
||||
TT_DESKTOP_EAGAIN = 1111,
|
||||
TT_DESKTOP_ENOMEM = 1112,
|
||||
TT_DESKTOP_EACCES = 1113,
|
||||
TT_DESKTOP_EFAULT = 1114,
|
||||
TT_DESKTOP_EEXIST = 1117,
|
||||
TT_DESKTOP_ENODEV = 1119,
|
||||
TT_DESKTOP_ENOTDIR = 1120,
|
||||
TT_DESKTOP_EISDIR = 1121,
|
||||
TT_DESKTOP_EINVAL = 1122,
|
||||
TT_DESKTOP_ENFILE = 1123,
|
||||
TT_DESKTOP_EMFILE = 1124,
|
||||
TT_DESKTOP_ETXTBSY = 1126,
|
||||
TT_DESKTOP_EFBIG = 1127,
|
||||
TT_DESKTOP_ENOSPC = 1128,
|
||||
TT_DESKTOP_EROFS = 1130,
|
||||
TT_DESKTOP_EMLINK = 1131,
|
||||
TT_DESKTOP_EPIPE = 1132,
|
||||
TT_DESKTOP_ENOMSG = 1135,
|
||||
TT_DESKTOP_EDEADLK = 1145,
|
||||
TT_DESKTOP_ECANCELED = 1147,
|
||||
TT_DESKTOP_ENOTSUP = 1148,
|
||||
TT_DESKTOP_ENODATA = 1161,
|
||||
TT_DESKTOP_EPROTO = 1171,
|
||||
TT_DESKTOP_ENOTEMPTY = 1193,
|
||||
TT_DESKTOP_ETIMEDOUT = 1245,
|
||||
TT_DESKTOP_EALREADY = 1249,
|
||||
TT_DESKTOP_UNMODIFIED = 1299,
|
||||
TT_MEDIA_ERR_SIZE = 1300,
|
||||
TT_MEDIA_ERR_FORMAT = 1301,
|
||||
TT_AUTHFILE_ACCESS = 1400,
|
||||
TT_AUTHFILE_LOCK = 1401,
|
||||
TT_AUTHFILE_LOCK_TIMEOUT = 1402,
|
||||
TT_AUTHFILE_UNLOCK = 1403,
|
||||
TT_AUTHFILE_MISSING = 1404,
|
||||
TT_AUTHFILE_ENTRY_MISSING = 1405,
|
||||
TT_AUTHFILE_WRITE = 1406,
|
||||
TT_ERR_APPFIRST = 1536,
|
||||
TT_ERR_LAST = 2047,
|
||||
TT_STATUS_LAST = 2048} Tt_status;
|
||||
|
||||
|
||||
typedef enum tt_filter_action {
|
||||
TT_FILTER_CONTINUE = 0,
|
||||
TT_FILTER_STOP = 1,
|
||||
TT_FILTER_LAST = 2} Tt_filter_action;
|
||||
|
||||
typedef enum tt_callback_action {
|
||||
TT_CALLBACK_CONTINUE = 0,
|
||||
TT_CALLBACK_PROCESSED = 1,
|
||||
TT_CALLBACK_LAST = 2} Tt_callback_action;
|
||||
|
||||
typedef enum tt_mode {
|
||||
TT_MODE_UNDEFINED = 0,
|
||||
TT_IN = 1,
|
||||
TT_OUT = 2,
|
||||
TT_INOUT = 3,
|
||||
TT_MODE_LAST = 4} Tt_mode;
|
||||
|
||||
typedef enum tt_scope {
|
||||
TT_SCOPE_NONE = 0,
|
||||
TT_SESSION = 1,
|
||||
TT_FILE = 2,
|
||||
TT_BOTH = 3,
|
||||
TT_FILE_IN_SESSION = 4} Tt_scope;
|
||||
|
||||
typedef enum tt_class {
|
||||
TT_CLASS_UNDEFINED = 0,
|
||||
TT_NOTICE = 1,
|
||||
TT_REQUEST = 2,
|
||||
TT_OFFER = 3,
|
||||
TT_CLASS_LAST = 4} Tt_class;
|
||||
|
||||
typedef enum tt_category {
|
||||
TT_CATEGORY_UNDEFINED = 0,
|
||||
TT_OBSERVE = 1,
|
||||
TT_HANDLE = 2,
|
||||
TT_HANDLE_PUSH = 3,
|
||||
TT_HANDLE_ROTATE = 4,
|
||||
TT_CATEGORY_LAST = 5} Tt_category;
|
||||
|
||||
typedef enum tt_address {
|
||||
TT_PROCEDURE = 0,
|
||||
TT_OBJECT = 1,
|
||||
TT_HANDLER = 2,
|
||||
TT_OTYPE = 3,
|
||||
TT_ADDRESS_LAST = 4} Tt_address;
|
||||
|
||||
typedef enum tt_disposition {
|
||||
/* Flag bits, not enumerated values */
|
||||
TT_DISCARD = 0, /* for resetting value */
|
||||
TT_QUEUE = 1,
|
||||
TT_START = 2} Tt_disposition;
|
||||
|
||||
typedef enum tt_state {
|
||||
TT_CREATED = 0,
|
||||
TT_SENT = 1,
|
||||
TT_HANDLED = 2,
|
||||
TT_FAILED = 3,
|
||||
TT_QUEUED = 4,
|
||||
TT_STARTED = 5,
|
||||
TT_REJECTED = 6,
|
||||
TT_RETURNED = 7,
|
||||
TT_ACCEPTED = 8,
|
||||
TT_ABSTAINED = 9,
|
||||
TT_STATE_LAST = 10} Tt_state;
|
||||
|
||||
typedef enum tt_feature {
|
||||
_TT_FEATURE_MULTITHREADED = 1,
|
||||
_TT_FEATURE_LAST = 2} Tt_feature;
|
||||
|
||||
#define TT_FEATURE_MULTITHREADED _TT_FEATURE_MULTITHREADED
|
||||
#define TT_FEATURE_LAST _TT_FEATURE_LAST
|
||||
|
||||
#ifndef _XENUMS_
|
||||
|
||||
/*
|
||||
* Official properties of ToolTalk objects.
|
||||
*
|
||||
* ToolTalk should prevent non-root processes from setting the values
|
||||
* of properties whose name begins with '_'.
|
||||
*
|
||||
* Integrators should prevent users from assigning arbitrary strings
|
||||
* as values of properties whose name begins with '.'. That is, "dot"
|
||||
* properties are like "dot" files: their existence should normally be
|
||||
* hidden from users, and the displaying and setting of their contents
|
||||
* should be mediated programatically, sort of like the OpenWindows
|
||||
* "props" application mediates .Xdefaults.
|
||||
*/
|
||||
#define TT_OBJECT_NAME_PROPERTY ".Name"
|
||||
#define TT_OBJECT_OWNER_PROPERTY "_Owner"
|
||||
#define TT_OBJECT_GROUP_PROPERTY "_Group"
|
||||
#define TT_OBJECT_MODE_PROPERTY "_Mode"
|
||||
#define TT_OBJECT_CREATION_DATE_PROPERTY "_Creation_Date"
|
||||
|
||||
/*
|
||||
* The following define opaque handles which can be type checked (as compared
|
||||
* to void *). Don't bother looking for the definitions of the structs, there
|
||||
* aren't any.
|
||||
*/
|
||||
typedef struct _Tt_message_handle *Tt_message;
|
||||
typedef struct _Tt_pattern_handle *Tt_pattern;
|
||||
typedef struct _tt_AuthFileEntry *Tt_AuthFileEntry;
|
||||
|
||||
|
||||
#if defined(__cplusplus) || defined(__STDC__)
|
||||
typedef Tt_filter_action (*Tt_filter_function)(_TT_CONST char *nodeid,
|
||||
void *context,
|
||||
void *accumulator);
|
||||
typedef Tt_callback_action (*Tt_message_callback) (Tt_message m,
|
||||
Tt_pattern p);
|
||||
#else
|
||||
typedef Tt_filter_action (*Tt_filter_function)();
|
||||
typedef Tt_callback_action (*Tt_message_callback)();
|
||||
#endif
|
||||
|
||||
#endif /* _XENUMS_ */
|
||||
#endif /* _XSCHEME_ _NAMES_ _EXTERN_ */
|
||||
|
||||
#ifndef _XENUMS_
|
||||
|
||||
_TT_EXTERN_FUNC(char *,tt_open,(void))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_close,(void))
|
||||
_TT_EXTERN_FUNC(char *,tt_X_session,(_TT_CONST char *xdisplay))
|
||||
|
||||
_TT_EXTERN_FUNC(char *,tt_default_ptype,(void))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_default_ptype_set,(_TT_CONST char * ptid))
|
||||
_TT_EXTERN_FUNC(char *,tt_default_file,(void))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_default_file_set,(_TT_CONST char * docid))
|
||||
_TT_EXTERN_FUNC(char *,tt_default_session,(void))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_default_session_set,(_TT_CONST char *sessid))
|
||||
_TT_EXTERN_FUNC(char *,tt_thread_session,(void))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_thread_session_set,(_TT_CONST char *sessid))
|
||||
_TT_EXTERN_FUNC(char *,tt_default_procid,(void))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_default_procid_set,(_TT_CONST char *procid))
|
||||
_TT_EXTERN_FUNC(char *,tt_thread_procid,(void))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_thread_procid_set,(_TT_CONST char *procid))
|
||||
_TT_EXTERN_FUNC(char *,tt_procid_session,(_TT_CONST char *procid))
|
||||
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_file_join,(_TT_CONST char * filepath))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_file_quit,(_TT_CONST char * filepath))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_file_objects_query,
|
||||
(_TT_CONST char * filepath,
|
||||
Tt_filter_function filter,
|
||||
void *context,void *accumulator))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_file_move,
|
||||
(_TT_CONST char *oldfilepath, _TT_CONST char *newfilepath))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_file_copy,
|
||||
(_TT_CONST char *oldfilepath, _TT_CONST char *newfilepath))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_file_destroy,(_TT_CONST char * filepath))
|
||||
|
||||
_TT_EXTERN_FUNC(char *,tt_message_context_val,
|
||||
(Tt_message m, _TT_CONST char *slotname))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_message_context_ival,
|
||||
(Tt_message m, _TT_CONST char *slotname, int *value))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_message_context_bval,
|
||||
(Tt_message m, _TT_CONST char *slotname,
|
||||
unsigned char **value, int *len))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_message_context_xval,
|
||||
(Tt_message m, _TT_CONST char *slotname,
|
||||
xdrproc_t xdr_proc, void *value))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_message_context_set,
|
||||
(Tt_message m, _TT_CONST char *slotname,
|
||||
_TT_CONST char *value))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_message_icontext_set,
|
||||
(Tt_message m, _TT_CONST char *slotname, int value))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_message_bcontext_set,
|
||||
(Tt_message m, _TT_CONST char *slotname,
|
||||
_TT_CONST unsigned char *value, int len))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_message_xcontext_set,
|
||||
(Tt_message m, _TT_CONST char *slotname,
|
||||
xdrproc_t xdr_proc, void *value))
|
||||
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_context_join,
|
||||
(_TT_CONST char *slotname, _TT_CONST char *value))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_icontext_join,
|
||||
(_TT_CONST char *slotname, int value))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_bcontext_join,
|
||||
(_TT_CONST char *slotname,
|
||||
_TT_CONST unsigned char *value, int len))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_xcontext_join,
|
||||
(_TT_CONST char *slotname,
|
||||
xdrproc_t xdr_proc, void *value))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_context_quit,
|
||||
(_TT_CONST char *slotname, _TT_CONST char *value))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_icontext_quit,
|
||||
(_TT_CONST char *slotname, int value))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_bcontext_quit,
|
||||
(_TT_CONST char *slotname,
|
||||
_TT_CONST unsigned char *value, int len))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_xcontext_quit,
|
||||
(_TT_CONST char *slotname,
|
||||
xdrproc_t xdr_proc, void *value))
|
||||
_TT_EXTERN_FUNC(int,tt_message_contexts_count,(Tt_message m))
|
||||
_TT_EXTERN_FUNC(char *,tt_message_context_slotname,
|
||||
(Tt_message m, int i))
|
||||
|
||||
_TT_EXTERN_FUNC(Tt_message,tt_message_create,(void))
|
||||
_TT_EXTERN_FUNC(Tt_message,tt_message_create_super,(Tt_message m))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_message_destroy,(Tt_message m))
|
||||
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_message_send,(Tt_message m))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_message_send_on_exit,(Tt_message m))
|
||||
_TT_EXTERN_FUNC(Tt_message,tt_message_receive,(void))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_message_reply,(Tt_message m))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_message_reject,(Tt_message m))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_message_accept,(Tt_message m))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_message_fail,(Tt_message m))
|
||||
_TT_EXTERN_FUNC(Tt_pattern,tt_message_pattern,(Tt_message m))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_message_callback_add,
|
||||
(Tt_message m,Tt_message_callback f))
|
||||
|
||||
_TT_EXTERN_FUNC(void *,tt_message_user,(Tt_message m,int key))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_message_user_set,(Tt_message m,int key,void *v))
|
||||
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_message_arg_add,
|
||||
(Tt_message m,Tt_mode n,_TT_CONST char *vtype,
|
||||
_TT_CONST char *value))
|
||||
_TT_EXTERN_FUNC(Tt_mode,tt_message_arg_mode,(Tt_message m,int n))
|
||||
_TT_EXTERN_FUNC(char *,tt_message_arg_type,(Tt_message m,int n))
|
||||
_TT_EXTERN_FUNC(char *,tt_message_arg_val,(Tt_message m,int n))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_message_arg_val_set,
|
||||
(Tt_message m,int n,_TT_CONST char *value))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_message_arg_bval,
|
||||
(Tt_message m,int n,unsigned char **value,int *len))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_message_arg_bval_set,
|
||||
(Tt_message m,int n,_TT_CONST unsigned char *value,int len))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_message_barg_add,
|
||||
(Tt_message m,Tt_mode n,_TT_CONST char *vtype,
|
||||
_TT_CONST unsigned char *value,int len))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_message_arg_ival,
|
||||
(Tt_message m,int n,int *value))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_message_arg_ival_set,
|
||||
(Tt_message m,int n,int value))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_message_iarg_add,
|
||||
(Tt_message m,Tt_mode n,_TT_CONST char *vtype,int value))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_message_arg_xval,
|
||||
(Tt_message m,int n,xdrproc_t xdr_proc, void *value))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_message_arg_xval_set,
|
||||
(Tt_message m,int n,xdrproc_t xdr_proc, void *value))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_message_xarg_add,
|
||||
(Tt_message m,Tt_mode n,_TT_CONST char *vtype,
|
||||
xdrproc_t xdr_proc, void *value))
|
||||
_TT_EXTERN_FUNC(int,tt_message_args_count,(Tt_message m))
|
||||
_TT_EXTERN_FUNC(Tt_class,tt_message_class,(Tt_message m))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_message_class_set,
|
||||
(Tt_message m,Tt_class c))
|
||||
_TT_EXTERN_FUNC(char *,tt_message_file,(Tt_message m))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_message_file_set,
|
||||
(Tt_message m,_TT_CONST char *file))
|
||||
_TT_EXTERN_FUNC(char *,tt_message_object,(Tt_message m))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_message_object_set,
|
||||
(Tt_message m,_TT_CONST char *objid))
|
||||
_TT_EXTERN_FUNC(char *,tt_message_id,(Tt_message m))
|
||||
_TT_EXTERN_FUNC(char *,tt_message_op,(Tt_message m))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_message_op_set,
|
||||
(Tt_message m,_TT_CONST char *opname))
|
||||
_TT_EXTERN_FUNC(int,tt_message_opnum,(Tt_message m))
|
||||
_TT_EXTERN_FUNC(char *,tt_message_otype,(Tt_message m))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_message_otype_set,
|
||||
(Tt_message m,_TT_CONST char *otype))
|
||||
_TT_EXTERN_FUNC(Tt_address,tt_message_address,(Tt_message m))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_message_address_set,
|
||||
(Tt_message m,Tt_address p))
|
||||
_TT_EXTERN_FUNC(char *,tt_message_handler,(Tt_message m))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_message_handler_set,
|
||||
(Tt_message m,_TT_CONST char *procid))
|
||||
_TT_EXTERN_FUNC(char *,tt_message_handler_ptype,(Tt_message m))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_message_handler_ptype_set,
|
||||
(Tt_message m,_TT_CONST char *ptid))
|
||||
_TT_EXTERN_FUNC(int,tt_message_accepters_count,(Tt_message m))
|
||||
_TT_EXTERN_FUNC(char *,tt_message_accepter,(Tt_message m,int n))
|
||||
_TT_EXTERN_FUNC(int,tt_message_rejecters_count,(Tt_message m))
|
||||
_TT_EXTERN_FUNC(char *,tt_message_rejecter,(Tt_message m,int n))
|
||||
_TT_EXTERN_FUNC(int,tt_message_abstainers_count,(Tt_message m))
|
||||
_TT_EXTERN_FUNC(char *,tt_message_abstainer,(Tt_message m,int n))
|
||||
_TT_EXTERN_FUNC(Tt_disposition,tt_message_disposition,(Tt_message m))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_message_disposition_set,
|
||||
(Tt_message m,Tt_disposition r))
|
||||
_TT_EXTERN_FUNC(Tt_scope,tt_message_scope,(Tt_message m))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_message_scope_set,(Tt_message m,Tt_scope s))
|
||||
_TT_EXTERN_FUNC(char *,tt_message_sender,(Tt_message m))
|
||||
_TT_EXTERN_FUNC(char *,tt_message_sender_ptype,(Tt_message m))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_message_sender_ptype_set,
|
||||
(Tt_message m,_TT_CONST char *ptid))
|
||||
_TT_EXTERN_FUNC(char *,tt_message_session,(Tt_message m))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_message_session_set,
|
||||
(Tt_message m,_TT_CONST char *sessid))
|
||||
_TT_EXTERN_FUNC(Tt_state,tt_message_state,(Tt_message m))
|
||||
_TT_EXTERN_FUNC(int,tt_message_status,(Tt_message m))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_message_status_set,(Tt_message m,int status))
|
||||
_TT_EXTERN_FUNC(char *,tt_message_status_string,(Tt_message m))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_message_status_string_set,
|
||||
(Tt_message m,_TT_CONST char *status_str))
|
||||
_TT_EXTERN_FUNC(uid_t,tt_message_uid,(Tt_message m))
|
||||
_TT_EXTERN_FUNC(gid_t,tt_message_gid,(Tt_message m))
|
||||
|
||||
/*
|
||||
* The following are "macros" which provide a simpler high level
|
||||
* interface to the above low level calls.
|
||||
*/
|
||||
_TT_EXTERN_FUNC(Tt_message,tt_pnotice_create,
|
||||
(Tt_scope scope, _TT_CONST char *op))
|
||||
_TT_EXTERN_FUNC(Tt_message,tt_prequest_create,
|
||||
(Tt_scope scope, _TT_CONST char *op))
|
||||
_TT_EXTERN_FUNC(Tt_message,tt_onotice_create,
|
||||
(_TT_CONST char *objid, _TT_CONST char *op))
|
||||
_TT_EXTERN_FUNC(Tt_message,tt_orequest_create,
|
||||
(_TT_CONST char *objid, _TT_CONST char *op))
|
||||
|
||||
_TT_EXTERN_FUNC(char *,tt_spec_create,(_TT_CONST char * filepath))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_spec_write,(_TT_CONST char * nodeid))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_spec_destroy,(_TT_CONST char * nodeid))
|
||||
|
||||
_TT_EXTERN_FUNC(char *,tt_spec_file,(_TT_CONST char * nodeid))
|
||||
_TT_EXTERN_FUNC(char *,tt_spec_type,(_TT_CONST char * nodeid))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_spec_type_set,
|
||||
(_TT_CONST char * nodeid,_TT_CONST char * otid))
|
||||
_TT_EXTERN_FUNC(char *,tt_spec_move,
|
||||
(_TT_CONST char * nodeid,_TT_CONST char * newfilepath))
|
||||
_TT_EXTERN_FUNC(char *,tt_spec_propname,(_TT_CONST char *nodeid,int n))
|
||||
_TT_EXTERN_FUNC(int,tt_spec_propnames_count,(_TT_CONST char *nodeid))
|
||||
|
||||
|
||||
_TT_EXTERN_FUNC(char *,tt_spec_prop,
|
||||
(_TT_CONST char *nodeid,_TT_CONST char *propname,int i))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_spec_prop_add,
|
||||
(_TT_CONST char *nodeid,_TT_CONST char *propname,
|
||||
_TT_CONST char *value))
|
||||
_TT_EXTERN_FUNC(int,tt_spec_prop_count,
|
||||
(_TT_CONST char *nodeid,_TT_CONST char *propname))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_spec_prop_set,
|
||||
(_TT_CONST char *nodeid,_TT_CONST char *propname,
|
||||
_TT_CONST char *value))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_spec_bprop,
|
||||
(_TT_CONST char *nodeid,_TT_CONST char *propname,int i,
|
||||
unsigned char **value,int *length))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_spec_bprop_add,
|
||||
(_TT_CONST char *nodeid,_TT_CONST char *propname,
|
||||
_TT_CONST unsigned char *value,int length))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_spec_bprop_set,
|
||||
(_TT_CONST char *nodeid,_TT_CONST char *propname,
|
||||
_TT_CONST unsigned char *value,int length))
|
||||
|
||||
_TT_EXTERN_FUNC(int,tt_objid_equal,
|
||||
(_TT_CONST char * nodeid1,_TT_CONST char * nodeid2))
|
||||
_TT_EXTERN_FUNC(char *,tt_objid_objkey,(_TT_CONST char * nodeid))
|
||||
|
||||
_TT_EXTERN_FUNC(int,tt_otype_deriveds_count,(_TT_CONST char *otype))
|
||||
_TT_EXTERN_FUNC(char *,tt_otype_derived,(_TT_CONST char *otype, int i))
|
||||
_TT_EXTERN_FUNC(char *,tt_otype_base,(_TT_CONST char *otype))
|
||||
_TT_EXTERN_FUNC(int,tt_otype_is_derived,
|
||||
(_TT_CONST char *derivedotype, _TT_CONST char *baseotype))
|
||||
_TT_EXTERN_FUNC(int,tt_otype_osig_count,(_TT_CONST char * otype))
|
||||
_TT_EXTERN_FUNC(int,tt_otype_hsig_count,(_TT_CONST char * otype))
|
||||
_TT_EXTERN_FUNC(char *,tt_otype_osig_op,(_TT_CONST char * otype, int sig))
|
||||
_TT_EXTERN_FUNC(char *,tt_otype_hsig_op,(_TT_CONST char * otype, int sig))
|
||||
_TT_EXTERN_FUNC(int,tt_otype_osig_args_count,(_TT_CONST char * otype, int sig))
|
||||
_TT_EXTERN_FUNC(int,tt_otype_hsig_args_count,(_TT_CONST char * otype, int sig))
|
||||
_TT_EXTERN_FUNC(Tt_mode,tt_otype_osig_arg_mode,(_TT_CONST char * otype,
|
||||
int sig, int arg))
|
||||
_TT_EXTERN_FUNC(Tt_mode,tt_otype_hsig_arg_mode,(_TT_CONST char * otype,
|
||||
int sig, int arg))
|
||||
_TT_EXTERN_FUNC(char *,tt_otype_osig_arg_type,(_TT_CONST char * otype,
|
||||
int sig, int arg))
|
||||
_TT_EXTERN_FUNC(char *,tt_otype_hsig_arg_type,(_TT_CONST char * otype,
|
||||
int sig, int arg))
|
||||
|
||||
_TT_EXTERN_FUNC(Tt_pattern,tt_pattern_create,(void))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_pattern_destroy,(Tt_pattern p))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_pattern_register,(Tt_pattern p))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_pattern_unregister,(Tt_pattern p))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_pattern_callback_add,
|
||||
(Tt_pattern m,Tt_message_callback f))
|
||||
|
||||
_TT_EXTERN_FUNC(void *,tt_pattern_user,(Tt_pattern p,int key))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_pattern_user_set,(Tt_pattern p,int key,void *v))
|
||||
|
||||
_TT_EXTERN_FUNC(Tt_category,tt_pattern_category,(Tt_pattern p))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_pattern_category_set,
|
||||
(Tt_pattern p,Tt_category c))
|
||||
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_pattern_arg_add,
|
||||
(Tt_pattern p,Tt_mode n,_TT_CONST char *vtype,
|
||||
_TT_CONST char *value))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_pattern_barg_add,
|
||||
(Tt_pattern m,Tt_mode n,_TT_CONST char *vtype,
|
||||
_TT_CONST unsigned char *value,int len))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_pattern_iarg_add,
|
||||
(Tt_pattern m,Tt_mode n,_TT_CONST char *vtype, int value))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_pattern_xarg_add,
|
||||
(Tt_pattern m,Tt_mode n,_TT_CONST char *vtype,
|
||||
xdrproc_t xdr_proc, void *value))
|
||||
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_pattern_class_add,
|
||||
(Tt_pattern p,Tt_class c))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_pattern_file_add,
|
||||
(Tt_pattern p,_TT_CONST char *file))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_pattern_object_add,
|
||||
(Tt_pattern p,_TT_CONST char *objid))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_pattern_op_add,
|
||||
(Tt_pattern p,_TT_CONST char *opname))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_pattern_opnum_add,(Tt_pattern p,int opnum))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_pattern_otype_add,
|
||||
(Tt_pattern p,_TT_CONST char *otype))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_pattern_address_add,
|
||||
(Tt_pattern p,Tt_address d))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_pattern_disposition_add,
|
||||
(Tt_pattern p,Tt_disposition r))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_pattern_scope_add,(Tt_pattern p,Tt_scope s))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_pattern_sender_add,
|
||||
(Tt_pattern p,_TT_CONST char *procid))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_pattern_sender_ptype_add,
|
||||
(Tt_pattern p,_TT_CONST char *ptid))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_pattern_session_add,
|
||||
(Tt_pattern p,_TT_CONST char *sessid))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_pattern_state_add,(Tt_pattern p,Tt_state s))
|
||||
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_pattern_context_add,
|
||||
(Tt_pattern p, _TT_CONST char *slotname,
|
||||
_TT_CONST char *value))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_pattern_icontext_add,
|
||||
(Tt_pattern p, _TT_CONST char *slotname,
|
||||
int value))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_pattern_bcontext_add,
|
||||
(Tt_pattern p, _TT_CONST char *slotname,
|
||||
_TT_CONST unsigned char *value, int length))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_pattern_xcontext_add,
|
||||
(Tt_pattern p, _TT_CONST char *slotname,
|
||||
xdrproc_t xdr_proc, void *value))
|
||||
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_ptype_declare,(_TT_CONST char * ptid))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_ptype_undeclare,(_TT_CONST char * ptid))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_ptype_exists,(_TT_CONST char * ptid))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_ptype_opnum_callback_add,
|
||||
(_TT_CONST char * ptid, int opnum, Tt_message_callback f))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_otype_opnum_callback_add,
|
||||
(_TT_CONST char * otid, int opnum, Tt_message_callback f))
|
||||
|
||||
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_session_join,(_TT_CONST char * sessid))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_session_quit,(_TT_CONST char * sessid))
|
||||
_TT_EXTERN_FUNC(char *,tt_initial_session,(void))
|
||||
|
||||
_TT_EXTERN_FUNC(char *,tt_session_propname,(_TT_CONST char *sessid,int n))
|
||||
_TT_EXTERN_FUNC(int,tt_session_propnames_count,(_TT_CONST char *sessid))
|
||||
_TT_EXTERN_FUNC(char *,tt_session_prop,
|
||||
(_TT_CONST char *sessid,_TT_CONST char *propname,int i))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_session_prop_add,
|
||||
(_TT_CONST char *sessid,_TT_CONST char *propname,
|
||||
_TT_CONST char *value))
|
||||
_TT_EXTERN_FUNC(int,tt_session_prop_count,
|
||||
(_TT_CONST char *sessid,_TT_CONST char *propname))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_session_prop_set,
|
||||
(_TT_CONST char *sessid, _TT_CONST char *propname,
|
||||
_TT_CONST char *value))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_session_bprop,
|
||||
(_TT_CONST char *sessid,_TT_CONST char *propname,int i,
|
||||
unsigned char **value,int *length))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_session_bprop_add,
|
||||
(_TT_CONST char *sessid,_TT_CONST char *propname,
|
||||
_TT_CONST unsigned char *value,int length))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_session_bprop_set,
|
||||
(_TT_CONST char *sessid,_TT_CONST char *propname,
|
||||
_TT_CONST unsigned char *value,int length))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_session_types_load,
|
||||
(_TT_CONST char *sessid, _TT_CONST char *filename))
|
||||
|
||||
|
||||
_TT_EXTERN_FUNC(int,tt_fd,(void))
|
||||
|
||||
_TT_EXTERN_FUNC(int,tt_mark,(void))
|
||||
_TT_EXTERN_FUNC(void,tt_release,(int mark))
|
||||
_TT_EXTERN_FUNC(caddr_t,tt_malloc,(size_t s))
|
||||
_TT_EXTERN_FUNC(void,tt_free,(caddr_t p))
|
||||
|
||||
_TT_EXTERN_FUNC(char *,tt_status_message,(Tt_status ttrc))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_pointer_error,(void *pointer))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_int_error,(int return_val))
|
||||
|
||||
_TT_EXTERN_FUNC(void,tt_error,(const char *func,Tt_status ttrc))
|
||||
_TT_EXTERN_FUNC(void *,tt_error_pointer,(Tt_status ttrc))
|
||||
_TT_EXTERN_FUNC(int,tt_error_int,(Tt_status ttrc))
|
||||
|
||||
_TT_EXTERN_FUNC(int,tt_trace_control,(int onoff))
|
||||
|
||||
_TT_EXTERN_FUNC(char *,tt_message_print,(Tt_message m))
|
||||
_TT_EXTERN_FUNC(char *,tt_pattern_print,(Tt_pattern p))
|
||||
|
||||
_TT_EXTERN_FUNC(char *,tt_file_netfile, (const char *filename))
|
||||
_TT_EXTERN_FUNC(char *,tt_netfile_file, (const char *netfilename))
|
||||
|
||||
_TT_EXTERN_FUNC(char *,tt_host_file_netfile, (const char * host, const char * filename))
|
||||
_TT_EXTERN_FUNC(char *,tt_host_netfile_file, (const char * host, const char * netfilename))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_feature_enabled, (Tt_feature f))
|
||||
_TT_EXTERN_FUNC(Tt_status,tt_feature_required, (Tt_feature f))
|
||||
|
||||
_TT_EXTERN_FUNC(char*, tt_AuthFileName, (void))
|
||||
_TT_EXTERN_FUNC(int, tt_LockAuthFile, (char*, int, int, long))
|
||||
_TT_EXTERN_FUNC(void, tt_UnlockAuthFile, (char*))
|
||||
_TT_EXTERN_FUNC(Tt_AuthFileEntry, tt_ReadAuthFileEntry, (FILE*))
|
||||
_TT_EXTERN_FUNC(void, tt_FreeAuthFileEntry, (Tt_AuthFileEntry))
|
||||
_TT_EXTERN_FUNC(int, tt_WriteAuthFileEntry, (FILE*, Tt_AuthFileEntry))
|
||||
_TT_EXTERN_FUNC(Tt_AuthFileEntry, tt_GetAuthFileEntry, (char*, char*, char*))
|
||||
_TT_EXTERN_FUNC(char*, tt_GenerateMagicCookie, (int))
|
||||
|
||||
#endif /* _XENUMS_ */
|
||||
|
||||
#define tt_ptr_error(p) tt_pointer_error((void *)(p))
|
||||
#define tt_is_err(p) (TT_WRN_LAST < (p))
|
||||
#undef _TT_EXTERN_FUNC
|
||||
#undef _TT_CONST
|
||||
#endif
|
||||
31
cde/lib/tt/lib/api/dnd/Imakefile
Normal file
31
cde/lib/tt/lib/api/dnd/Imakefile
Normal file
@@ -0,0 +1,31 @@
|
||||
XCOMM $XConsortium: Imakefile /main/6 1996/04/21 19:12:16 drk $
|
||||
#define DoNormalLib NormalLibTt
|
||||
#define DoSharedLib SharedLibTt
|
||||
#define DoDebugLib DebugLibTt
|
||||
#define DoProfileLib ProfileLibTt
|
||||
#define LibName tt
|
||||
#define SoRev SOTTREV
|
||||
#define LibHeaders NO
|
||||
#define LibCreate NO
|
||||
|
||||
#include <Threads.tmpl>
|
||||
|
||||
#include "../../../tooltalk.tmpl"
|
||||
|
||||
DEFINES =
|
||||
INCLUDES = -I../..
|
||||
|
||||
/*** NOTE!
|
||||
*** Every time a .o is added below it needs to be added to
|
||||
*** the lib/tt/lib Imakefile in OBJS and SHARED_OBJS
|
||||
***/
|
||||
|
||||
SRCS = ttdnd.c
|
||||
|
||||
OBJS = ttdnd.o
|
||||
|
||||
#include <Library.tmpl>
|
||||
|
||||
SubdirLibraryRule($(OBJS))
|
||||
|
||||
DependTarget()
|
||||
271
cde/lib/tt/lib/api/dnd/ttdnd.c
Normal file
271
cde/lib/tt/lib/api/dnd/ttdnd.c
Normal file
@@ -0,0 +1,271 @@
|
||||
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
|
||||
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
|
||||
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
|
||||
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
|
||||
/*%% $XConsortium: ttdnd.c /main/3 1995/10/23 09:57:30 rswiston $ */
|
||||
/*
|
||||
*
|
||||
* ttdnd.c
|
||||
*
|
||||
* Copyright (c) 1990 by Sun Microsystems, Inc.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
#include "api/c/tt_c.h"
|
||||
#include "ttdnd.h"
|
||||
|
||||
static Tt_callback_action _ttdnd_get_contents_callback();
|
||||
static void _ttdnd_get_contents();
|
||||
static Tt_callback_action _ttdnd_continue_transfer();
|
||||
void _ttdnd_receive();
|
||||
int _ttdnd_convert_selection();
|
||||
|
||||
|
||||
#define MAXCHUNK 32768 /* Need some way for user to set this? */
|
||||
#define USER_FUNC_KEY 1
|
||||
|
||||
/*
|
||||
* ttdnd_init does all ToolTalk specific initialization: registers
|
||||
* patterns for all valid types.
|
||||
* Returns a
|
||||
*
|
||||
* TARGETS: _SUN_TOOLTALK + each data type
|
||||
* (we're not using Neil's proposed _SUN_ALTERNATE_TYPES, but it would
|
||||
* be trivial to do so.)
|
||||
* +one item for each data type.
|
||||
*/
|
||||
|
||||
int
|
||||
ttdnd_init(
|
||||
int Xid,
|
||||
const char **validtypes,
|
||||
Ttdnd_send_data_func *sendfunc,
|
||||
Ttdnd_input_func **input_func,
|
||||
int *fd_ptr)
|
||||
{
|
||||
int mark = tt_mark();
|
||||
const char *t, **vt;
|
||||
int validtypecount, i;
|
||||
|
||||
|
||||
if (tt_ptr_error(tt_open())>TT_WRN_LAST) {
|
||||
return 0;
|
||||
}
|
||||
*input_func = _ttdnd_receive;
|
||||
*fd_ptr = tt_fd();
|
||||
for(vt=validtypes, t=*vt; t; t=*vt++) {
|
||||
Tt_pattern p = tt_pattern_create();
|
||||
tt_pattern_category_set(p,TT_HANDLE);
|
||||
tt_pattern_scope_add(p,TT_SESSION);
|
||||
tt_pattern_op_add(p, "oldd_get_contents");
|
||||
tt_pattern_state_add(p, TT_SENT);
|
||||
tt_pattern_iarg_add(p, TT_IN, "int", Xid); /* 0 */
|
||||
tt_pattern_arg_add(p, TT_OUT, t, (char *)0); /* 1 */
|
||||
tt_pattern_callback_add(p,_ttdnd_get_contents_callback);
|
||||
tt_pattern_user_set(p, USER_FUNC_KEY, (void *)sendfunc);
|
||||
tt_pattern_register(p);
|
||||
}
|
||||
/* tt_session_join(tt_X_session()); TO_DO */
|
||||
|
||||
tt_release(mark);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* ttdnd_negotiate_types finds the first type in the target's list which is
|
||||
* also in the source's list and returns it. This could/should be extended
|
||||
* to search for registered conversions.
|
||||
*/
|
||||
char *
|
||||
ttdnd_negotiate_types(
|
||||
const char **sourcetypes,
|
||||
const char **targettypes)
|
||||
{
|
||||
const char **slist, **tlist;
|
||||
const char *s, *t;
|
||||
|
||||
tlist = targettypes;
|
||||
while (t = *tlist++) {
|
||||
slist = sourcetypes;
|
||||
while (s = *slist++) {
|
||||
if (0==strcmp(s,t)) {
|
||||
return (char *)t;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* If no common data type was found, return the target's favorite
|
||||
* data type. ttdnd_start_transfer will then send a oldd_get_contents
|
||||
* message with this type, in the hope that a dynamically-registered
|
||||
* conversion routine will volunteer to handle it.
|
||||
*/
|
||||
return (char *)targettypes[0];
|
||||
}
|
||||
|
||||
/*
|
||||
* ttdnd_start_transfer() is called by the drop target to get the transfer
|
||||
* going.
|
||||
*/
|
||||
void
|
||||
ttdnd_start_transfer(
|
||||
int sourceXid,
|
||||
const char *source_type,
|
||||
Ttdnd_receive_data_func *receivefunc)
|
||||
{
|
||||
_ttdnd_get_contents(sourceXid, source_type, receivefunc, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* internal routine to create and send a oldd_get_contents message,
|
||||
* used from ttdnd_start_transfer for the first chunk and
|
||||
* _ttdnd_continue_transfer for subsequent chunks.
|
||||
*/
|
||||
static void
|
||||
_ttdnd_get_contents(
|
||||
int sourceXid,
|
||||
const char *source_type,
|
||||
Ttdnd_receive_data_func *receivefunc,
|
||||
int chunknumber)
|
||||
{
|
||||
Tt_message m;
|
||||
|
||||
m = tt_message_create();
|
||||
tt_message_address_set(m,TT_PROCEDURE);
|
||||
tt_message_class_set(m,TT_REQUEST);
|
||||
tt_message_scope_set(m,TT_SESSION);
|
||||
tt_message_op_set(m,"oldd_get_contents");
|
||||
tt_message_iarg_add(m, TT_IN, "int", sourceXid); /* 0 */
|
||||
tt_message_arg_add( m, TT_OUT, source_type, (char *)0); /* 1 */
|
||||
tt_message_iarg_add(m, TT_IN, "int", chunknumber);/* 2 */
|
||||
tt_message_iarg_add(m, TT_IN, "int", MAXCHUNK); /* 3 */
|
||||
tt_message_arg_add( m, TT_OUT, "int", (char *)0); /* 4 */
|
||||
tt_message_user_set(m, USER_FUNC_KEY, (void *)receivefunc);
|
||||
tt_message_callback_add(m, _ttdnd_continue_transfer);
|
||||
tt_message_send(m);
|
||||
}
|
||||
|
||||
/*
|
||||
* _ttdnd_continue_transfer is called when a reply to an oldd_get_contents
|
||||
* message comes in. It passes the data to the application's receive-data
|
||||
* callback, and sends a message for the next chunk if necessary.
|
||||
*/
|
||||
static Tt_callback_action
|
||||
_ttdnd_continue_transfer(m,p)
|
||||
Tt_message m;
|
||||
Tt_pattern p;
|
||||
{
|
||||
Ttdnd_receive_data_func *receivefunc;
|
||||
int sourceXid;
|
||||
char *sourcetype;
|
||||
int chunknum;
|
||||
int chunksize;
|
||||
unsigned char *chunkptr;
|
||||
int is_last;
|
||||
int receivefunc_quits;
|
||||
int mark;
|
||||
|
||||
mark = tt_mark();
|
||||
receivefunc = (Ttdnd_receive_data_func *)tt_message_user(m, USER_FUNC_KEY);
|
||||
sourcetype = tt_message_arg_type(m,1);
|
||||
|
||||
switch(tt_message_state(m)) {
|
||||
case TT_HANDLED:
|
||||
tt_message_arg_ival(m,0,&sourceXid);
|
||||
tt_message_arg_bval(m,1,&chunkptr,&chunksize);
|
||||
tt_message_arg_ival(m,2,&chunknum);
|
||||
tt_message_arg_ival(m,4,&is_last);
|
||||
receivefunc_quits = (*receivefunc)(chunknum, sourcetype,
|
||||
(void *)chunkptr, chunksize,
|
||||
is_last);
|
||||
|
||||
if (receivefunc_quits) {
|
||||
/*
|
||||
* Should there be any notification to the sender if
|
||||
* the receiver quits?
|
||||
*/
|
||||
} else if (is_last) {
|
||||
/* Transfer is complete. */
|
||||
} else {
|
||||
_ttdnd_get_contents(sourceXid, sourcetype,
|
||||
receivefunc, chunknum+1);
|
||||
}
|
||||
break;
|
||||
case TT_FAILED: /* Sender requested breakoff */
|
||||
(void)(*receivefunc)(-1,sourcetype,0,0,1);
|
||||
break;
|
||||
case TT_REJECTED: /* Couldn't rendezvous with sender */
|
||||
(void)(*receivefunc)(-1,sourcetype,0,0,1);
|
||||
case TT_SENT:
|
||||
/* tt_message_arg_val(m,0,&sourceXid); TO_DO */
|
||||
return TT_CALLBACK_CONTINUE;
|
||||
default: /* Don't care about starts and queues */
|
||||
break;
|
||||
}
|
||||
tt_release(mark);
|
||||
return TT_CALLBACK_PROCESSED;
|
||||
}
|
||||
|
||||
/*
|
||||
* _ttdnd_get_contents_callback is called by TT whenever a
|
||||
* oldd_get_contents request message arrives. It gets the data
|
||||
* from the user's send routine, and fills it into the message.
|
||||
*/
|
||||
static Tt_callback_action
|
||||
_ttdnd_get_contents_callback(m, p)
|
||||
Tt_message m;
|
||||
Tt_pattern p;
|
||||
{
|
||||
int xid;
|
||||
int chunknumber;
|
||||
int maxchunk;
|
||||
char *type;
|
||||
char *buffer;
|
||||
int chunksize;
|
||||
int is_last;
|
||||
int sendfunc_quits;
|
||||
Ttdnd_send_data_func *sendfunc;
|
||||
int mark;
|
||||
|
||||
mark = tt_mark();
|
||||
|
||||
type = tt_message_arg_type(m,1);
|
||||
tt_message_arg_ival(m,2,&chunknumber);
|
||||
tt_message_arg_ival(m,3,&maxchunk);
|
||||
|
||||
sendfunc = (Ttdnd_send_data_func *)tt_pattern_user(p, USER_FUNC_KEY);
|
||||
|
||||
buffer = (char *)malloc(maxchunk);
|
||||
if (buffer==0) {
|
||||
tt_message_fail(m);
|
||||
tt_release(mark);
|
||||
return TT_CALLBACK_PROCESSED;
|
||||
}
|
||||
|
||||
sendfunc_quits = (*sendfunc)(chunknumber, maxchunk, type,
|
||||
buffer, &chunksize, &is_last);
|
||||
if (sendfunc_quits) {
|
||||
tt_message_fail(m);
|
||||
} else {
|
||||
tt_message_arg_bval_set(m,1,(unsigned char *)buffer,chunksize);
|
||||
tt_message_arg_ival_set(m,4,is_last);
|
||||
tt_message_reply(m);
|
||||
}
|
||||
free(buffer);
|
||||
tt_release(mark);
|
||||
return TT_CALLBACK_PROCESSED;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* This is a simple notifier fd input function to read
|
||||
* tt messages whenever the tt filedescriptor has input.
|
||||
*/
|
||||
void
|
||||
_ttdnd_receive()
|
||||
{
|
||||
Tt_message m;
|
||||
m = tt_message_receive();
|
||||
if (m) tt_message_destroy(m); /* should not be needed, but to be safe. */
|
||||
}
|
||||
|
||||
61
cde/lib/tt/lib/api/dnd/ttdnd.h
Normal file
61
cde/lib/tt/lib/api/dnd/ttdnd.h
Normal file
@@ -0,0 +1,61 @@
|
||||
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
|
||||
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
|
||||
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
|
||||
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
|
||||
/*%% $XConsortium: ttdnd.h /main/3 1995/10/23 09:57:38 rswiston $ */
|
||||
/*
|
||||
*
|
||||
* ttdnd.h
|
||||
*
|
||||
* Copyright (c) 1990 by Sun Microsystems, Inc.
|
||||
*/
|
||||
#ifndef _TTDND_H
|
||||
#define _TTDND_H
|
||||
|
||||
#if defined(__STDC__)
|
||||
/* ANSI C */
|
||||
# define _TT_CONST const
|
||||
# define _TT_EXTERN_FUNC(type,name,list) type name list
|
||||
#elif defined(__cplusplus)
|
||||
/* C++ 2.0 or later*/
|
||||
# define _TT_CONST const
|
||||
# define _TT_EXTERN_FUNC(type,name,list) extern "C" { type name list; }
|
||||
#else
|
||||
/* Sun C (K&R C, almost) */
|
||||
# define _TT_CONST
|
||||
# define _TT_EXTERN_FUNC(type,name,list) type name()
|
||||
#endif
|
||||
|
||||
#define TTDND_ATM_TARGET "_SUN_TOOLTALK"
|
||||
|
||||
#if defined(__cplusplus) || defined(__STDC__)
|
||||
typedef int (Ttdnd_send_data_func)(int chunknumber, int maxchunk,
|
||||
const char *type,
|
||||
void *buffer, int *chunksize,
|
||||
int *is_last);
|
||||
typedef int (Ttdnd_receive_data_func)(int chunknumber, const char *type,
|
||||
void *buffer, int chunksize,
|
||||
int is_last);
|
||||
typedef void Ttdnd_input_func(void);
|
||||
#else
|
||||
typedef int (Ttdnd_send_data_func)();
|
||||
typedef int (Ttdnd_receive_data_func)();
|
||||
typedef void Ttdnd_input_func();
|
||||
#endif
|
||||
|
||||
_TT_EXTERN_FUNC(int,
|
||||
ttdnd_init,(int Xid, _TT_CONST char **validtypes,
|
||||
Ttdnd_send_data_func *sendfunc,
|
||||
Ttdnd_input_func **input_func, int *fd));
|
||||
|
||||
_TT_EXTERN_FUNC(char *,ttdnd_negotiate_types,
|
||||
(_TT_CONST char **sourcetypes, _TT_CONST char **targettypes));
|
||||
|
||||
_TT_EXTERN_FUNC(void,ttdnd_start_transfer,
|
||||
(int sourceXid, const char *source_type,
|
||||
Ttdnd_receive_data_func *receivefunc));
|
||||
#undef _TT_CONST
|
||||
#undef _TT_EXTERN_FUNC
|
||||
#endif /* _TTDND_H */
|
||||
|
||||
|
||||
68
cde/lib/tt/lib/db/Imakefile
Normal file
68
cde/lib/tt/lib/db/Imakefile
Normal file
@@ -0,0 +1,68 @@
|
||||
XCOMM $XConsortium: Imakefile /main/7 1996/04/21 19:12:19 drk $
|
||||
#define DoNormalLib NormalLibTt
|
||||
#define DoSharedLib SharedLibTt
|
||||
#define DoDebugLib DebugLibTt
|
||||
#define DoProfileLib ProfileLibTt
|
||||
#define LibName tt
|
||||
#define SoRev SOTTREV
|
||||
#define LibHeaders NO
|
||||
#define LibCreate NO
|
||||
|
||||
#define CplusplusSource YES
|
||||
DEPEND_DEFINES = $(CXXDEPENDINCLUDES) $(ISAM_INCLUDES)
|
||||
|
||||
#include <Threads.tmpl>
|
||||
|
||||
#include "../../tooltalk.tmpl"
|
||||
|
||||
DEFINES =
|
||||
INCLUDES = -I../../lib
|
||||
ISAM_INCLUDES = -I../../mini_isam
|
||||
|
||||
/*** NOTE!
|
||||
*** Every time a .o is added below it needs to be added to
|
||||
*** the lib/tt/lib Imakefile in DB_OBJS and SHARED_DB_OBJS
|
||||
***/
|
||||
|
||||
SRCS = db_server_clnt.C db_server_xdr.C \
|
||||
old_db_server_functions.C tt_client_isam_file.C \
|
||||
tt_client_isam_file_utils.C tt_client_isam_key_descriptor.C \
|
||||
tt_client_isam_key_descriptor_utils.C tt_client_isam_record.C \
|
||||
tt_client_isam_record_utils.C tt_db_access_utils.C \
|
||||
tt_db_client.C tt_db_client_utils.C \
|
||||
tt_db_create_objid.C tt_db_file.C \
|
||||
tt_db_file_utils.C tt_db_hostname_global_map_ref.C \
|
||||
tt_db_hostname_redirection_map.C tt_db_key.C \
|
||||
tt_db_key_utils.C tt_db_network_path.C \
|
||||
tt_db_object.C tt_db_object_utils.C \
|
||||
tt_db_objid_to_key.C tt_db_property.C \
|
||||
tt_db_property_utils.C tt_db_rpc_message_routines.C \
|
||||
tt_db_rpc_routines.C tt_old_db.C \
|
||||
tt_old_db_message_info.C tt_old_db_message_info_utils.C \
|
||||
tt_old_db_partition_map_ref.C tt_old_db_utils.C
|
||||
|
||||
OBJS = db_server_clnt.o db_server_xdr.o \
|
||||
old_db_server_functions.o tt_client_isam_file.o \
|
||||
tt_client_isam_file_utils.o tt_client_isam_key_descriptor.o \
|
||||
tt_client_isam_key_descriptor_utils.o tt_client_isam_record.o \
|
||||
tt_client_isam_record_utils.o tt_db_access_utils.o \
|
||||
tt_db_client.o tt_db_client_utils.o \
|
||||
tt_db_create_objid.o tt_db_file.o \
|
||||
tt_db_file_utils.o tt_db_hostname_global_map_ref.o \
|
||||
tt_db_hostname_redirection_map.o tt_db_key.o \
|
||||
tt_db_key_utils.o tt_db_network_path.o \
|
||||
tt_db_object.o tt_db_object_utils.o \
|
||||
tt_db_objid_to_key.o tt_db_property.o \
|
||||
tt_db_property_utils.o tt_db_rpc_message_routines.o \
|
||||
tt_db_rpc_routines.o tt_old_db.o \
|
||||
tt_old_db_message_info.o tt_old_db_message_info_utils.o \
|
||||
tt_old_db_partition_map_ref.o tt_old_db_utils.o
|
||||
|
||||
|
||||
#include <Library.tmpl>
|
||||
|
||||
SpecialCplusplusLibObjectRule(db_server_xdr,,$(ISAM_INCLUDES))
|
||||
|
||||
SubdirLibraryRule($(OBJS))
|
||||
|
||||
DependTarget()
|
||||
1103
cde/lib/tt/lib/db/db_server.h
Normal file
1103
cde/lib/tt/lib/db/db_server.h
Normal file
File diff suppressed because it is too large
Load Diff
1157
cde/lib/tt/lib/db/db_server_clnt.C
Normal file
1157
cde/lib/tt/lib/db/db_server_clnt.C
Normal file
File diff suppressed because it is too large
Load Diff
1237
cde/lib/tt/lib/db/db_server_xdr.C
Normal file
1237
cde/lib/tt/lib/db/db_server_xdr.C
Normal file
File diff suppressed because it is too large
Load Diff
2045
cde/lib/tt/lib/db/old_db_server_functions.C
Normal file
2045
cde/lib/tt/lib/db/old_db_server_functions.C
Normal file
File diff suppressed because it is too large
Load Diff
305
cde/lib/tt/lib/db/tt_client_isam.h
Normal file
305
cde/lib/tt/lib/db/tt_client_isam.h
Normal file
@@ -0,0 +1,305 @@
|
||||
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
|
||||
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
|
||||
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
|
||||
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
|
||||
/*%% $XConsortium: tt_client_isam.h /main/3 1995/10/23 09:59:04 rswiston $ */
|
||||
/*
|
||||
@(#)isam.h
|
||||
1.17 90/01/20
|
||||
SMI */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
/*
|
||||
* isam.h
|
||||
*
|
||||
* Description:
|
||||
* isam.h is to be included in NetISAM C application programs.
|
||||
*
|
||||
* Make sure all.h changes in this file are reflected in lib/db/tt_client_isam.h
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _ISAM_H
|
||||
#define _ISAM_H
|
||||
|
||||
#include <limits.h>
|
||||
#ifndef LONG_BIT
|
||||
#define LONG_BIT 32
|
||||
#endif
|
||||
|
||||
extern short ldint();
|
||||
extern long ldlong();
|
||||
extern float ldfloat();
|
||||
extern double lddbl();
|
||||
extern short ldshort();
|
||||
extern ldchar(), stchar(), stlong(), stint(), stdbl(), stfloat();
|
||||
extern stbin(), ldbin();
|
||||
|
||||
extern int iserrno; /* isam error number code */
|
||||
extern long isrecnum; /* record number of last call */
|
||||
extern int isreclen; /* used for variable length recs */
|
||||
extern char isstat1; /* cobol status characters */
|
||||
extern char isstat2;
|
||||
|
||||
#define CHARTYPE 0
|
||||
#define CHARSIZE 1
|
||||
|
||||
#define INTTYPE 1
|
||||
#define INTSIZE 2
|
||||
|
||||
#define LONGTYPE 2
|
||||
#define LONGSIZE LONG_BIT/8
|
||||
|
||||
#define DOUBLETYPE 3
|
||||
#define DOUBLESIZE 8
|
||||
|
||||
#define FLOATTYPE 4
|
||||
#define FLOATSIZE 4
|
||||
|
||||
#define BINTYPE 5
|
||||
#define BINSIZE 1
|
||||
|
||||
#define MINTYPE 0
|
||||
#define MAXTYPE 6
|
||||
|
||||
#define ISDESC 0x80 /* add to make descending type */
|
||||
#define TYPEMASK 0x7f /* type mask */
|
||||
|
||||
#define BYTEMASK 0xff /* mask for one byte */
|
||||
#define BYTESHFT 8 /* shift for one byte */
|
||||
|
||||
/* mode parameter in isread() and isstart() */
|
||||
|
||||
#define ISFIRST 0 /* first record */
|
||||
#define ISLAST 1 /* last record */
|
||||
#define ISNEXT 2 /* next record */
|
||||
#define ISPREV 3 /* previous record */
|
||||
#define ISCURR 4 /* current record */
|
||||
|
||||
#define ISEQUAL 5 /* equal value */
|
||||
#define ISGREAT 6 /* greater value */
|
||||
#define ISGTEQ 7 /* >= value */
|
||||
#define ISLESS 8 /* < */
|
||||
#define ISLTEQ 9 /* <= */
|
||||
|
||||
/* isopen, isbuild lock modes */
|
||||
#define ISAUTOLOCK 0x200 /* automatic record lock */
|
||||
#define ISMANULOCK 0x400 /* manual record lock */
|
||||
#define ISEXCLLOCK 0x800 /* exclusive isam file lock */
|
||||
#define ISFASTLOCK 0x4000 /* no locking when EXCLLOCK! */
|
||||
|
||||
/* isread lock modes */
|
||||
#define ISLOCK 0x100 /* lock record before reading */
|
||||
#define ISSKIPLOCK 0x1000 /* advance record pointer to */
|
||||
/* locked record */
|
||||
/* isstart lock mode for automatic record locking */
|
||||
#define ISKEEPLOCK 0x2000 /* keep record locked */
|
||||
|
||||
/* Fix/Variable length records mode */
|
||||
#define ISFIXLEN 0
|
||||
#define ISVARLEN 0x10000
|
||||
|
||||
/* Access remote file via NFS */
|
||||
#define ISNFS 0x20000
|
||||
|
||||
|
||||
#define ISINPUT 0 /* open for input only */
|
||||
#define ISOUTPUT 1 /* open for output only */
|
||||
#define ISINOUT 2 /* open for input and output */
|
||||
|
||||
#define MAXKEYSIZE 150 /* max number of bytes in key */
|
||||
#define NPARTS 8 /* max number of key parts */
|
||||
|
||||
/*#define ISMAXRECLEN 8192 */ /* Maximum number of bytes in record */
|
||||
#define ISMAXRECLEN 65535 /* 64 K */
|
||||
#define ISMINRECLEN 4 /* Minimum number of bytes in record */
|
||||
|
||||
struct keypart {
|
||||
unsigned short kp_start; /* starting byte of key part */
|
||||
short kp_leng; /* length in bytes */
|
||||
short kp_type; /* type of key part */
|
||||
};
|
||||
|
||||
/* Because of a quirk in cfront, it is important *not* to define an array */
|
||||
/* of structures. We use a relatively gross hack to avoid this. */
|
||||
/* The ifdef is really just to keep the original code here to remind */
|
||||
/* us what it ought to look like. */
|
||||
#if !defined(__cplusplus)
|
||||
struct keydesc {
|
||||
short k_flags; /* flags */
|
||||
short k_nparts; /* number of parts in key */
|
||||
struct keypart k_part[NPARTS]; /* each part */
|
||||
};
|
||||
#else
|
||||
struct keydesc {
|
||||
short k_flags; /* flags */
|
||||
short k_nparts; /* number of parts in key */
|
||||
struct keypart k_part_0;
|
||||
struct keypart k_part_1;
|
||||
struct keypart k_part_2;
|
||||
struct keypart k_part_3;
|
||||
struct keypart k_part_4;
|
||||
struct keypart k_part_5;
|
||||
struct keypart k_part_6;
|
||||
struct keypart k_part_7;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
#define ISNODUPS 000 /* no duplicates and */
|
||||
/* no compression */
|
||||
#define ISDUPS 001 /* duplicates allowed */
|
||||
#define COMPRESS 020 /* full compression */
|
||||
|
||||
struct dictinfo {
|
||||
short di_nkeys; /* number of keys defined */
|
||||
unsigned short di_recsize; /* data record size */
|
||||
short di_idxsize; /* index record size */
|
||||
long di_nrecords; /* number of records in file */
|
||||
};
|
||||
|
||||
/* msb in di_nkeys indicates that ISAM file supports variable length records */
|
||||
#define DICTVARLENBIT 0x8000
|
||||
|
||||
/* mask to access the true number of keys */
|
||||
#define DICTNKEYSMASK (DICTVARLENBIT - 1)
|
||||
|
||||
|
||||
#define ENOERROR 0 /* No error */
|
||||
#define EDUPL 100 /* duplicate record */
|
||||
#define ENOTOPEN 101 /* file not open */
|
||||
#define EBADARG 102 /* illegal argument */
|
||||
#define EBADKEY 103 /* illegal key desc */
|
||||
#define ETOOMANY 104 /* too many files open */
|
||||
#define EBADFILE 105 /* bad ISAM file format */
|
||||
#define ENOTEXCL 106 /* non-exclusive access */
|
||||
#define ELOCKED 107 /* record locked */
|
||||
#define EKEXISTS 108 /* key already exists */
|
||||
#define EPRIMKEY 109 /* is primary key */
|
||||
#define EENDFILE 110 /* end/begin of file */
|
||||
#define ENOREC 111 /* no record found */
|
||||
#define ENOCURR 112 /* no current record */
|
||||
#define EFLOCKED 113 /* file locked */
|
||||
#define EFNAME 114 /* file name too long */
|
||||
#define EBADMEM 116 /* cannot allocate memory */
|
||||
|
||||
/* NetISAM specific error codes non XOPEN compliant*/
|
||||
#define ETIMEOUT 1117 /* RPC timeout */
|
||||
#define ERPC 1118 /* Broken TCP/IP */
|
||||
#define ETCP 1119 /* Cannot connect to server */
|
||||
#define EIMPORT 1120 /* Cannot import */
|
||||
#define ENODAEMON 1121 /* no local daemon */
|
||||
#define EFATAL 1122 /* internal fatal error */
|
||||
#define ELANG 1123 /* Locale/LANG mismatch */
|
||||
|
||||
|
||||
#define ISOK 0 /* no error return code */
|
||||
#define ISERROR -1 /* error return code */
|
||||
|
||||
|
||||
extern struct keydesc *nokey; /* May be used as parameter
|
||||
* to isbuild() if no
|
||||
* primary key is to be built
|
||||
*/
|
||||
|
||||
/* ischeckindex() diagmode values */
|
||||
#define CHK_NODIAG 0 /* do not print any messages */
|
||||
#define CHK_DIAG 1 /* Access Level module will print to stderr */
|
||||
|
||||
/* values of corrupt parameter of ischeckindex() */
|
||||
#define CHK_OK 0 /* ISAM file is not corrupted */
|
||||
#define CHK_DAT 1 /* .dat file is corrupted */
|
||||
#define CHK_VAR 2 /* .var file is corrupted */
|
||||
#define CHK_IND 3 /* .ind file is corrupted */
|
||||
|
||||
|
||||
/* iscntl() definitions */
|
||||
/* For one isfd - use iscntl(isfd, func, ...) */
|
||||
#define ISCNTL_RPCS_TO_SET 1 /* short oper. timeout (in sec) */
|
||||
#define ISCNTL_RPCS_TO_GET 2 /* short oper. timeout (in sec) */
|
||||
#define ISCNTL_RPCL_TO_SET 3 /* long oper. timeout (in sec) */
|
||||
#define ISCNTL_RPCL_TO_GET 4 /* long oper. timeout (in sec) */
|
||||
#define ISCNTL_TCP_TO_SET 5 /* timeout to reconnect TCP?IP */
|
||||
#define ISCNTL_TCP_TO_GET 6 /* timeout to reconnect TCP?IP */
|
||||
#define ISCNTL_APPLMAGIC_WRITE 7 /* Write Appl. Magic */
|
||||
#define ISCNTL_APPLMAGIC_READ 8 /* Read Appl. Magic */
|
||||
#define ISCNTL_FSYNC 9 /* Flush pages to disk */
|
||||
#define ISCNTL_FDLIMIT_SET 10 /* Set UNIX fd usage limit */
|
||||
#define ISCNTL_FDLIMIT_GET 11 /* Get UNIX fd usage limit */
|
||||
#define ISCNTL_FATAL 12 /* Specify NetISAM fatal error hadler */
|
||||
#define ISCNTL_MASKSIGNALS 13 /* Enable or Disable masking signals during NetISAM operations */
|
||||
|
||||
#define ISAPPLMAGICLEN 32
|
||||
|
||||
/*
|
||||
* ALLISFD in iscntl() calls means that the operation should be done
|
||||
* on all open file descriptors, or the operation is not related to
|
||||
* any file descriptor (e.g: maskintg signals)
|
||||
*/
|
||||
#define ALLISFD (-2)
|
||||
|
||||
/* isshowlocks() and isshowhostlocks() return an array of struct showlock */
|
||||
#define IPADDRLEN 4 /* IP address length */
|
||||
struct showlock {
|
||||
short dev; /* Major/Minor device number,
|
||||
* actually type dev_t */
|
||||
long inode; /* inode number */
|
||||
long recnum; /* record number */
|
||||
char hostid[IPADDRLEN]; /* IP address of host */
|
||||
short pid; /* UNIX process ID */
|
||||
long uid; /* User ID */
|
||||
short type; /* See below */
|
||||
};
|
||||
|
||||
|
||||
/* NetISAM Programmer Toolkit related definitions */
|
||||
|
||||
struct isfldmap {
|
||||
char *flm_fldname;
|
||||
short flm_recoff;
|
||||
short flm_bufoff;
|
||||
short flm_type;
|
||||
short flm_length;
|
||||
};
|
||||
|
||||
struct istableinfo {
|
||||
char *tbi_tablename;
|
||||
int tbi_reclength;
|
||||
int tbi_nfields;
|
||||
struct isfldmap *tbi_fields;
|
||||
int tbi_nkeys;
|
||||
struct keydesc *tbi_keys;
|
||||
char **tbi_keynames;
|
||||
};
|
||||
|
||||
/* record descriptor isreadm/iswritem record descriptor */
|
||||
struct recorddesc {
|
||||
char *rec_buffer;
|
||||
long rec_number;
|
||||
short rec_length;
|
||||
short rec_locked;
|
||||
};
|
||||
|
||||
/*
|
||||
* The following defines and variable definitions are not used by NetISAM 1.0.
|
||||
* They are defined for compatibility with VSX 2.5.
|
||||
*/
|
||||
#define EBADCOLL (-1)
|
||||
|
||||
#define IO_OPEN 0x10 /* open() */
|
||||
#define IO_CREA 0x20 /* creat() */
|
||||
#define IO_SEEK 0x30 /* lseek() */
|
||||
#define IO_READ 0x40 /* read() */
|
||||
#define IO_WRIT 0x50 /* write() */
|
||||
#define IO_LOCK 0x60 /* lockf() */
|
||||
#define IO_IOCTL 0x70 /* ioctl() */
|
||||
#define IO_RENAME 0x80 /* rename() */
|
||||
#define IO_UNLINK 0x90 /* unlink() */
|
||||
|
||||
extern int iserrio;
|
||||
|
||||
|
||||
#endif /* !_ISAM_H */
|
||||
332
cde/lib/tt/lib/db/tt_client_isam_file.C
Normal file
332
cde/lib/tt/lib/db/tt_client_isam_file.C
Normal file
@@ -0,0 +1,332 @@
|
||||
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
//%% (c) Copyright 1993, 1994 Novell, Inc.
|
||||
//%% $XConsortium: tt_client_isam_file.C /main/3 1995/10/23 09:59:12 rswiston $
|
||||
/*
|
||||
* tt_client_isam_file.cc - Defines the TT ISAM file class. This class
|
||||
* simplifies opening, closing, reading and writing an ISAM file.
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#include "db/tt_client_isam.h"
|
||||
#include "db/tt_client_isam_file.h"
|
||||
#include "db/tt_old_db_consts.h"
|
||||
|
||||
_Tt_client_isam_file::_Tt_client_isam_file (const _Tt_string &file,
|
||||
int mode,
|
||||
const _Tt_db_client_ptr &db_connection)
|
||||
{
|
||||
dbConnection = db_connection;
|
||||
|
||||
setTtISAMFileDefaults();
|
||||
fileName = file;
|
||||
fileMode = mode;
|
||||
|
||||
if ((fileDescriptor = dbConnection->isopen(file, mode)) != -1) {
|
||||
getISAMFileInfo();
|
||||
}
|
||||
else {
|
||||
getStatusInfo();
|
||||
}
|
||||
}
|
||||
|
||||
_Tt_client_isam_file
|
||||
::_Tt_client_isam_file (const _Tt_string &file,
|
||||
int max_record_length,
|
||||
int min_record_length,
|
||||
_Tt_client_isam_key_descriptor_ptr primary_key_descriptor,
|
||||
int mode,
|
||||
const _Tt_db_client_ptr &db_connection)
|
||||
{
|
||||
dbConnection = db_connection;
|
||||
|
||||
setTtISAMFileDefaults();
|
||||
fileName = file;
|
||||
fileMode = mode;
|
||||
|
||||
// Because a old TT client may be talking with the old DB, make sure
|
||||
// files are opened with a manual lock, not an exclusive lock.
|
||||
if ((fileDescriptor =
|
||||
dbConnection->isopen(file, mode&(~ISEXCLLOCK)|ISMANULOCK)) == -1) {
|
||||
newFlag = TRUE;
|
||||
dbConnection->isreclen = min_record_length;
|
||||
fileDescriptor = dbConnection->isbuild(file,
|
||||
(max_record_length > TT_OLD_MAX_RECORD_LENGTH ?
|
||||
TT_OLD_MAX_RECORD_LENGTH : max_record_length),
|
||||
primary_key_descriptor->getKeyDescriptor(),
|
||||
mode);
|
||||
}
|
||||
|
||||
if (fileDescriptor != -1) {
|
||||
getISAMFileInfo();
|
||||
}
|
||||
else {
|
||||
errorStatus = dbConnection->iserrno;
|
||||
currentRecordLength = -1;
|
||||
currentRecordNumber = -1;
|
||||
}
|
||||
}
|
||||
|
||||
void _Tt_client_isam_file::setTtISAMFileDefaults ()
|
||||
{
|
||||
eraseFlag = FALSE;
|
||||
fileName = (char *)NULL;
|
||||
fileMode = 0;
|
||||
keyDescriptorList = new _Tt_client_isam_key_descriptor_list;
|
||||
newFlag = FALSE;
|
||||
|
||||
dbConnection->iserrno = 0;
|
||||
}
|
||||
|
||||
_Tt_client_isam_file::~_Tt_client_isam_file ()
|
||||
{
|
||||
if (eraseFlag) {
|
||||
(void)dbConnection->iserase(fileName);
|
||||
}
|
||||
else {
|
||||
(void)dbConnection->isclose(fileDescriptor);
|
||||
}
|
||||
}
|
||||
|
||||
void _Tt_client_isam_file::setErase (bool_t flag)
|
||||
{
|
||||
eraseFlag = flag;
|
||||
}
|
||||
|
||||
int _Tt_client_isam_file::addIndex (_Tt_client_isam_key_descriptor_ptr key_descriptor)
|
||||
{
|
||||
dbConnection->iserrno = 0;
|
||||
|
||||
int results = dbConnection->isaddindex(fileDescriptor, key_descriptor->getKeyDescriptor());
|
||||
|
||||
errorStatus = dbConnection->iserrno;
|
||||
if (!results) {
|
||||
getISAMFileInfo();
|
||||
}
|
||||
|
||||
return errorStatus;
|
||||
}
|
||||
|
||||
_Tt_client_isam_record_ptr _Tt_client_isam_file::getEmptyRecord ()
|
||||
{
|
||||
return (new _Tt_client_isam_record(keyDescriptorList,
|
||||
maxRecordLength,
|
||||
minRecordLength));
|
||||
}
|
||||
|
||||
int _Tt_client_isam_file
|
||||
::findStartRecord (const _Tt_client_isam_key_descriptor_ptr &key_descriptor,
|
||||
int length,
|
||||
const _Tt_client_isam_record_ptr &record,
|
||||
int mode)
|
||||
{
|
||||
dbConnection->iserrno = 0;
|
||||
|
||||
dbConnection->isreclen = record->getLength();
|
||||
(void)dbConnection->isstart(fileDescriptor,
|
||||
key_descriptor->getKeyDescriptor(),
|
||||
length,
|
||||
(char *)record->getRecord(),
|
||||
mode);
|
||||
|
||||
getStatusInfo();
|
||||
return errorStatus;
|
||||
}
|
||||
|
||||
_Tt_client_isam_record_ptr _Tt_client_isam_file::readRecord (int mode)
|
||||
{
|
||||
dbConnection->iserrno = 0;
|
||||
|
||||
_Tt_client_isam_record_ptr record = (_Tt_client_isam_record *)NULL;
|
||||
_Tt_string record_buffer(maxRecordLength);
|
||||
dbConnection->isreclen = maxRecordLength;
|
||||
int results = dbConnection->isread(fileDescriptor,
|
||||
(char *)record_buffer,
|
||||
mode);
|
||||
|
||||
getStatusInfo();
|
||||
if (!results) {
|
||||
record = getFullRecord(record_buffer);
|
||||
}
|
||||
|
||||
return record;
|
||||
}
|
||||
|
||||
int _Tt_client_isam_file::readRecord (int mode,
|
||||
const _Tt_client_isam_record_ptr &record)
|
||||
{
|
||||
dbConnection->iserrno = 0;
|
||||
|
||||
dbConnection->isreclen = record->getLength();
|
||||
int results = dbConnection->isread(fileDescriptor, (char *)record->getRecord(), mode);
|
||||
|
||||
getStatusInfo();
|
||||
if (!results) {
|
||||
record->setLength(currentRecordLength);
|
||||
}
|
||||
|
||||
return errorStatus;
|
||||
}
|
||||
|
||||
int
|
||||
_Tt_client_isam_file::updateRecord (long recnum, const _Tt_client_isam_record_ptr &record)
|
||||
{
|
||||
dbConnection->iserrno = 0;
|
||||
|
||||
dbConnection->isreclen = record->getLength();
|
||||
(void)dbConnection->isrewrec(fileDescriptor, recnum, (char *)record->getRecord());
|
||||
|
||||
getStatusInfo();
|
||||
return errorStatus;
|
||||
}
|
||||
|
||||
int _Tt_client_isam_file::writeRecord (const _Tt_client_isam_record_ptr &record)
|
||||
{
|
||||
dbConnection->iserrno = 0;
|
||||
|
||||
dbConnection->isreclen = record->getLength();
|
||||
(void)dbConnection->iswrite(fileDescriptor, (char *)record->getRecord());
|
||||
|
||||
getStatusInfo();
|
||||
return errorStatus;
|
||||
}
|
||||
|
||||
int
|
||||
_Tt_client_isam_file::deleteRecord (long recnum,
|
||||
const _Tt_client_isam_record_ptr &record)
|
||||
{
|
||||
dbConnection->iserrno = 0;
|
||||
|
||||
dbConnection->isreclen = record->getLength();
|
||||
(void)dbConnection->isdelrec(fileDescriptor,
|
||||
recnum,
|
||||
(char *)record->getRecord());
|
||||
|
||||
getStatusInfo();
|
||||
return errorStatus;
|
||||
}
|
||||
|
||||
int _Tt_client_isam_file::writeMagicString (const _Tt_string &magic_string)
|
||||
{
|
||||
dbConnection->iserrno = 0;
|
||||
|
||||
(void)dbConnection->iscntl(fileDescriptor,
|
||||
ISCNTL_APPLMAGIC_WRITE,
|
||||
(char *)magic_string);
|
||||
|
||||
errorStatus = dbConnection->iserrno;
|
||||
return errorStatus;
|
||||
}
|
||||
|
||||
_Tt_string _Tt_client_isam_file::readMagicString ()
|
||||
{
|
||||
dbConnection->iserrno = 0;
|
||||
|
||||
_Tt_string magic_string_bytes(ISAPPLMAGICLEN);
|
||||
memset((char *)magic_string_bytes, '\0', ISAPPLMAGICLEN);
|
||||
|
||||
(void)dbConnection->iscntl(fileDescriptor,
|
||||
ISCNTL_APPLMAGIC_READ,
|
||||
(char *)magic_string_bytes);
|
||||
|
||||
errorStatus = dbConnection->iserrno;
|
||||
|
||||
_Tt_string magic_string = (char *)magic_string_bytes;
|
||||
return magic_string;
|
||||
}
|
||||
|
||||
_Tt_client_isam_record_ptr
|
||||
_Tt_client_isam_file::getFullRecord (const _Tt_string &record_buffer)
|
||||
{
|
||||
_Tt_client_isam_record_ptr record_ptr = new _Tt_client_isam_record(keyDescriptorList,
|
||||
maxRecordLength,
|
||||
minRecordLength);
|
||||
record_ptr->setBytes(0, currentRecordLength, record_buffer);
|
||||
record_ptr->setLength(currentRecordLength);
|
||||
|
||||
return record_ptr;
|
||||
}
|
||||
|
||||
void _Tt_client_isam_file::getISAMFileInfo ()
|
||||
{
|
||||
keyDescriptorList->flush();
|
||||
|
||||
if (!strcmp(TT_OLD_DB_PROPERTY_TABLE_FILE,
|
||||
(char *)fileName+
|
||||
fileName.len()-
|
||||
strlen(TT_OLD_DB_PROPERTY_TABLE_FILE))) {
|
||||
maxRecordLength = TT_OLD_MAX_RECORD_LENGTH;
|
||||
minRecordLength = TT_OLD_DB_KEY_LENGTH+TT_OLD_DB_MAX_PROPERTY_NAME_LENGTH;
|
||||
|
||||
_Tt_client_isam_key_descriptor_ptr key_descriptor =
|
||||
new _Tt_client_isam_key_descriptor;
|
||||
|
||||
key_descriptor->addKeyPart(TT_OLD_DB_FIRST_KEY_OFFSET,
|
||||
TT_OLD_DB_KEY_LENGTH,
|
||||
BINTYPE);
|
||||
key_descriptor->addKeyPart(TT_OLD_DB_PROPERTY_NAME_OFFSET,
|
||||
TT_OLD_DB_MAX_PROPERTY_NAME_LENGTH,
|
||||
CHARTYPE);
|
||||
key_descriptor->setDuplicates(TRUE);
|
||||
|
||||
keyDescriptorList->append(key_descriptor);
|
||||
}
|
||||
else if (!strcmp(TT_OLD_DB_ACCESS_TABLE_FILE,
|
||||
(char *)fileName+
|
||||
fileName.len()-
|
||||
strlen(TT_OLD_DB_ACCESS_TABLE_FILE))) {
|
||||
maxRecordLength = minRecordLength = TT_OLD_DB_KEY_LENGTH+
|
||||
3*TT_OLD_DB_SHORT_SIZE;
|
||||
|
||||
_Tt_client_isam_key_descriptor_ptr key_descriptor =
|
||||
new _Tt_client_isam_key_descriptor;
|
||||
|
||||
key_descriptor->addKeyPart(TT_OLD_DB_FIRST_KEY_OFFSET,
|
||||
TT_OLD_DB_KEY_LENGTH,
|
||||
BINTYPE);
|
||||
|
||||
keyDescriptorList->append(key_descriptor);
|
||||
}
|
||||
else if (!strcmp(TT_OLD_DB_FILE_TABLE_FILE,
|
||||
(char *)fileName+
|
||||
fileName.len()-
|
||||
strlen(TT_OLD_DB_FILE_TABLE_FILE))) {
|
||||
maxRecordLength = TT_OLD_DB_KEY_LENGTH+MAXPATHLEN;
|
||||
minRecordLength = TT_OLD_DB_KEY_LENGTH+TT_OLD_DB_MAX_KEY_LENGTH;
|
||||
|
||||
_Tt_client_isam_key_descriptor_ptr key_descriptor =
|
||||
new _Tt_client_isam_key_descriptor;
|
||||
key_descriptor->addKeyPart(TT_OLD_DB_FIRST_KEY_OFFSET,
|
||||
TT_OLD_DB_KEY_LENGTH,
|
||||
BINTYPE);
|
||||
keyDescriptorList->append(key_descriptor);
|
||||
|
||||
key_descriptor = new _Tt_client_isam_key_descriptor;
|
||||
key_descriptor->addKeyPart(TT_OLD_DB_FILE_PATH_OFFSET,
|
||||
TT_OLD_DB_MAX_KEY_LENGTH,
|
||||
CHARTYPE);
|
||||
keyDescriptorList->append(key_descriptor);
|
||||
}
|
||||
// TT_OLD_DB_FILE_OBJECT_MAP_FILE
|
||||
else {
|
||||
maxRecordLength = minRecordLength = 2*TT_OLD_DB_KEY_LENGTH;
|
||||
|
||||
_Tt_client_isam_key_descriptor_ptr key_descriptor =
|
||||
new _Tt_client_isam_key_descriptor;
|
||||
key_descriptor->addKeyPart(TT_OLD_DB_FIRST_KEY_OFFSET,
|
||||
TT_OLD_DB_KEY_LENGTH,
|
||||
BINTYPE);
|
||||
keyDescriptorList->append(key_descriptor);
|
||||
|
||||
key_descriptor = new _Tt_client_isam_key_descriptor;
|
||||
key_descriptor->addKeyPart(TT_OLD_DB_SECOND_KEY_OFFSET,
|
||||
TT_OLD_DB_KEY_LENGTH,
|
||||
CHARTYPE);
|
||||
key_descriptor->setDuplicates(TRUE);
|
||||
keyDescriptorList->append(key_descriptor);
|
||||
}
|
||||
|
||||
errorStatus = dbConnection->iserrno = 0;
|
||||
}
|
||||
110
cde/lib/tt/lib/db/tt_client_isam_file.h
Normal file
110
cde/lib/tt/lib/db/tt_client_isam_file.h
Normal file
@@ -0,0 +1,110 @@
|
||||
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
|
||||
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
|
||||
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
|
||||
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
|
||||
/*%% $XConsortium: tt_client_isam_file.h /main/3 1995/10/23 09:59:20 rswiston $ */
|
||||
/*
|
||||
* tt_client_isam_file.h - Defines the TT ISAM file class. This class
|
||||
* simplifies opening, closing, reading and writing an ISAM file.
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#ifndef _TT_CLIENT_ISAM_FILE_H
|
||||
#define _TT_CLIENT_ISAM_FILE_H
|
||||
|
||||
#include "util/tt_object.h"
|
||||
#include "db/tt_db_client_utils.h"
|
||||
#include "db/tt_client_isam_key_descriptor_utils.h"
|
||||
#include "db/tt_client_isam_record_utils.h"
|
||||
#include <sys/param.h>
|
||||
|
||||
class _Tt_client_isam_file : public _Tt_object {
|
||||
public:
|
||||
// Dummy constructor needed to make _tt_client_isam_file_utils.cc happy
|
||||
_Tt_client_isam_file () {}
|
||||
|
||||
// Real constructors
|
||||
_Tt_client_isam_file (const _Tt_string &file,
|
||||
int mode,
|
||||
const _Tt_db_client_ptr &db_connection);
|
||||
_Tt_client_isam_file (const _Tt_string &file,
|
||||
int max_record_length,
|
||||
int min_record_length,
|
||||
_Tt_client_isam_key_descriptor_ptr primary_key_descriptor,
|
||||
int mode,
|
||||
const _Tt_db_client_ptr &db_connection);
|
||||
~_Tt_client_isam_file ();
|
||||
|
||||
void setErase (bool_t);
|
||||
|
||||
int addIndex (_Tt_client_isam_key_descriptor_ptr);
|
||||
_Tt_client_isam_record_ptr getEmptyRecord ();
|
||||
|
||||
int findStartRecord (const _Tt_client_isam_key_descriptor_ptr &key_descriptor,
|
||||
int length,
|
||||
const _Tt_client_isam_record_ptr &record,
|
||||
int mode);
|
||||
|
||||
_Tt_client_isam_record_ptr readRecord (int mode);
|
||||
int readRecord (int mode, const _Tt_client_isam_record_ptr&);
|
||||
int updateRecord (long recnum, const _Tt_client_isam_record_ptr&);
|
||||
int writeRecord (const _Tt_client_isam_record_ptr&);
|
||||
int deleteRecord (long recnum,
|
||||
const _Tt_client_isam_record_ptr &record);
|
||||
|
||||
int writeMagicString (const _Tt_string&);
|
||||
_Tt_string readMagicString ();
|
||||
|
||||
long getLastRecordNumber () const
|
||||
{
|
||||
return currentRecordNumber;
|
||||
}
|
||||
|
||||
int getFileDescriptor () const
|
||||
{
|
||||
return fileDescriptor;
|
||||
}
|
||||
|
||||
const _Tt_string &getName () const
|
||||
{
|
||||
return fileName;
|
||||
}
|
||||
|
||||
int getErrorStatus () const
|
||||
{
|
||||
return errorStatus;
|
||||
}
|
||||
|
||||
bool_t isNew () const
|
||||
{
|
||||
return newFlag;
|
||||
}
|
||||
|
||||
private:
|
||||
int currentRecordLength;
|
||||
long currentRecordNumber;
|
||||
_Tt_db_client_ptr dbConnection;
|
||||
bool_t eraseFlag;
|
||||
int errorStatus;
|
||||
int fileDescriptor;
|
||||
_Tt_string fileName;
|
||||
int fileMode;
|
||||
_Tt_client_isam_key_descriptor_list_ptr keyDescriptorList;
|
||||
int maxRecordLength;
|
||||
int minRecordLength;
|
||||
bool_t newFlag;
|
||||
|
||||
void setTtISAMFileDefaults ();
|
||||
_Tt_client_isam_record_ptr getFullRecord (const _Tt_string&);
|
||||
void getISAMFileInfo ();
|
||||
|
||||
void getStatusInfo ()
|
||||
{
|
||||
currentRecordLength = dbConnection->isreclen;
|
||||
currentRecordNumber = dbConnection->isrecnum;
|
||||
errorStatus = dbConnection->iserrno;
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* _TT_CLIENT_ISAM_FILE_H */
|
||||
15
cde/lib/tt/lib/db/tt_client_isam_file_utils.C
Normal file
15
cde/lib/tt/lib/db/tt_client_isam_file_utils.C
Normal file
@@ -0,0 +1,15 @@
|
||||
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
//%% (c) Copyright 1993, 1994 Novell, Inc.
|
||||
//%% $XConsortium: tt_client_isam_file_utils.C /main/3 1995/10/23 09:59:27 rswiston $
|
||||
/*
|
||||
* tt_client_isam_file_utils.cc - Defines the _Tt_client_isam_file class
|
||||
* utilities.
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#include "db/tt_client_isam_file_utils.h"
|
||||
|
||||
implement_ptr_to(_Tt_client_isam_file)
|
||||
20
cde/lib/tt/lib/db/tt_client_isam_file_utils.h
Normal file
20
cde/lib/tt/lib/db/tt_client_isam_file_utils.h
Normal file
@@ -0,0 +1,20 @@
|
||||
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
|
||||
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
|
||||
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
|
||||
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
|
||||
/*%% $XConsortium: tt_client_isam_file_utils.h /main/3 1995/10/23 09:59:34 rswiston $ */
|
||||
/*
|
||||
* tt_client_isam_file_utils.h - Declares the _Tt_client_isam_file class
|
||||
* utilities.
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#ifndef _TT_CLIENT_ISAM_FILE_UTILS_H
|
||||
#define _TT_CLIENT_ISAM_FILE_UTILS_H
|
||||
|
||||
#include "db/tt_client_isam_file.h"
|
||||
|
||||
declare_ptr_to(_Tt_client_isam_file)
|
||||
|
||||
#endif // _TT_CLIENT_ISAM_FILE_UTILS_H
|
||||
85
cde/lib/tt/lib/db/tt_client_isam_key_descriptor.C
Normal file
85
cde/lib/tt/lib/db/tt_client_isam_key_descriptor.C
Normal file
@@ -0,0 +1,85 @@
|
||||
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
//%% (c) Copyright 1993, 1994 Novell, Inc.
|
||||
//%% $XConsortium: tt_client_isam_key_descriptor.C /main/3 1995/10/23 09:59:42 rswiston $
|
||||
/*
|
||||
* tt_client_isam_key_descriptor.cc - Defines the TT ISAM key descriptor class.
|
||||
* This class is used to hold the information required
|
||||
* to create a NetISAM key descriptor. It also makes
|
||||
* it very easy to construct the descriptor.
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#include "db/tt_client_isam_key_descriptor.h"
|
||||
|
||||
_Tt_client_isam_key_descriptor::_Tt_client_isam_key_descriptor ()
|
||||
{
|
||||
keyDescriptor.k_flags = 0;
|
||||
keyDescriptor.k_nparts = 0;
|
||||
}
|
||||
|
||||
_Tt_client_isam_key_descriptor::~_Tt_client_isam_key_descriptor ()
|
||||
{
|
||||
}
|
||||
|
||||
short _Tt_client_isam_key_descriptor::addKeyPart (short start, short length, short type)
|
||||
{
|
||||
int index = -1;
|
||||
|
||||
if (keyDescriptor.k_nparts < NPARTS-1) {
|
||||
index = keyDescriptor.k_nparts;
|
||||
|
||||
(&keyDescriptor.k_part_0 + index)->kp_start = start;
|
||||
(&keyDescriptor.k_part_0 + index)->kp_leng = length;
|
||||
(&keyDescriptor.k_part_0 + index)->kp_type = type;
|
||||
|
||||
keyDescriptor.k_nparts++;
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
short _Tt_client_isam_key_descriptor::setKeyPart (short index,
|
||||
short start,
|
||||
short length,
|
||||
short type)
|
||||
{
|
||||
short error = 0;
|
||||
|
||||
if ((index > -1) && (index < keyDescriptor.k_nparts)) {
|
||||
(&keyDescriptor.k_part_0 + index)->kp_start = start;
|
||||
(&keyDescriptor.k_part_0 + index)->kp_leng = length;
|
||||
(&keyDescriptor.k_part_0 + index)->kp_type = type;
|
||||
}
|
||||
else {
|
||||
error = -1;
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
short _Tt_client_isam_key_descriptor::getKeyPart (short index,
|
||||
short &start,
|
||||
short &length,
|
||||
short &type) const
|
||||
{
|
||||
short error = 0;
|
||||
|
||||
if ((index > -1) && (index < keyDescriptor.k_nparts)) {
|
||||
|
||||
|
||||
start = (&keyDescriptor.k_part_0 + index)->kp_start;
|
||||
length = (&keyDescriptor.k_part_0 + index)->kp_leng;
|
||||
type = (&keyDescriptor.k_part_0 + index)->kp_type;
|
||||
}
|
||||
else {
|
||||
start = -1;
|
||||
length = -1;
|
||||
type = -1;
|
||||
error = -1;
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
82
cde/lib/tt/lib/db/tt_client_isam_key_descriptor.h
Normal file
82
cde/lib/tt/lib/db/tt_client_isam_key_descriptor.h
Normal file
@@ -0,0 +1,82 @@
|
||||
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
|
||||
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
|
||||
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
|
||||
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
|
||||
/*%% $XConsortium: tt_client_isam_key_descriptor.h /main/3 1995/10/23 09:59:50 rswiston $ */
|
||||
/*
|
||||
* tt_client_isam_key_descriptor.h - Defines the TT ISAM key descriptor class.
|
||||
* This class is used to hold the information required
|
||||
* to create a NetISAM key descriptor. It also makes
|
||||
* it very easy to construct the descriptor.
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#ifndef _TT_CLIENT_ISAM_KEY_DESCRIPTOR_H
|
||||
#define _TT_CLIENT_ISAM_KEY_DESCRIPTOR_H
|
||||
|
||||
#include "db/tt_client_isam.h"
|
||||
#include "util/tt_object.h"
|
||||
|
||||
class _Tt_client_isam_key_descriptor : public _Tt_object {
|
||||
public:
|
||||
_Tt_client_isam_key_descriptor ();
|
||||
~_Tt_client_isam_key_descriptor ();
|
||||
|
||||
void setCompress (bool_t flag)
|
||||
{
|
||||
if (flag) {
|
||||
keyDescriptor.k_flags |= COMPRESS;
|
||||
}
|
||||
else {
|
||||
keyDescriptor.k_flags &= (short) (0xFFFF - COMPRESS);
|
||||
}
|
||||
}
|
||||
|
||||
bool_t isCompressSet ()
|
||||
{
|
||||
return ((keyDescriptor.k_flags & COMPRESS) ? TRUE : FALSE);
|
||||
}
|
||||
|
||||
void setDuplicates (bool_t flag)
|
||||
{
|
||||
if (flag) {
|
||||
keyDescriptor.k_flags &= (short) (0xFFFF - ISNODUPS);
|
||||
keyDescriptor.k_flags |= ISDUPS;
|
||||
}
|
||||
else {
|
||||
keyDescriptor.k_flags &= (short) (0xFFFF - ISDUPS);
|
||||
keyDescriptor.k_flags |= ISNODUPS;
|
||||
}
|
||||
}
|
||||
|
||||
bool_t isDuplicatesSet ()
|
||||
{
|
||||
return ((keyDescriptor.k_flags & ISDUPS) ? TRUE : FALSE);
|
||||
}
|
||||
|
||||
short addKeyPart (short start, short length, short type);
|
||||
short setKeyPart (short index, short start, short length, short type);
|
||||
|
||||
short getKeyPart (short index,
|
||||
short &start,
|
||||
short &length,
|
||||
short &type) const;
|
||||
|
||||
short getNumberOfParts () const
|
||||
{
|
||||
return keyDescriptor.k_nparts;
|
||||
}
|
||||
|
||||
keydesc *getKeyDescriptor ()
|
||||
{
|
||||
return &keyDescriptor;
|
||||
}
|
||||
|
||||
private:
|
||||
struct keydesc keyDescriptor;
|
||||
|
||||
friend class _Tt_client_isam_file;
|
||||
};
|
||||
|
||||
#endif /* _TT_CLIENT_ISAM_KEY_DESCRIPTOR_H */
|
||||
15
cde/lib/tt/lib/db/tt_client_isam_key_descriptor_utils.C
Normal file
15
cde/lib/tt/lib/db/tt_client_isam_key_descriptor_utils.C
Normal file
@@ -0,0 +1,15 @@
|
||||
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
//%% (c) Copyright 1993, 1994 Novell, Inc.
|
||||
//%% $XConsortium: tt_client_isam_key_descriptor_utils.C /main/3 1995/10/23 09:59:56 rswiston $
|
||||
/*
|
||||
* tt_client_isam_key_descriptor_utils.cc - Defines the
|
||||
* _Tt_client_isam_key_descriptor class utilities.
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#include "db/tt_client_isam_key_descriptor_utils.h"
|
||||
|
||||
implement_list_of(_Tt_client_isam_key_descriptor)
|
||||
21
cde/lib/tt/lib/db/tt_client_isam_key_descriptor_utils.h
Normal file
21
cde/lib/tt/lib/db/tt_client_isam_key_descriptor_utils.h
Normal file
@@ -0,0 +1,21 @@
|
||||
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
|
||||
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
|
||||
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
|
||||
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
|
||||
/*%% $XConsortium: tt_client_isam_key_descriptor_utils.h /main/3 1995/10/23 10:00:04 rswiston $ */
|
||||
/*
|
||||
* tt_client_isam_key_descriptor_utils.h - Declares the
|
||||
* _Tt_client_isam_key_descriptor class utilities.
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#ifndef _TT_CLIENT_ISAM_KEY_DESCRIPTOR_UTILS_H
|
||||
#define _TT_CLIENT_ISAM_KEY_DESCRIPTOR_UTILS_H
|
||||
|
||||
#include "util/tt_list.h"
|
||||
#include "db/tt_client_isam_key_descriptor.h"
|
||||
|
||||
declare_list_of(_Tt_client_isam_key_descriptor)
|
||||
|
||||
#endif // _TT_CLIENT_ISAM_KEY_DESCRIPTOR_UTILS_H
|
||||
128
cde/lib/tt/lib/db/tt_client_isam_record.C
Normal file
128
cde/lib/tt/lib/db/tt_client_isam_record.C
Normal file
@@ -0,0 +1,128 @@
|
||||
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
//%% (c) Copyright 1993, 1994 Novell, Inc.
|
||||
//%% $XConsortium: tt_client_isam_record.C /main/3 1995/10/23 10:00:11 rswiston $
|
||||
/*
|
||||
* tt_client_isam_record.cc - Defines the TT ISAM record class.
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#include "db/tt_client_isam_record.h"
|
||||
|
||||
_Tt_client_isam_record::
|
||||
_Tt_client_isam_record (const _Tt_client_isam_key_descriptor_list_ptr &key_descriptor_list,
|
||||
int max_record_length,
|
||||
int min_record_length)
|
||||
{
|
||||
_Tt_string new_buffer(max_record_length);
|
||||
memset((char *)new_buffer, '\0', max_record_length);
|
||||
|
||||
buffer = new_buffer;
|
||||
keyDescriptorList = key_descriptor_list;
|
||||
currentLength = min_record_length;
|
||||
maxLength = max_record_length;
|
||||
minLength = min_record_length;
|
||||
}
|
||||
|
||||
_Tt_client_isam_record::~_Tt_client_isam_record ()
|
||||
{
|
||||
}
|
||||
|
||||
int _Tt_client_isam_record::getNumberOfKeys () const
|
||||
{
|
||||
return keyDescriptorList->count();
|
||||
}
|
||||
|
||||
_Tt_client_isam_key_descriptor_ptr _Tt_client_isam_record::getKeyDescriptor (int index) const
|
||||
{
|
||||
_Tt_client_isam_key_descriptor_ptr descriptor_ptr = (_Tt_client_isam_key_descriptor *)NULL;
|
||||
|
||||
if ((index > -1) && (index < keyDescriptorList->count())) {
|
||||
descriptor_ptr = (*keyDescriptorList) [index];
|
||||
}
|
||||
|
||||
return descriptor_ptr;
|
||||
}
|
||||
|
||||
_Tt_string _Tt_client_isam_record::getKeyPartValue (int index, int part) const
|
||||
{
|
||||
_Tt_string value;
|
||||
|
||||
short key_part_start;
|
||||
short key_part_length;
|
||||
short key_part_type;
|
||||
|
||||
if ((index > -1) && (index < keyDescriptorList->count())) {
|
||||
_Tt_client_isam_key_descriptor_ptr descriptor_ptr = (*keyDescriptorList) [index];
|
||||
|
||||
if ((part > -1) && (part < descriptor_ptr->getNumberOfParts())) {
|
||||
descriptor_ptr->getKeyPart(part,
|
||||
key_part_start,
|
||||
key_part_length,
|
||||
key_part_type);
|
||||
|
||||
_Tt_string key_part(key_part_length);
|
||||
(void)memcpy((char *)key_part,
|
||||
(char *)buffer+key_part_start,
|
||||
key_part_length);
|
||||
value = key_part;
|
||||
}
|
||||
else {
|
||||
_Tt_string null_string((char *)NULL);
|
||||
value = null_string;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_Tt_string null_string((char *)NULL);
|
||||
value = null_string;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
void _Tt_client_isam_record::setKeyPartValue (int index,
|
||||
int part,
|
||||
const _Tt_string &value)
|
||||
{
|
||||
short key_part_start;
|
||||
short key_part_length;
|
||||
short key_part_type;
|
||||
|
||||
if ((index > -1) && (index < keyDescriptorList->count())) {
|
||||
_Tt_client_isam_key_descriptor_ptr descriptor_ptr = (*keyDescriptorList) [index];
|
||||
|
||||
descriptor_ptr->getKeyPart(part,
|
||||
key_part_start,
|
||||
key_part_length,
|
||||
key_part_type);
|
||||
|
||||
int length = ((value.len() < key_part_length) ?
|
||||
value.len() : key_part_length);
|
||||
(void)memcpy((char *)buffer+key_part_start, (char *)value, length);
|
||||
}
|
||||
}
|
||||
|
||||
_Tt_string _Tt_client_isam_record::getBytes (int start, int length) const
|
||||
{
|
||||
if (length < 1) {
|
||||
length = currentLength - start;
|
||||
}
|
||||
|
||||
_Tt_string value(length);
|
||||
(void)memcpy((char *)value, (char *)buffer+start, length);
|
||||
return value;
|
||||
}
|
||||
|
||||
void _Tt_client_isam_record::setBytes (int start, const _Tt_string &value)
|
||||
{
|
||||
(void)memcpy((char *)buffer+start, (char *)value, value.len());
|
||||
}
|
||||
|
||||
void _Tt_client_isam_record::setBytes (int start,
|
||||
int length,
|
||||
const _Tt_string &value)
|
||||
{
|
||||
(void)memcpy((char *)buffer+start, (char *)value, length);
|
||||
}
|
||||
75
cde/lib/tt/lib/db/tt_client_isam_record.h
Normal file
75
cde/lib/tt/lib/db/tt_client_isam_record.h
Normal file
@@ -0,0 +1,75 @@
|
||||
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
|
||||
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
|
||||
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
|
||||
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
|
||||
/*%% $XConsortium: tt_client_isam_record.h /main/3 1995/10/23 10:00:19 rswiston $ */
|
||||
/*
|
||||
* tt_client_isam_record.h - Defines the TT ISAM record class. This class simplifies
|
||||
* putting data in a record. To get an empty record ready
|
||||
* to be filled with data, call the _Tt_client_isam_file::getEmptyRecord.
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#ifndef _TT_CLIENT_ISAM_RECORD_H
|
||||
#define _TT_CLIENT_ISAM_RECORD_H
|
||||
|
||||
#include "util/tt_object.h"
|
||||
#include "util/tt_string.h"
|
||||
#include "db/tt_client_isam_key_descriptor_utils.h"
|
||||
|
||||
class _Tt_client_isam_record : public _Tt_object {
|
||||
public:
|
||||
// Dummy constructor needed to make tt_client_isam_record_utils.cc happy
|
||||
_Tt_client_isam_record () {}
|
||||
|
||||
// Real constructor
|
||||
_Tt_client_isam_record (const _Tt_client_isam_key_descriptor_list_ptr &key_descriptor_list,
|
||||
int max_record_length,
|
||||
int min_record_length);
|
||||
~_Tt_client_isam_record ();
|
||||
|
||||
int getNumberOfKeys () const;
|
||||
_Tt_client_isam_key_descriptor_ptr getKeyDescriptor (int) const;
|
||||
|
||||
_Tt_string getKeyPartValue (int, int) const;
|
||||
void setKeyPartValue (int, int, const _Tt_string&);
|
||||
|
||||
_Tt_string getBytes (int, int) const;
|
||||
void setBytes (int, const _Tt_string&);
|
||||
void setBytes (int, int, const _Tt_string&);
|
||||
|
||||
void setLength (int length)
|
||||
{
|
||||
currentLength = length;
|
||||
}
|
||||
|
||||
int getLength () const
|
||||
{
|
||||
return currentLength;
|
||||
}
|
||||
|
||||
int getMaxLength () const
|
||||
{
|
||||
return maxLength;
|
||||
}
|
||||
|
||||
int getMinLength () const
|
||||
{
|
||||
return minLength;
|
||||
}
|
||||
|
||||
const _Tt_string &getRecord () const
|
||||
{
|
||||
return buffer;
|
||||
}
|
||||
|
||||
private:
|
||||
_Tt_string buffer;
|
||||
_Tt_client_isam_key_descriptor_list_ptr keyDescriptorList;
|
||||
int currentLength;
|
||||
int maxLength;
|
||||
int minLength;
|
||||
};
|
||||
|
||||
#endif /* _TT_CLIENT_ISAM_RECORD_H */
|
||||
15
cde/lib/tt/lib/db/tt_client_isam_record_utils.C
Normal file
15
cde/lib/tt/lib/db/tt_client_isam_record_utils.C
Normal file
@@ -0,0 +1,15 @@
|
||||
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
//%% (c) Copyright 1993, 1994 Novell, Inc.
|
||||
//%% $XConsortium: tt_client_isam_record_utils.C /main/3 1995/10/23 10:00:26 rswiston $
|
||||
/*
|
||||
* tt_client_isam_record_utils.cc - Defines the _Tt_client_isam_record class
|
||||
* utilities.
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#include "db/tt_client_isam_record_utils.h"
|
||||
|
||||
implement_list_of(_Tt_client_isam_record)
|
||||
21
cde/lib/tt/lib/db/tt_client_isam_record_utils.h
Normal file
21
cde/lib/tt/lib/db/tt_client_isam_record_utils.h
Normal file
@@ -0,0 +1,21 @@
|
||||
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
|
||||
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
|
||||
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
|
||||
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
|
||||
/*%% $XConsortium: tt_client_isam_record_utils.h /main/3 1995/10/23 10:00:34 rswiston $ */
|
||||
/*
|
||||
* tt_client_isam_record_utils.h - Declares the _Tt_client_isam_record class
|
||||
* utilities.
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#ifndef _TT_CLIENT_ISAM_RECORD_UTILS_H
|
||||
#define _TT_CLIENT_ISAM_RECORD_UTILS_H
|
||||
|
||||
#include "util/tt_list.h"
|
||||
#include "db/tt_client_isam_record.h"
|
||||
|
||||
declare_list_of(_Tt_client_isam_record)
|
||||
|
||||
#endif // _TT_CLIENT_ISAM_RECORD_UTILS_H
|
||||
30
cde/lib/tt/lib/db/tt_db_access.h
Normal file
30
cde/lib/tt/lib/db/tt_db_access.h
Normal file
@@ -0,0 +1,30 @@
|
||||
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
|
||||
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
|
||||
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
|
||||
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
|
||||
/*%% $XConsortium: tt_db_access.h /main/3 1995/10/23 10:00:40 rswiston $ */
|
||||
/*
|
||||
* tt_db_access.h - Define the TT DB server access class. This class is used
|
||||
* for specifying the access privilege of a particular object
|
||||
* or file in the database.
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#ifndef _TT_DB_ACCESS_H
|
||||
#define _TT_DB_ACCESS_H
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "util/tt_object.h"
|
||||
|
||||
class _Tt_db_access : public _Tt_object {
|
||||
public:
|
||||
_Tt_db_access ();
|
||||
virtual ~_Tt_db_access ();
|
||||
uid_t user;
|
||||
gid_t group;
|
||||
mode_t mode;
|
||||
};
|
||||
|
||||
#endif // _TT_DB_ACCESS_H
|
||||
32
cde/lib/tt/lib/db/tt_db_access_utils.C
Normal file
32
cde/lib/tt/lib/db/tt_db_access_utils.C
Normal file
@@ -0,0 +1,32 @@
|
||||
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
//%% (c) Copyright 1993, 1994 Novell, Inc.
|
||||
//%% $XConsortium: tt_db_access_utils.C /main/3 1995/10/23 10:00:48 rswiston $
|
||||
/* @(#)tt_db_access_utils.C 1.5 @(#)
|
||||
* tt_db_access_utils.cc - Defines the _Tt_db_access utilities.
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#include "db/tt_db_access.h"
|
||||
#include "db/tt_db_access_utils.h"
|
||||
|
||||
implement_ptr_to(_Tt_db_access)
|
||||
|
||||
// Normally, we don't put the constructors in the _utils.cc, but since
|
||||
// tt_db_access.cc doesn\'t exist, it seems a waste to create it just
|
||||
// to hold some null constructors.
|
||||
|
||||
_Tt_db_access::
|
||||
_Tt_db_access()
|
||||
{
|
||||
user = (uid_t)-1;
|
||||
group = (gid_t)-1;
|
||||
mode = (mode_t)-1; // Default: Everyone can read and write it
|
||||
}
|
||||
|
||||
_Tt_db_access::
|
||||
~_Tt_db_access()
|
||||
{
|
||||
}
|
||||
19
cde/lib/tt/lib/db/tt_db_access_utils.h
Normal file
19
cde/lib/tt/lib/db/tt_db_access_utils.h
Normal file
@@ -0,0 +1,19 @@
|
||||
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
|
||||
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
|
||||
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
|
||||
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
|
||||
/*%% $XConsortium: tt_db_access_utils.h /main/3 1995/10/23 10:00:55 rswiston $ */
|
||||
/*
|
||||
* tt_db_access_utils.h - Declares the _Tt_db_access utilities.
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#ifndef _TT_DB_ACCESS_UTILS_H
|
||||
#define _TT_DB_ACCESS_UTILS_H
|
||||
|
||||
class _Tt_db_access;
|
||||
|
||||
declare_ptr_to(_Tt_db_access)
|
||||
|
||||
#endif // _TT_DB_ACCESS_UTILS_H
|
||||
1796
cde/lib/tt/lib/db/tt_db_client.C
Normal file
1796
cde/lib/tt/lib/db/tt_db_client.C
Normal file
File diff suppressed because it is too large
Load Diff
342
cde/lib/tt/lib/db/tt_db_client.h
Normal file
342
cde/lib/tt/lib/db/tt_db_client.h
Normal file
@@ -0,0 +1,342 @@
|
||||
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
|
||||
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
|
||||
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
|
||||
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
|
||||
/*%% $XConsortium: tt_db_client.h /main/3 1995/10/23 10:01:13 rswiston $ */
|
||||
/*
|
||||
* @(#)tt_db_client.h 1.19 95/02/21
|
||||
*
|
||||
* Declare the TT DB client class. This class defines a
|
||||
* client interface to the DB server.
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#ifndef _TT_DB_CLIENT_H
|
||||
#define _TT_DB_CLIENT_H
|
||||
|
||||
// db_server.h requires this definition by the client side code
|
||||
#define _TT_DBCLIENT_SIDE
|
||||
|
||||
#include "mp/mp_message.h"
|
||||
#include "util/tt_object.h"
|
||||
#include "util/tt_string.h"
|
||||
#include "db/tt_db_access_utils.h"
|
||||
#include "db/tt_db_property_utils.h"
|
||||
#include "db/tt_db_property.h"
|
||||
#include "db/tt_db_results.h"
|
||||
|
||||
// ********** Old DB Compatibility Include Files **********
|
||||
#include "db/tt_old_db_results.h"
|
||||
#include "db/tt_client_isam.h"
|
||||
// ********** Old DB Compatibility Include Files **********
|
||||
|
||||
class _Tt_db_client : public _Tt_object {
|
||||
public:
|
||||
// Connects to rpc.ttdbserverd on the specified host. If no hostname
|
||||
// is provided, then the connection is made to the host the process
|
||||
// is running on.
|
||||
_Tt_db_client(_Tt_db_results & status);
|
||||
_Tt_db_client (); // <- Yuck, it does work, we need a status.
|
||||
_Tt_db_client (const _Tt_string &hostname, _Tt_db_results & status);
|
||||
~_Tt_db_client ();
|
||||
|
||||
// Returns the results of the DB connection attempted when this object
|
||||
// is instantiated.
|
||||
_Tt_db_results getConnectionResults () const
|
||||
{
|
||||
return dbConnectionResults;
|
||||
}
|
||||
|
||||
// returns the hostname of the machine this DB object is connected to.
|
||||
_Tt_string getHostname () const
|
||||
{
|
||||
_Tt_string hostname = (char *)dbHostname;
|
||||
return hostname;
|
||||
}
|
||||
|
||||
// Sets and gets the current access mode to be used when reading, writing
|
||||
// and removing data to and from the database. If not used, the default
|
||||
// access is world read and write.
|
||||
void setCurrentAccess (const _Tt_db_access_ptr &access);
|
||||
_Tt_db_access_ptr getCurrentAccess () const;
|
||||
|
||||
// Returns the file partition name that the specified file is in and
|
||||
// the real path of the file on the remote machine. It is assumed that
|
||||
// the file is on the same machine that the DB connection is on.
|
||||
_Tt_db_results getFilePartition (const _Tt_string &path,
|
||||
_Tt_string &partition,
|
||||
_Tt_string &network_path);
|
||||
|
||||
// Creates a file entry in the database. A list of file properties may
|
||||
// be specified along with the file name. The cache level returned
|
||||
// can be used to initialize the cache levels for the types of info
|
||||
// stored for this file.
|
||||
_Tt_db_results createFile (const _Tt_string &file,
|
||||
const _Tt_db_property_list_ptr &properties,
|
||||
const _Tt_db_access_ptr &access,
|
||||
int &cache_level);
|
||||
|
||||
// Creates an object entry in the database. If the file does not already
|
||||
// exist in the database, the file entry is also created. The cache level
|
||||
// returned can be used to initialize the cache levels for the types of info
|
||||
// stored for this object.
|
||||
_Tt_db_results createObject (const _Tt_string &file,
|
||||
const _Tt_string &objid,
|
||||
const _Tt_string &otype,
|
||||
const _Tt_db_property_list_ptr &properties,
|
||||
const _Tt_db_access_ptr &access,
|
||||
int &cache_level);
|
||||
|
||||
// Removes the specified file and all of its objects from the database.
|
||||
_Tt_db_results removeFile (const _Tt_string &file);
|
||||
|
||||
// Removes the specified field from the databse.
|
||||
_Tt_db_results removeObject (const _Tt_string &objid,
|
||||
const _Tt_string &forward_pointer);
|
||||
|
||||
// Moves the specified file and all of its objects to the new file.
|
||||
_Tt_db_results moveFile (const _Tt_string &file,
|
||||
const _Tt_string &new_file);
|
||||
|
||||
// Writes the specified file property to the database. All values of the
|
||||
// the file property with the same name are overwritten. If the value of
|
||||
// the property is NULL, this deletes all properties with the same name
|
||||
// from the database.
|
||||
_Tt_db_results setFileProperty (const _Tt_string &file,
|
||||
const _Tt_db_property_ptr &property,
|
||||
int &cache_level);
|
||||
|
||||
// Writes the specified file properties to the database. All values of
|
||||
// the the file properties with the same names are overwritten. If the
|
||||
// value of some of the properties are NULL, this deletes all properties
|
||||
// with the same name from the database.
|
||||
_Tt_db_results
|
||||
setFileProperties (const _Tt_string &file,
|
||||
const _Tt_db_property_list_ptr &properties,
|
||||
int &cache_level);
|
||||
|
||||
// Adds a file property to the list of values of the file property
|
||||
// with the same name. If the property does not already exist, then
|
||||
// the property is created. If the "unique" argument is TRUE, then
|
||||
// the property name and value combination is guaranteed to be unique
|
||||
// and will not be added to the list of values if the combination already
|
||||
// exists.
|
||||
_Tt_db_results addFileProperty (const _Tt_string &file,
|
||||
const _Tt_db_property_ptr &property,
|
||||
bool_t unique,
|
||||
int &cache_level);
|
||||
|
||||
// Deletes the file property value with the same name and value. If
|
||||
// the value is left empty, then all values of the property are deleted.
|
||||
_Tt_db_results
|
||||
deleteFileProperty (const _Tt_string &file,
|
||||
const _Tt_db_property_ptr &property,
|
||||
int &cache_level);
|
||||
|
||||
// Gets the values of the file property with the specified name.
|
||||
_Tt_db_results getFileProperty (const _Tt_string &file,
|
||||
const _Tt_string &name,
|
||||
int &cache_level,
|
||||
_Tt_db_property_ptr &property);
|
||||
|
||||
// Gets a list of all of the file properties.
|
||||
_Tt_db_results
|
||||
getFileProperties (const _Tt_string &file,
|
||||
int &cache_level,
|
||||
_Tt_db_property_list_ptr &properties);
|
||||
|
||||
// Returns a list of all of the object IDs for the specified file.
|
||||
_Tt_db_results getFileObjects (const _Tt_string &file,
|
||||
int &cache_level,
|
||||
_Tt_string_list_ptr &objids);
|
||||
|
||||
// Sets and gets the access mode of the specified file.
|
||||
_Tt_db_results setFileAccess (const _Tt_string &file,
|
||||
const _Tt_db_access_ptr &access);
|
||||
_Tt_db_results getFileAccess (const _Tt_string &file,
|
||||
_Tt_db_access_ptr &access);
|
||||
|
||||
// Writes the specified object property to the database. All values of the
|
||||
// the object property with the same name are overwritten. If the value of
|
||||
// the property is NULL, this deletes all properties with the same name
|
||||
// from the database. If the cache level in the database is higher then
|
||||
// the cache level passed in, the write is not done and the values of all
|
||||
// properties in the database are returned through the properties argument.
|
||||
// The latest cache level is always returned.
|
||||
_Tt_db_results setObjectProperty (const _Tt_string &objid,
|
||||
const _Tt_db_property_ptr &property,
|
||||
_Tt_db_property_list_ptr &properties,
|
||||
int &cache_level);
|
||||
|
||||
// Writes the specified object properties to the database. All values of
|
||||
// the object properties with the same names are overwritten. If the value
|
||||
// of some of the properties are NULL, this deletes all properties with the
|
||||
// same name from the database. If the cache level in the database is
|
||||
// higher then the cache level passed in, the write is not done and
|
||||
// all of the object properties in the database are returned through the
|
||||
// out_properties argument. The latest cache level is always returned.
|
||||
_Tt_db_results
|
||||
setObjectProperties (const _Tt_string &objid,
|
||||
const _Tt_db_property_list_ptr &in_properties,
|
||||
_Tt_db_property_list_ptr &out_properties,
|
||||
int &cache_level);
|
||||
|
||||
// Adds an object property to the list of values of the object property
|
||||
// with the same name. If the property does not already exist, then
|
||||
// the property is created. If the "unique" argument is TRUE, then
|
||||
// the property name and value combination is guaranteed to be unique
|
||||
// and will not be added to the list of values if the combination already
|
||||
// exists. If the cache level in the database is higher then the cache
|
||||
// level passed in, the write is not done and the values of all the properties
|
||||
// in the database are returned through the properties argument.
|
||||
// The latest cache level is always returned.
|
||||
_Tt_db_results addObjectProperty (const _Tt_string &objid,
|
||||
const _Tt_db_property_ptr &property,
|
||||
bool_t unique,
|
||||
_Tt_db_property_list_ptr &properties,
|
||||
int &cache_level);
|
||||
|
||||
// Deletes the object property values with the same name and values. If
|
||||
// the value list is empty, then all values of the property are deleted.
|
||||
// If the cache level in the database is higher then the cache level passed
|
||||
// in, the write is not done and the values of all the properties
|
||||
// in the database are returned through the properties argument.
|
||||
// The latest cache level is always returned.
|
||||
_Tt_db_results
|
||||
deleteObjectProperty (const _Tt_string &objid,
|
||||
const _Tt_db_property_ptr &property,
|
||||
_Tt_db_property_list_ptr &properties,
|
||||
int &cache_level);
|
||||
|
||||
// Gets the values of the object property with the specified name.
|
||||
_Tt_db_results getObjectProperty (const _Tt_string &objid,
|
||||
const _Tt_string &name,
|
||||
int &cache_level,
|
||||
_Tt_db_property_ptr &property);
|
||||
|
||||
// Gets a list of all of the object properties.
|
||||
_Tt_db_results
|
||||
getObjectProperties (const _Tt_string &objid,
|
||||
int &cache_level,
|
||||
_Tt_db_property_list_ptr &property);
|
||||
|
||||
// Sets and gets the otype of the specified object.
|
||||
_Tt_db_results setObjectType (const _Tt_string &objid,
|
||||
const _Tt_string &otype);
|
||||
_Tt_db_results getObjectType (const _Tt_string &objid,
|
||||
_Tt_string &otype);
|
||||
|
||||
// Sets the file of the object. This should only be used to support
|
||||
// a same partition move of an object.
|
||||
_Tt_db_results setObjectFile (const _Tt_string &objid,
|
||||
const _Tt_string &file);
|
||||
// Gets the file of the object.
|
||||
_Tt_db_results getObjectFile (const _Tt_string &objid,
|
||||
_Tt_string &file);
|
||||
|
||||
// Sets and gets the access mode of the specified object.
|
||||
_Tt_db_results setObjectAccess (const _Tt_string &objid,
|
||||
const _Tt_db_access_ptr &access);
|
||||
_Tt_db_results getObjectAccess (const _Tt_string &objid,
|
||||
_Tt_db_access_ptr &access);
|
||||
|
||||
_Tt_db_results
|
||||
isFileInDatabase (const _Tt_string &file,
|
||||
bool_t &directory_flag);
|
||||
|
||||
_Tt_db_results
|
||||
isObjectInDatabase (const _Tt_string &objid,
|
||||
_Tt_string &forward_pointer);
|
||||
|
||||
// For the specified file, queues the message and the list of ptypes
|
||||
// that the message is addressed to.
|
||||
_Tt_db_results queueMessage (const _Tt_string &file,
|
||||
const _Tt_string_list_ptr &ptypes,
|
||||
const _Tt_message_ptr &message);
|
||||
|
||||
// For the specified file, returns a list of messages that are addressed
|
||||
// to the specified ptypes. If there are no other ptypes that this message
|
||||
// is addressed to, the message is deleteed from the database.
|
||||
_Tt_db_results dequeueMessages (const _Tt_string &file,
|
||||
const _Tt_string_list_ptr &ptypes,
|
||||
_Tt_message_list_ptr &messages);
|
||||
|
||||
// Gets the remote ends' idea of what the netfile version of the specified
|
||||
// file is.
|
||||
_Tt_db_results file_netfile (const _Tt_string &file, _Tt_string &netfile);
|
||||
|
||||
// Gets the remote ends' idea of what the file version of the specified
|
||||
// netfile is.
|
||||
_Tt_db_results netfile_file (const _Tt_string &netfile, _Tt_string &file);
|
||||
|
||||
// Return a list of all of the sessions known to the dbserver.
|
||||
_Tt_string_list * get_all_sessions();
|
||||
|
||||
// Tell the dbserver to perform garbage collection.
|
||||
_Tt_db_results garbage_collect_in_server();
|
||||
|
||||
// Delete the named session.
|
||||
_Tt_db_results delete_session(_Tt_string session);
|
||||
|
||||
// ********** Old DB Server Compatibility Members **********
|
||||
|
||||
// The following members are used to provide compatibility
|
||||
// with old DB servers. All of the member functions map directly
|
||||
// to an old DB server RPC call. The names of these member functions
|
||||
// have been kept the same as the base name of the corresponding
|
||||
// RPC call.
|
||||
_Tt_string mfs (const _Tt_string &path);
|
||||
_Tt_db_results addsession (const _Tt_string &file,
|
||||
const _Tt_string &session);
|
||||
_Tt_db_results delsession (const _Tt_string &file,
|
||||
const _Tt_string &session);
|
||||
_Tt_db_results gettype (const _Tt_string &objid,
|
||||
_Tt_string &type);
|
||||
int isaddindex (int, struct keydesc*);
|
||||
int isbuild (char*, int, struct keydesc*, int);
|
||||
int isclose (int);
|
||||
int iscntl (int, int, char*);
|
||||
int isdelrec (int, long, char*);
|
||||
int iserase (char*);
|
||||
int isopen (char*, int);
|
||||
int isread (int, char*, int);
|
||||
int isrewrec (int, long, char*);
|
||||
int isstart (int, struct keydesc*, int, char*, int);
|
||||
int iswrite (int, char*);
|
||||
|
||||
// Data members used by the old DB server compatibility member
|
||||
// functions.
|
||||
int iserrno;
|
||||
long isrecnum;
|
||||
int isreclen;
|
||||
|
||||
// ********** Old DB Server Compatibility Members **********
|
||||
|
||||
private:
|
||||
_Tt_db_access_ptr dbAccess;
|
||||
int dbAuthLevel;
|
||||
_Tt_db_results dbConnectionResults;
|
||||
_Tt_string dbHostname;
|
||||
CLIENT *dbServer;
|
||||
_Tt_string dbServerNetName;
|
||||
#if !defined(OPT_TLI)
|
||||
sockaddr_in dbSocket;
|
||||
#endif
|
||||
int dbVersion;
|
||||
|
||||
void createAuth ();
|
||||
void setTtDBDefaults ();
|
||||
_Tt_db_results connectToDB (const _Tt_string&);
|
||||
void SetError(enum clnt_stat cf_stat);
|
||||
|
||||
// ********** Old DB Server Compatibility Members **********
|
||||
|
||||
// Helper functions for old DB server function compatibility
|
||||
|
||||
_Tt_db_results oldDBToNewDBResults (_Tt_old_db_results old_db_results);
|
||||
|
||||
// ********** Old DB Server Compatibility Members **********
|
||||
};
|
||||
|
||||
#endif // _TT_DB_H
|
||||
19
cde/lib/tt/lib/db/tt_db_client_consts.h
Normal file
19
cde/lib/tt/lib/db/tt_db_client_consts.h
Normal file
@@ -0,0 +1,19 @@
|
||||
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
|
||||
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
|
||||
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
|
||||
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
|
||||
/*%% $XConsortium: tt_db_client_consts.h /main/3 1995/10/23 10:01:21 rswiston $ */
|
||||
/*
|
||||
* tt_db_client_consts.h - Declares constants that are used by the
|
||||
* client-side DB server classes.
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _TT_DB_CLIENT_CONSTS_H
|
||||
#define _TT_DB_CLIENT_CONSTS_H
|
||||
|
||||
#define TT_DB_SESSION_PROPERTY "_TT_SESSIONS"
|
||||
|
||||
#endif /* _TT_DB_CLIENT_CONSTS_H */
|
||||
15
cde/lib/tt/lib/db/tt_db_client_utils.C
Normal file
15
cde/lib/tt/lib/db/tt_db_client_utils.C
Normal file
@@ -0,0 +1,15 @@
|
||||
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
//%% (c) Copyright 1993, 1994 Novell, Inc.
|
||||
//%% $XConsortium: tt_db_client_utils.C /main/3 1995/10/23 10:01:30 rswiston $
|
||||
/*
|
||||
* tt_db_client_utils.cc - Defines the _Tt_db utilities.
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#include "db/tt_db_client_utils.h"
|
||||
|
||||
implement_list_of(_Tt_db_client)
|
||||
implement_table_of(_Tt_db_client)
|
||||
21
cde/lib/tt/lib/db/tt_db_client_utils.h
Normal file
21
cde/lib/tt/lib/db/tt_db_client_utils.h
Normal file
@@ -0,0 +1,21 @@
|
||||
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
|
||||
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
|
||||
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
|
||||
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
|
||||
/*%% $XConsortium: tt_db_client_utils.h /main/3 1995/10/23 10:01:38 rswiston $ */
|
||||
/*
|
||||
* tt_db_utils.h - Declare the _Tt_db utilities.
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#ifndef _TT_DB_CLIENT_UTILS_H
|
||||
#define _TT_DB_CLIENT_UTILS_H
|
||||
|
||||
#include "util/tt_table.h"
|
||||
#include "db/tt_db_client.h"
|
||||
|
||||
declare_list_of(_Tt_db_client)
|
||||
declare_table_of(_Tt_db_client)
|
||||
|
||||
#endif // _TT_DB_CLIENT_UTILS_H
|
||||
24
cde/lib/tt/lib/db/tt_db_create_objid.C
Normal file
24
cde/lib/tt/lib/db/tt_db_create_objid.C
Normal file
@@ -0,0 +1,24 @@
|
||||
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
//%% (c) Copyright 1993, 1994 Novell, Inc.
|
||||
//%% $XConsortium: tt_db_create_objid.C /main/3 1995/10/23 10:01:45 rswiston $
|
||||
/*
|
||||
* tt_db_create_objid.cc - Defines a routine for constructing an objid.
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#include "db/tt_db_create_objid.h"
|
||||
|
||||
_Tt_string _tt_db_create_objid (const _Tt_db_key_ptr &object_key,
|
||||
const _Tt_string &file_system_type,
|
||||
const _Tt_string &hostname,
|
||||
const _Tt_string &partition)
|
||||
{
|
||||
_Tt_string objid = object_key->string();
|
||||
objid = objid.cat(":").cat(file_system_type);
|
||||
objid = objid.cat(":").cat(hostname);
|
||||
objid = objid.cat(":").cat(partition);
|
||||
return objid;
|
||||
}
|
||||
18
cde/lib/tt/lib/db/tt_db_create_objid.h
Normal file
18
cde/lib/tt/lib/db/tt_db_create_objid.h
Normal file
@@ -0,0 +1,18 @@
|
||||
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
|
||||
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
|
||||
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
|
||||
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
|
||||
/*%% $XConsortium: tt_db_create_objid.h /main/3 1995/10/23 10:01:52 rswiston $ */
|
||||
/*
|
||||
* tt_db_create_objid.h - Defines a routine for constructing an objid.
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#include "util/tt_string.h"
|
||||
#include "db/tt_db_key_utils.h"
|
||||
|
||||
extern _Tt_string _tt_db_create_objid (const _Tt_db_key_ptr&,
|
||||
const _Tt_string&,
|
||||
const _Tt_string&,
|
||||
const _Tt_string&);
|
||||
629
cde/lib/tt/lib/db/tt_db_file.C
Normal file
629
cde/lib/tt/lib/db/tt_db_file.C
Normal file
@@ -0,0 +1,629 @@
|
||||
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
//%% (c) Copyright 1993, 1994 Novell, Inc.
|
||||
//%% $XConsortium: tt_db_file.C /main/3 1995/10/23 10:01:59 rswiston $
|
||||
/*
|
||||
* tt_db_file.cc - Implement the TT DB server file class.
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*
|
||||
* NOTE: Caching is not implemented. Therefore all of the cache levels
|
||||
* are always set to -1 to force a full read from the database.
|
||||
*/
|
||||
|
||||
#include "util/tt_path.h"
|
||||
#include "db/tt_db_client_consts.h"
|
||||
#include "db/tt_db_file_utils.h"
|
||||
#include "db/tt_db_network_path.h"
|
||||
#include "db/tt_db_object_utils.h"
|
||||
#include "db/tt_db_access.h"
|
||||
#include "db/tt_db_property.h"
|
||||
|
||||
_Tt_db_file::
|
||||
_Tt_db_file()
|
||||
{
|
||||
}
|
||||
|
||||
_Tt_db_file::_Tt_db_file (const _Tt_string &file)
|
||||
{
|
||||
if (!file.len()) {
|
||||
dbResults = TT_DB_ERR_ILLEGAL_FILE;
|
||||
}
|
||||
else {
|
||||
_Tt_db_property_list_ptr properties;
|
||||
_Tt_db_access_ptr access;
|
||||
dbResults = setTtDBFileDefaults(file, properties, access);
|
||||
}
|
||||
}
|
||||
|
||||
_Tt_db_file::_Tt_db_file (const _Tt_string &file,
|
||||
const _Tt_db_property_list_ptr &properties,
|
||||
const _Tt_db_access_ptr &access)
|
||||
{
|
||||
if (!file.len()) {
|
||||
dbResults = TT_DB_ERR_ILLEGAL_FILE;
|
||||
}
|
||||
else {
|
||||
dbResults = setTtDBFileDefaults(file, properties, access);
|
||||
}
|
||||
}
|
||||
|
||||
_Tt_db_results
|
||||
_Tt_db_file::setTtDBFileDefaults (const _Tt_string &file,
|
||||
const _Tt_db_property_list_ptr &properties,
|
||||
const _Tt_db_access_ptr &access)
|
||||
{
|
||||
checkedDatabase = FALSE;
|
||||
directoryFlag = FALSE;
|
||||
dbFileCurrentAccess = new _Tt_db_access;
|
||||
dbFileObjects = new _Tt_string_list;
|
||||
dbFileObjectsCacheLevel = -1;
|
||||
dbFilePropertiesCacheLevel = -1;
|
||||
dbFilePtypes = new _Tt_string_list;
|
||||
dbResults = TT_DB_OK;
|
||||
|
||||
if (access.is_null()) {
|
||||
dbFileAccess = new _Tt_db_access;
|
||||
}
|
||||
else {
|
||||
dbFileAccess = access;
|
||||
}
|
||||
|
||||
if (properties.is_null()) {
|
||||
dbFileProperties = new _Tt_db_property_list;
|
||||
}
|
||||
else {
|
||||
dbFileProperties = properties;
|
||||
}
|
||||
|
||||
if (file.len()) {
|
||||
_Tt_string local_path;
|
||||
|
||||
if (_tt_is_network_path(file)) {
|
||||
dbFile = _tt_network_path_to_local_path(file);
|
||||
dbFileNetworkPath = file;
|
||||
(void)dbFileNetworkPath.split(':', dbFileHostname);
|
||||
}
|
||||
else {
|
||||
// Get the absoulte network information for the path
|
||||
_Tt_string temp_string;
|
||||
dbResults = _tt_db_network_path (file,
|
||||
dbFile,
|
||||
dbFileHostname,
|
||||
dbFilePartition,
|
||||
dbFileNetworkPath);
|
||||
}
|
||||
|
||||
if ((dbResults == TT_DB_OK)) {
|
||||
if (!isFileInDatabase()) {
|
||||
if (dbResults != TT_DB_ERR_DB_OPEN_FAILED) {
|
||||
dbResults = createDBFile();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return dbResults;
|
||||
}
|
||||
|
||||
_Tt_db_file::~_Tt_db_file ()
|
||||
{
|
||||
}
|
||||
|
||||
void _Tt_db_file::setCurrentAccess (const _Tt_db_access_ptr &access)
|
||||
{
|
||||
dbFileCurrentAccess = access;
|
||||
}
|
||||
|
||||
_Tt_db_access_ptr _Tt_db_file::getCurrentAccess () const
|
||||
{
|
||||
return dbFileCurrentAccess;
|
||||
}
|
||||
|
||||
_Tt_db_results _Tt_db_file::remove ()
|
||||
{
|
||||
if (dbFileNetworkPath.len()) {
|
||||
setCurrentDBAccess ();
|
||||
dbResults = dbFileDatabase->removeFile(dbFileNetworkPath);
|
||||
|
||||
if (dbResults == TT_DB_OK) {
|
||||
dbFile = (char *)NULL;
|
||||
dbFileNetworkPath = (char *)NULL;
|
||||
dbFileProperties = (_Tt_db_property_list *)NULL;
|
||||
dbFileAccess = (_Tt_db_access *)NULL;
|
||||
}
|
||||
}
|
||||
else {
|
||||
dbResults = TT_DB_ERR_ILLEGAL_FILE;
|
||||
}
|
||||
|
||||
return processDBResults();
|
||||
}
|
||||
|
||||
_Tt_db_results _Tt_db_file::copy (const _Tt_string &new_file)
|
||||
{
|
||||
if (!new_file.len()) {
|
||||
return (dbResults = TT_DB_ERR_ILLEGAL_FILE);
|
||||
}
|
||||
|
||||
if (isFileInDatabase()) {
|
||||
_Tt_string new_local_path;
|
||||
_Tt_string new_hostname;
|
||||
_Tt_string new_partition;
|
||||
_Tt_string new_network_path;
|
||||
dbResults = _tt_db_network_path(new_file,
|
||||
new_local_path,
|
||||
new_hostname,
|
||||
new_partition,
|
||||
new_network_path);
|
||||
|
||||
if (dbResults == TT_DB_OK) {
|
||||
// If we're not copying to the exact same file
|
||||
if (dbFileNetworkPath != new_network_path) {
|
||||
setCurrentDBAccess();
|
||||
_Tt_db_property_list_ptr properties = getProperties();
|
||||
_Tt_db_access_ptr access = getAccess ();
|
||||
_Tt_string_list_ptr objids = getObjects();
|
||||
|
||||
if (dbResults == TT_DB_OK) {
|
||||
_Tt_db_file_ptr new_db_file = new _Tt_db_file(new_network_path,
|
||||
properties,
|
||||
access);
|
||||
|
||||
_Tt_string_list_cursor objids_cursor(objids);
|
||||
while (objids_cursor.next()) {
|
||||
_Tt_db_object_ptr object = new _Tt_db_object(*objids_cursor);
|
||||
(void)object->copy(new_file);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
dbResults = TT_DB_ERR_SAME_FILE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
dbResults = TT_DB_ERR_ILLEGAL_FILE;
|
||||
}
|
||||
|
||||
return dbResults;
|
||||
}
|
||||
|
||||
_Tt_db_results _Tt_db_file::move (const _Tt_string &new_file)
|
||||
{
|
||||
if (!new_file.len()) {
|
||||
return (dbResults = TT_DB_ERR_ILLEGAL_FILE);
|
||||
}
|
||||
|
||||
if (isFileInDatabase()) {
|
||||
// Get the hostname and remote path of the new file
|
||||
_Tt_string new_local_path;
|
||||
_Tt_string new_hostname;
|
||||
_Tt_string new_partition;
|
||||
_Tt_string new_network_path;
|
||||
dbResults = _tt_db_network_path(new_file,
|
||||
new_local_path,
|
||||
new_hostname,
|
||||
new_partition,
|
||||
new_network_path);
|
||||
|
||||
if (dbResults == TT_DB_OK) {
|
||||
// If we're not moving to the exact same file
|
||||
if (dbFileNetworkPath != new_network_path) {
|
||||
setCurrentDBAccess();
|
||||
|
||||
if (dbResults == TT_DB_OK) {
|
||||
// If is the new file is on the same machine...
|
||||
if (dbFileHostname == new_hostname) {
|
||||
// We're not allowed to move directories across partitions
|
||||
if (directoryFlag && (dbFilePartition != new_partition)) {
|
||||
dbResults = TT_DB_ERR_ILLEGAL_FILE;
|
||||
}
|
||||
else {
|
||||
dbResults = dbFileDatabase->moveFile(dbFileNetworkPath,
|
||||
new_network_path);
|
||||
|
||||
if (dbResults == TT_DB_OK) {
|
||||
// Change the official file of this object
|
||||
_Tt_db_property_list_ptr properties;
|
||||
_Tt_db_access_ptr access;
|
||||
dbResults = setTtDBFileDefaults(new_network_path,
|
||||
properties,
|
||||
access);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Else, the move is between different hosts...
|
||||
else {
|
||||
// We're not allowed to move directories across machines
|
||||
if (directoryFlag) {
|
||||
dbResults = TT_DB_ERR_ILLEGAL_FILE;
|
||||
}
|
||||
// Not a directory, move it...
|
||||
else {
|
||||
_Tt_db_property_list_ptr properties = getProperties();
|
||||
_Tt_db_access_ptr access = getAccess ();
|
||||
_Tt_string_list_ptr objids = getObjects();
|
||||
|
||||
if (dbResults == TT_DB_OK) {
|
||||
_Tt_db_file_ptr new_db_file = new _Tt_db_file(new_network_path,
|
||||
properties,
|
||||
access);
|
||||
|
||||
_Tt_string_list_cursor objids_cursor(objids);
|
||||
while (objids_cursor.next()) {
|
||||
_Tt_db_object_ptr object = new _Tt_db_object(*objids_cursor);
|
||||
(void)object->move(new_network_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (dbResults == TT_DB_OK) {
|
||||
dbResults = dbFileDatabase->removeFile(dbFileNetworkPath);
|
||||
}
|
||||
|
||||
if (dbResults == TT_DB_OK) {
|
||||
// Change the official file of this object
|
||||
_Tt_db_property_list_ptr properties;
|
||||
_Tt_db_access_ptr access;
|
||||
dbResults = setTtDBFileDefaults(new_network_path,
|
||||
properties,
|
||||
access);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
dbResults = TT_DB_ERR_SAME_FILE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
dbResults = TT_DB_ERR_ILLEGAL_FILE;
|
||||
}
|
||||
|
||||
return dbResults;
|
||||
}
|
||||
|
||||
_Tt_string _Tt_db_file::getHostname ()
|
||||
{
|
||||
return dbFileHostname;
|
||||
}
|
||||
|
||||
_Tt_db_results
|
||||
_Tt_db_file::setProperty (const _Tt_db_property_ptr &property)
|
||||
{
|
||||
if (isFileInDatabase()) {
|
||||
setCurrentDBAccess();
|
||||
dbResults = dbFileDatabase->setFileProperty(dbFileNetworkPath,
|
||||
property,
|
||||
dbFilePropertiesCacheLevel);
|
||||
}
|
||||
else {
|
||||
dbResults = TT_DB_ERR_ILLEGAL_FILE;
|
||||
}
|
||||
|
||||
return processDBResults();
|
||||
}
|
||||
|
||||
_Tt_db_results
|
||||
_Tt_db_file::setProperties (const _Tt_db_property_list_ptr &properties)
|
||||
{
|
||||
if (isFileInDatabase()) {
|
||||
setCurrentDBAccess();
|
||||
dbResults =
|
||||
dbFileDatabase->setFileProperties(dbFileNetworkPath,
|
||||
properties,
|
||||
dbFilePropertiesCacheLevel);
|
||||
}
|
||||
else {
|
||||
dbResults = TT_DB_ERR_ILLEGAL_FILE;
|
||||
}
|
||||
|
||||
return processDBResults();
|
||||
}
|
||||
|
||||
_Tt_db_results
|
||||
_Tt_db_file::addProperty (const _Tt_db_property_ptr &property,
|
||||
bool_t unique)
|
||||
{
|
||||
if (isFileInDatabase()) {
|
||||
setCurrentDBAccess();
|
||||
dbResults = dbFileDatabase->addFileProperty(dbFileNetworkPath,
|
||||
property,
|
||||
unique,
|
||||
dbFilePropertiesCacheLevel);
|
||||
}
|
||||
else {
|
||||
dbResults = TT_DB_ERR_ILLEGAL_FILE;
|
||||
}
|
||||
|
||||
return processDBResults();
|
||||
}
|
||||
|
||||
_Tt_db_results
|
||||
_Tt_db_file::deleteProperty (const _Tt_db_property_ptr &property)
|
||||
{
|
||||
if (isFileInDatabase()) {
|
||||
setCurrentDBAccess();
|
||||
dbResults =
|
||||
dbFileDatabase->deleteFileProperty(dbFileNetworkPath,
|
||||
property,
|
||||
dbFilePropertiesCacheLevel);
|
||||
}
|
||||
else {
|
||||
dbResults = TT_DB_ERR_ILLEGAL_FILE;
|
||||
}
|
||||
|
||||
return processDBResults();
|
||||
}
|
||||
|
||||
_Tt_db_property_ptr _Tt_db_file::getProperty (const _Tt_string &name)
|
||||
{
|
||||
_Tt_db_property_ptr property;
|
||||
|
||||
if (isFileInDatabase()) {
|
||||
setCurrentDBAccess();
|
||||
dbFilePropertiesCacheLevel = -1;
|
||||
dbResults = dbFileDatabase->getFileProperty(dbFileNetworkPath,
|
||||
name,
|
||||
dbFilePropertiesCacheLevel,
|
||||
property);
|
||||
}
|
||||
else {
|
||||
dbResults = TT_DB_ERR_ILLEGAL_FILE;
|
||||
}
|
||||
|
||||
dbResults = processDBResults();
|
||||
return property;
|
||||
}
|
||||
|
||||
_Tt_db_property_list_ptr _Tt_db_file::getProperties ()
|
||||
{
|
||||
_Tt_db_property_list_ptr properties;
|
||||
|
||||
if (isFileInDatabase()) {
|
||||
setCurrentDBAccess();
|
||||
dbFilePropertiesCacheLevel = -1;
|
||||
dbResults = dbFileDatabase->getFileProperties(dbFileNetworkPath,
|
||||
dbFilePropertiesCacheLevel,
|
||||
properties);
|
||||
}
|
||||
else {
|
||||
dbResults = TT_DB_ERR_ILLEGAL_FILE;
|
||||
}
|
||||
|
||||
dbResults = processDBResults();
|
||||
return properties;
|
||||
}
|
||||
|
||||
_Tt_string_list_ptr _Tt_db_file::getObjects ()
|
||||
{
|
||||
_Tt_string_list_ptr objids;
|
||||
|
||||
if (isFileInDatabase()) {
|
||||
setCurrentDBAccess();
|
||||
dbFileObjectsCacheLevel = -1;
|
||||
dbResults = dbFileDatabase->getFileObjects(dbFileNetworkPath,
|
||||
dbFileObjectsCacheLevel,
|
||||
objids);
|
||||
}
|
||||
else {
|
||||
dbResults = TT_DB_ERR_ILLEGAL_FILE;
|
||||
}
|
||||
|
||||
dbResults = processDBResults();
|
||||
return objids;
|
||||
}
|
||||
|
||||
_Tt_db_results _Tt_db_file::setAccess (const _Tt_db_access_ptr &access)
|
||||
{
|
||||
if (isFileInDatabase()) {
|
||||
setCurrentDBAccess();
|
||||
dbResults = dbFileDatabase->setFileAccess(dbFileNetworkPath, access);
|
||||
}
|
||||
else {
|
||||
dbResults = TT_DB_ERR_ILLEGAL_FILE;
|
||||
}
|
||||
|
||||
return processDBResults();
|
||||
}
|
||||
|
||||
_Tt_db_access_ptr _Tt_db_file::getAccess ()
|
||||
{
|
||||
_Tt_db_access_ptr access;
|
||||
|
||||
if (isFileInDatabase()) {
|
||||
setCurrentDBAccess();
|
||||
dbResults = dbFileDatabase->getFileAccess(dbFileNetworkPath, access);
|
||||
}
|
||||
else {
|
||||
dbResults = TT_DB_ERR_ILLEGAL_FILE;
|
||||
}
|
||||
|
||||
dbResults = processDBResults();
|
||||
return access;
|
||||
}
|
||||
|
||||
_Tt_db_results _Tt_db_file::addSession (const _Tt_string &session)
|
||||
{
|
||||
_Tt_db_property_ptr property = new _Tt_db_property;
|
||||
property->name = TT_DB_SESSION_PROPERTY;
|
||||
|
||||
_Tt_string value = session;
|
||||
(void)property->values->append(value);
|
||||
|
||||
return addProperty(property, TRUE);
|
||||
}
|
||||
|
||||
_Tt_db_results _Tt_db_file::deleteSession (const _Tt_string &session)
|
||||
{
|
||||
_Tt_db_property_ptr property = new _Tt_db_property;
|
||||
property->name = TT_DB_SESSION_PROPERTY;
|
||||
|
||||
_Tt_string value = session;
|
||||
property->values->append(value);
|
||||
|
||||
return deleteProperty(property);
|
||||
}
|
||||
|
||||
_Tt_string_list_ptr _Tt_db_file::getSessions ()
|
||||
{
|
||||
_Tt_db_property_ptr property;
|
||||
_Tt_string_list_ptr sessions;
|
||||
|
||||
if (isFileInDatabase()) {
|
||||
_Tt_string name(TT_DB_SESSION_PROPERTY);
|
||||
property = getProperty(name);
|
||||
if (dbResults == TT_DB_ERR_NO_SUCH_PROPERTY) {
|
||||
dbResults = TT_DB_OK;
|
||||
}
|
||||
|
||||
if (!property.is_null()) {
|
||||
if (!property->is_empty()) {
|
||||
sessions = new _Tt_string_list;
|
||||
|
||||
_Tt_string_list_cursor values_cursor(property->values);
|
||||
while (values_cursor.next()) {
|
||||
sessions->append(*values_cursor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return sessions;
|
||||
}
|
||||
|
||||
_Tt_db_results
|
||||
_Tt_db_file::queueMessage (const _Tt_string_list_ptr &ptypes,
|
||||
const _Tt_message_ptr &message)
|
||||
{
|
||||
if (isFileInDatabase()) {
|
||||
dbResults = dbFileDatabase->queueMessage(dbFileNetworkPath,
|
||||
ptypes,
|
||||
message);
|
||||
}
|
||||
else {
|
||||
dbResults = TT_DB_ERR_ILLEGAL_FILE;
|
||||
}
|
||||
|
||||
return dbResults;
|
||||
}
|
||||
|
||||
_Tt_db_results
|
||||
_Tt_db_file::dequeueMessages (const _Tt_string_list_ptr &ptypes,
|
||||
_Tt_message_list_ptr &messages)
|
||||
{
|
||||
if (isFileInDatabase()) {
|
||||
dbResults = dbFileDatabase->dequeueMessages(dbFileNetworkPath,
|
||||
ptypes,
|
||||
messages);
|
||||
}
|
||||
else {
|
||||
dbResults = TT_DB_ERR_ILLEGAL_FILE;
|
||||
}
|
||||
|
||||
return dbResults;
|
||||
}
|
||||
|
||||
_Tt_string _Tt_db_file::getNetworkPath (const _Tt_string &file)
|
||||
{
|
||||
_Tt_string network_path;
|
||||
|
||||
if (file.len()) {
|
||||
if (_tt_is_network_path(file)) {
|
||||
network_path = file;
|
||||
}
|
||||
else {
|
||||
_Tt_string local_path;
|
||||
_Tt_string hostname;
|
||||
_Tt_string partition;
|
||||
|
||||
_Tt_db_results results = _tt_db_network_path(file,
|
||||
local_path,
|
||||
hostname,
|
||||
partition,
|
||||
network_path);
|
||||
}
|
||||
}
|
||||
|
||||
return network_path;
|
||||
}
|
||||
|
||||
_Tt_db_results _Tt_db_file::createDBFile ()
|
||||
{
|
||||
if (!isFileInDatabase()) {
|
||||
dbFileDatabase = dbHostnameGlobalMapRef.getDB(dbFileHostname,
|
||||
dbFileHostname,
|
||||
dbResults);
|
||||
if (dbFileDatabase.is_null()) {
|
||||
return dbResults;
|
||||
}
|
||||
|
||||
int cache_level = -1;
|
||||
|
||||
setCurrentDBAccess ();
|
||||
dbResults = dbFileDatabase->createFile(dbFileNetworkPath,
|
||||
dbFileProperties,
|
||||
dbFileAccess,
|
||||
cache_level);
|
||||
|
||||
dbFileObjectsCacheLevel = cache_level;
|
||||
dbFilePropertiesCacheLevel = cache_level;
|
||||
}
|
||||
else {
|
||||
dbResults = TT_DB_ERR_FILE_EXISTS;
|
||||
}
|
||||
|
||||
return processDBResults();
|
||||
}
|
||||
|
||||
bool_t _Tt_db_file::isFileInDatabase ()
|
||||
{
|
||||
// Property caching is not currently implemented in _Tt_db_file,
|
||||
// so this function does not read the properties from the database
|
||||
// if the file exists. If caching is added, this is where the
|
||||
// cache should be initially filled from.
|
||||
|
||||
if (!checkedDatabase) {
|
||||
checkedDatabase = TRUE;
|
||||
|
||||
dbFileDatabase = dbHostnameGlobalMapRef.getDB(dbFileHostname,
|
||||
dbFileHostname,
|
||||
dbResults);
|
||||
if (dbFileDatabase.is_null() || dbResults != TT_DB_OK) {
|
||||
return FALSE;
|
||||
}
|
||||
_Tt_db_access_ptr access;
|
||||
dbResults = dbFileDatabase->isFileInDatabase(dbFileNetworkPath,
|
||||
directoryFlag);
|
||||
|
||||
if (dbResults != TT_DB_OK) {
|
||||
dbHostnameGlobalMapRef.removeDB(dbFileHostname);
|
||||
dbFileDatabase = (_Tt_db_client *)NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return (dbFileDatabase.is_null() ? FALSE : TRUE);
|
||||
}
|
||||
|
||||
_Tt_db_results _Tt_db_file::processDBResults ()
|
||||
{
|
||||
// If an RPC fails, assume the DB server went down and attempt to
|
||||
// reconnect to it
|
||||
if ((dbResults == TT_DB_ERR_DB_CONNECTION_FAILED) ||
|
||||
(dbResults == TT_DB_ERR_RPC_CONNECTION_FAILED) ||
|
||||
(dbResults == TT_DB_ERR_RPC_FAILED) ||
|
||||
(dbResults == TT_DB_ERR_DB_OPEN_FAILED)) {
|
||||
if (!dbFileDatabase.is_null()) {
|
||||
dbHostnameGlobalMapRef.removeDB(dbFileHostname);
|
||||
dbFileDatabase = dbHostnameGlobalMapRef.getDB(dbFileHostname,
|
||||
dbFileHostname,
|
||||
dbResults);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return dbResults;
|
||||
}
|
||||
193
cde/lib/tt/lib/db/tt_db_file.h
Normal file
193
cde/lib/tt/lib/db/tt_db_file.h
Normal file
@@ -0,0 +1,193 @@
|
||||
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
|
||||
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
|
||||
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
|
||||
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
|
||||
/*%% $XConsortium: tt_db_file.h /main/3 1995/10/23 10:02:07 rswiston $ */
|
||||
/*
|
||||
* tt_db_file.h - Declare the TT DB server file class. This class defines the
|
||||
* file properties interface to the DB server.
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#ifndef _TT_DB_FILE_H
|
||||
#define _TT_DB_FILE_H
|
||||
|
||||
#include "util/tt_object.h"
|
||||
#include "util/tt_string.h"
|
||||
#include "db/tt_db_hostname_global_map_ref.h"
|
||||
#include "db/tt_db_access_utils.h"
|
||||
#include "db/tt_db_property_utils.h"
|
||||
#if defined(OPT_BUG_HPUX) || defined(OPT_BUG_AIX) || defined(__osf__)
|
||||
# undef copy
|
||||
#endif
|
||||
|
||||
class _Tt_db_file : public _Tt_object {
|
||||
public:
|
||||
_Tt_db_file ();
|
||||
|
||||
// If the file already exists in the DB on its partition, then
|
||||
// the DB is connected to when it needs to be. If the file
|
||||
// does not exist on the database, the file entry is created
|
||||
// on the database.
|
||||
_Tt_db_file (const _Tt_string &file);
|
||||
_Tt_db_file (const _Tt_string &file,
|
||||
const _Tt_db_property_list_ptr &properties,
|
||||
const _Tt_db_access_ptr &access);
|
||||
~_Tt_db_file ();
|
||||
|
||||
// Sets and gets the access mode of this file.
|
||||
void setCurrentAccess (const _Tt_db_access_ptr &access);
|
||||
_Tt_db_access_ptr getCurrentAccess () const;
|
||||
|
||||
// Removes the file and all of its objects from the database. Once this is
|
||||
// called this particular object instantiation is useless until "setFile" has
|
||||
// been called.
|
||||
_Tt_db_results remove ();
|
||||
|
||||
// Copies the file to the new file name
|
||||
_Tt_db_results copy (const _Tt_string &new_file);
|
||||
|
||||
// Moves the file to the new file name
|
||||
_Tt_db_results move (const _Tt_string &new_file);
|
||||
|
||||
// Gets the local path of the file. Regardless of what path was specified
|
||||
// in the object constructor, getLocalPath always returns the real path
|
||||
// (the result of _tt_realpath).
|
||||
const _Tt_string& getLocalPath () const
|
||||
{
|
||||
return dbFile;
|
||||
}
|
||||
|
||||
// Gets the network absolute path of the file. The path is in the
|
||||
// form:
|
||||
//
|
||||
// hostname:/path
|
||||
//
|
||||
const _Tt_string& getNetworkPath () const
|
||||
{
|
||||
return dbFileNetworkPath;
|
||||
}
|
||||
|
||||
// Gets the network absolute path of the file argument. The path
|
||||
// is in the form:
|
||||
//
|
||||
// hostname:/path
|
||||
//
|
||||
static _Tt_string getNetworkPath (const _Tt_string &file);
|
||||
|
||||
// Returns the hostname of the machine the file is located on.
|
||||
_Tt_string getHostname ();
|
||||
|
||||
// Writes the specified file property to the database. All values of the
|
||||
// the file property with the same name are overwritten. If the value of
|
||||
// the property is NULL, this deletes all properties with the same name
|
||||
// from the database.
|
||||
_Tt_db_results setProperty (const _Tt_db_property_ptr &property);
|
||||
|
||||
// Writes the specified file properties to the database. All values of the
|
||||
// the file properties with the same names are overwritten. If the value of
|
||||
// some of the properties are NULL, this deletes all properties with the same
|
||||
// name from the database.
|
||||
_Tt_db_results setProperties (const _Tt_db_property_list_ptr &properties);
|
||||
|
||||
// Adds a file property to the list of values of the file property
|
||||
// with the same name. If the property does not already exist, then
|
||||
// the property is created. If the "unique" argument is TRUE, then
|
||||
// the property name and value combination is guaranteed to be unique
|
||||
// and will not be added to the list of values if the combination already
|
||||
// exists.
|
||||
_Tt_db_results addProperty (const _Tt_db_property_ptr &property,
|
||||
bool_t unique=FALSE);
|
||||
|
||||
// Deletes the file property value with the same name and value. If
|
||||
// the value is left empty, then all values of the property are deleted.
|
||||
_Tt_db_results deleteProperty (const _Tt_db_property_ptr &property);
|
||||
|
||||
// Gets the values of the file property with the specified name.
|
||||
_Tt_db_property_ptr getProperty (const _Tt_string &name);
|
||||
|
||||
// Gets a list of all of the file properties.
|
||||
_Tt_db_property_list_ptr getProperties ();
|
||||
|
||||
// Returns a list of all of the object IDs for the specified file.
|
||||
_Tt_string_list_ptr getObjects ();
|
||||
|
||||
// Sets and gets the access mode of the specified file.
|
||||
_Tt_db_results setAccess (const _Tt_db_access_ptr &access);
|
||||
_Tt_db_access_ptr getAccess ();
|
||||
|
||||
// Add a session to the file
|
||||
_Tt_db_results addSession (const _Tt_string &session);
|
||||
|
||||
// Delete a session from the file
|
||||
_Tt_db_results deleteSession (const _Tt_string &session);
|
||||
|
||||
// Get a list of sessions that have joined this file
|
||||
_Tt_string_list_ptr getSessions ();
|
||||
|
||||
// For this file, queues the message and the list of ptypes
|
||||
// that the message is addressed to.
|
||||
_Tt_db_results queueMessage (const _Tt_string_list_ptr &ptypes,
|
||||
const _Tt_message_ptr &message);
|
||||
|
||||
// For this file, returns a list of messages that are addressed
|
||||
// the specified ptypes. If there are no other ptypes that this message
|
||||
// is addressed to, the message is deleted from the database.
|
||||
_Tt_db_results dequeueMessages (const _Tt_string_list_ptr &ptypes,
|
||||
_Tt_message_list_ptr &messages);
|
||||
|
||||
// Gets the results of the last database operation made with this object.
|
||||
_Tt_db_results getDBResults () const
|
||||
{
|
||||
return dbResults;
|
||||
}
|
||||
|
||||
private:
|
||||
bool_t checkedDatabase;
|
||||
bool_t directoryFlag;
|
||||
_Tt_string dbFile;
|
||||
_Tt_db_access_ptr dbFileAccess;
|
||||
_Tt_db_access_ptr dbFileCurrentAccess;
|
||||
_Tt_db_client_ptr dbFileDatabase;
|
||||
_Tt_string dbFileHostname;
|
||||
_Tt_string dbFileNetworkPath;
|
||||
_Tt_string_list_ptr dbFileObjects;
|
||||
int dbFileObjectsCacheLevel;
|
||||
_Tt_string dbFilePartition;
|
||||
_Tt_db_property_list_ptr dbFileProperties;
|
||||
int dbFilePropertiesCacheLevel;
|
||||
_Tt_string_list_ptr dbFilePtypes;
|
||||
_Tt_db_hostname_global_map_ref dbHostnameGlobalMapRef;
|
||||
_Tt_db_results dbResults;
|
||||
|
||||
// Sets the file in the database that the object is operating on.
|
||||
// If the file already exists in the DB on its partition, then
|
||||
// the DB is connected to when it needs to be. If the file
|
||||
// does not exist on the database, the file entry is created
|
||||
// on the database.
|
||||
_Tt_db_results setTtDBFileDefaults (const _Tt_string&,
|
||||
const _Tt_db_property_list_ptr&,
|
||||
const _Tt_db_access_ptr&);
|
||||
|
||||
_Tt_db_results createDBFile ();
|
||||
bool_t isFileInDatabase ();
|
||||
|
||||
//
|
||||
// Does some special results processing for any public member functions
|
||||
// that do some database server operations. It should be used to get
|
||||
// the final results for all such member functions. Member functions
|
||||
// that are not public or that only work on the memory copy of the
|
||||
// object should not call processDBResults.
|
||||
//
|
||||
_Tt_db_results processDBResults ();
|
||||
|
||||
void setCurrentDBAccess ()
|
||||
{
|
||||
if (!dbFileDatabase.is_null()) {
|
||||
dbFileDatabase->setCurrentAccess(dbFileCurrentAccess);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#endif // _TT_DB_FILE_H
|
||||
14
cde/lib/tt/lib/db/tt_db_file_utils.C
Normal file
14
cde/lib/tt/lib/db/tt_db_file_utils.C
Normal file
@@ -0,0 +1,14 @@
|
||||
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
//%% (c) Copyright 1993, 1994 Novell, Inc.
|
||||
//%% $XConsortium: tt_db_file_utils.C /main/3 1995/10/23 10:02:14 rswiston $
|
||||
/*
|
||||
* tt_db_file_utils.cc - Defines the _Tt_db_file utilities.
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#include "db/tt_db_file_utils.h"
|
||||
|
||||
implement_ptr_to(_Tt_db_file)
|
||||
20
cde/lib/tt/lib/db/tt_db_file_utils.h
Normal file
20
cde/lib/tt/lib/db/tt_db_file_utils.h
Normal file
@@ -0,0 +1,20 @@
|
||||
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
|
||||
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
|
||||
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
|
||||
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
|
||||
/*%% $XConsortium: tt_db_file_utils.h /main/3 1995/10/23 10:02:22 rswiston $ */
|
||||
/*
|
||||
* tt_db_file_utils.h - Declare the _Tt_db_file utilities.
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#ifndef _TT_DB_FILE_UTILS_H
|
||||
#define _TT_DB_FILE_UTILS_H
|
||||
|
||||
#include "util/tt_table.h"
|
||||
#include "db/tt_db_file.h"
|
||||
|
||||
declare_ptr_to(_Tt_db_file)
|
||||
|
||||
#endif // _TT_DB_FILE_UTILS_H
|
||||
86
cde/lib/tt/lib/db/tt_db_hostname_global_map_ref.C
Normal file
86
cde/lib/tt/lib/db/tt_db_hostname_global_map_ref.C
Normal file
@@ -0,0 +1,86 @@
|
||||
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
//%% (c) Copyright 1993, 1994 Novell, Inc.
|
||||
//%% $XConsortium: tt_db_hostname_global_map_ref.C /main/3 1995/10/23 10:02:29 rswiston $
|
||||
/*
|
||||
* tt_db_hostname_global_map_ref.cc - Define the TT DB client hostname global
|
||||
* map ref class. This class contains a global map
|
||||
* that provides a hostname to DB connection mapping.
|
||||
* This way only one RPC connection per machine is
|
||||
* created.
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#include "db/tt_db_hostname_global_map_ref.h"
|
||||
#include "util/tt_global_env.h"
|
||||
|
||||
_Tt_db_client_table_ptr*
|
||||
_Tt_db_hostname_global_map_ref::dbHostnameMap = (_Tt_db_client_table_ptr *)NULL;
|
||||
|
||||
_Tt_db_hostname_global_map_ref::_Tt_db_hostname_global_map_ref ()
|
||||
{
|
||||
if (!dbHostnameMap) {
|
||||
dbHostnameMap = new _Tt_db_client_table_ptr;
|
||||
*dbHostnameMap = new _Tt_db_client_table
|
||||
((_Tt_object_table_keyfn)
|
||||
&_Tt_db_hostname_global_map_ref::dbHostnameMapKey);
|
||||
}
|
||||
}
|
||||
|
||||
_Tt_db_hostname_global_map_ref::~_Tt_db_hostname_global_map_ref ()
|
||||
{
|
||||
// The static table is freed up when the application dies or when
|
||||
// _Tt_db_hostname_global_map_ref::flush() is called.
|
||||
}
|
||||
|
||||
void _Tt_db_hostname_global_map_ref::addDB (_Tt_db_client_ptr &db)
|
||||
{
|
||||
(*dbHostnameMap)->insert(db);
|
||||
}
|
||||
|
||||
void _Tt_db_hostname_global_map_ref::removeDB (const _Tt_string &hostname)
|
||||
{
|
||||
(*dbHostnameMap)->remove(hostname);
|
||||
}
|
||||
|
||||
_Tt_db_client_ptr
|
||||
_Tt_db_hostname_global_map_ref::getDB (const _Tt_string &hostname,
|
||||
_Tt_string &real_hostname,
|
||||
_Tt_db_results &results)
|
||||
{
|
||||
_Tt_string temp_hostname = _tt_global->db_hr_map.findEntry(hostname);
|
||||
if (temp_hostname.is_null() || !temp_hostname.len()) {
|
||||
temp_hostname = hostname;
|
||||
}
|
||||
real_hostname = temp_hostname;
|
||||
|
||||
_Tt_db_client_ptr db_ptr = (*dbHostnameMap)->lookup(real_hostname);
|
||||
if (db_ptr.is_null()) {
|
||||
db_ptr = new _Tt_db_client(real_hostname, results);
|
||||
if (results != TT_DB_OK) { /* Can't happen ??? */
|
||||
db_ptr = (_Tt_db_client *)0;
|
||||
return db_ptr;
|
||||
}
|
||||
addDB(db_ptr);
|
||||
}
|
||||
else {
|
||||
results = TT_DB_OK;
|
||||
}
|
||||
|
||||
return db_ptr;
|
||||
}
|
||||
|
||||
_Tt_string _Tt_db_hostname_global_map_ref::dbHostnameMapKey (_Tt_object_ptr &db)
|
||||
{
|
||||
return (((_Tt_db_client *)db.c_pointer())->getHostname());
|
||||
}
|
||||
|
||||
void _Tt_db_hostname_global_map_ref::flush ()
|
||||
{
|
||||
if (dbHostnameMap) {
|
||||
delete dbHostnameMap;
|
||||
}
|
||||
dbHostnameMap = (_Tt_db_client_table_ptr *)NULL;
|
||||
}
|
||||
43
cde/lib/tt/lib/db/tt_db_hostname_global_map_ref.h
Normal file
43
cde/lib/tt/lib/db/tt_db_hostname_global_map_ref.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
|
||||
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
|
||||
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
|
||||
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
|
||||
/*%% $XConsortium: tt_db_hostname_global_map_ref.h /main/3 1995/10/23 10:02:37 rswiston $ */
|
||||
/*
|
||||
* tt_db_hostname_global_map_ref.h - Declare the TT DB server hostname
|
||||
* global map ref class. This class
|
||||
* contains a global map that provides
|
||||
* a hostname to DB connection mapping.
|
||||
* This way only one RPC connection per
|
||||
* machine is created.
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#ifndef _TT_DB_HOSTNAME_GLOBAL_MAP_REF_H
|
||||
#define _TT_DB_HOSTNAME_GLOBAL_MAP_REF_H
|
||||
|
||||
#include "util/tt_new.h"
|
||||
#include "util/tt_string.h"
|
||||
#include "db/tt_db_client_utils.h"
|
||||
|
||||
class _Tt_db_hostname_global_map_ref : public _Tt_allocated {
|
||||
public:
|
||||
_Tt_db_hostname_global_map_ref ();
|
||||
~_Tt_db_hostname_global_map_ref ();
|
||||
|
||||
void addDB (_Tt_db_client_ptr &db);
|
||||
void removeDB (const _Tt_string &hostname);
|
||||
_Tt_db_client_ptr getDB (const _Tt_string &hostname,
|
||||
_Tt_string &real_hostname,
|
||||
_Tt_db_results &dbResults);
|
||||
|
||||
static void flush ();
|
||||
static _Tt_string dbHostnameMapKey (_Tt_object_ptr &db);
|
||||
|
||||
private:
|
||||
static _Tt_db_client_table_ptr *dbHostnameMap;
|
||||
|
||||
};
|
||||
|
||||
#endif // _TT_DB_HOSTNAME_GLOBAL_MAP_REF_H
|
||||
50
cde/lib/tt/lib/db/tt_db_hostname_redirection_map.C
Normal file
50
cde/lib/tt/lib/db/tt_db_hostname_redirection_map.C
Normal file
@@ -0,0 +1,50 @@
|
||||
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
//%% (c) Copyright 1993, 1994 Novell, Inc.
|
||||
//%% $XConsortium: tt_db_hostname_redirection_map.C /main/3 1995/10/23 10:02:44 rswiston $
|
||||
/*
|
||||
* Tool Talk Utility - tt_hostname_redirection_map.cc
|
||||
*
|
||||
* Copyright (c) 1990 by Sun Microsystems, Inc.
|
||||
*
|
||||
* Defines a hostname redirection map. A global version
|
||||
* of this object is in _tt_global.
|
||||
*/
|
||||
|
||||
#include "db/tt_db_hostname_redirection_map.h"
|
||||
#include "util/tt_path.h"
|
||||
|
||||
static const char hr_map_file[] = "hostname_map";
|
||||
static const char hr_map_env[] = "_SUN_TT_HOSTNAME_MAP";
|
||||
static const char hr_cde_map_env[] = "TT_HOSTNAME_MAP";
|
||||
|
||||
_Tt_db_hostname_redirection_map::
|
||||
_Tt_db_hostname_redirection_map ()
|
||||
{
|
||||
map = new _Tt_string_map((_Tt_object_table_keyfn)
|
||||
&_Tt_map_entry::getAddress);
|
||||
}
|
||||
|
||||
_Tt_db_hostname_redirection_map::
|
||||
~_Tt_db_hostname_redirection_map ()
|
||||
{
|
||||
}
|
||||
|
||||
_Tt_string _Tt_db_hostname_redirection_map::
|
||||
findEntry(const _Tt_string &address)
|
||||
{
|
||||
return map->findEntry(address);
|
||||
}
|
||||
|
||||
void _Tt_db_hostname_redirection_map::
|
||||
refresh ()
|
||||
{
|
||||
// give preference to the cde named setting
|
||||
const char *hr_map_env_to_use = (getenv(hr_cde_map_env) ? hr_cde_map_env : hr_map_env);
|
||||
|
||||
_Tt_string path = _tt_user_path (hr_map_file, hr_map_env_to_use, FALSE);
|
||||
if (path.len()>0) {
|
||||
map->loadFile(path);
|
||||
}
|
||||
}
|
||||
35
cde/lib/tt/lib/db/tt_db_hostname_redirection_map.h
Normal file
35
cde/lib/tt/lib/db/tt_db_hostname_redirection_map.h
Normal file
@@ -0,0 +1,35 @@
|
||||
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
|
||||
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
|
||||
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
|
||||
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
|
||||
/*%% $XConsortium: tt_db_hostname_redirection_map.h /main/3 1995/10/23 10:02:51 rswiston $ */
|
||||
/* @(#)tt_db_hostname_redirection_map.h 1.5 @(#)
|
||||
* Tool Talk Utility - tt_hostname_redirection_map.h
|
||||
*
|
||||
* Copyright (c) 1990 by Sun Microsystems, Inc.
|
||||
*
|
||||
* Declares a hostname redirection map. A global version
|
||||
* of this object is in _tt_global.
|
||||
*/
|
||||
|
||||
#ifndef _TT_HOSTNAME_REDIRECTION_MAP_H
|
||||
#define _TT_HOSTNAME_REDIRECTION_MAP_H
|
||||
|
||||
#include "util/tt_object.h"
|
||||
#include "util/tt_string_map_utils.h"
|
||||
#include "util/tt_string_map.h"
|
||||
#include "util/tt_map_entry.h"
|
||||
|
||||
class _Tt_db_hostname_redirection_map : public _Tt_object {
|
||||
public:
|
||||
_Tt_db_hostname_redirection_map ();
|
||||
~_Tt_db_hostname_redirection_map ();
|
||||
|
||||
void refresh ();
|
||||
_Tt_string findEntry(const _Tt_string &address);
|
||||
|
||||
private:
|
||||
_Tt_string_map_ptr map;
|
||||
};
|
||||
|
||||
#endif /* _TT_HOSTNAME_REDIRECTION_MAP_H */
|
||||
105
cde/lib/tt/lib/db/tt_db_key.C
Normal file
105
cde/lib/tt/lib/db/tt_db_key.C
Normal file
@@ -0,0 +1,105 @@
|
||||
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
//%% (c) Copyright 1993, 1994 Novell, Inc.
|
||||
//%% $XConsortium: tt_db_key.C /main/3 1995/10/23 10:02:59 rswiston $
|
||||
/*
|
||||
* @(#)tt_db_key.C 1.10 93/09/07
|
||||
+ Implements the TT db server key class.
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#include <util/tt_base64.h>
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "util/tt_base64.h"
|
||||
#include "util/tt_port.h"
|
||||
#include "db/tt_db_key.h"
|
||||
|
||||
_Tt_db_key::_Tt_db_key (short version_number)
|
||||
{
|
||||
static long last_time_sec = 0;
|
||||
static long counter = 0;
|
||||
|
||||
key.version = version_number;
|
||||
key.padding = 0;
|
||||
key.hostid = _tt_gethostid();
|
||||
key.time_sec = time ((time_t *) NULL);
|
||||
|
||||
if (key.time_sec != last_time_sec) {
|
||||
last_time_sec = key.time_sec;
|
||||
counter = getpid() * 10000;
|
||||
}
|
||||
key.counter = counter++;
|
||||
}
|
||||
|
||||
_Tt_db_key::_Tt_db_key (const _Tt_string &string)
|
||||
{
|
||||
// If this is an actual key...
|
||||
if ((string.len() == TT_DB_KEY_LENGTH) && (string[0] < '0')) {
|
||||
(void)memcpy((char *)&key, (char *)string, TT_DB_KEY_LENGTH);
|
||||
}
|
||||
// Else, assume this is an objid...
|
||||
else {
|
||||
_Tt_string key_string = (char *)string;
|
||||
_Tt_string temp_string;
|
||||
|
||||
// Get the version number
|
||||
key_string = key_string.split('|', temp_string);
|
||||
key.version = (unsigned short)_tt_base64_decode(temp_string);
|
||||
|
||||
// In the future, if the key format changes, it may be necessary
|
||||
// to check the version here and decode according to the version
|
||||
// number.
|
||||
|
||||
// Set the padding to 2 bytes of 0
|
||||
key.padding = (unsigned short)0;
|
||||
|
||||
// Get the host ID
|
||||
key_string = key_string.split('|', temp_string);
|
||||
key.hostid = _tt_base64_decode(temp_string);
|
||||
|
||||
// Get the first time component
|
||||
key_string = key_string.split('|', temp_string);
|
||||
key.time_sec = _tt_base64_decode(temp_string);
|
||||
|
||||
// Get the last time component
|
||||
if (key_string.index(':') == -1) {
|
||||
key.counter = _tt_base64_decode(key_string);
|
||||
}
|
||||
else {
|
||||
key_string = key_string.split(':', temp_string);
|
||||
key.counter = _tt_base64_decode(temp_string);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_Tt_db_key::~_Tt_db_key ()
|
||||
{
|
||||
}
|
||||
|
||||
_Tt_string _Tt_db_key::string () const
|
||||
{
|
||||
_Tt_string result(_tt_base64_encode(key.version));
|
||||
result = result.cat("|");
|
||||
result = result.cat(_tt_base64_encode(key.hostid)).cat("|");
|
||||
result = result.cat(_tt_base64_encode(key.time_sec)).cat("|");
|
||||
result = result.cat(_tt_base64_encode(key.counter));
|
||||
return result;
|
||||
}
|
||||
|
||||
int _Tt_db_key::
|
||||
operator== (const _Tt_db_key &otherkey) const
|
||||
{
|
||||
// Very minor optimization:: compare the most likely differences
|
||||
// first
|
||||
return (key.time_sec==otherkey.key.time_sec &&
|
||||
key.counter==otherkey.key.counter &&
|
||||
key.version==otherkey.key.version &&
|
||||
key.padding==otherkey.key.padding &&
|
||||
key.hostid==otherkey.key.hostid);
|
||||
}
|
||||
66
cde/lib/tt/lib/db/tt_db_key.h
Normal file
66
cde/lib/tt/lib/db/tt_db_key.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
|
||||
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
|
||||
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
|
||||
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
|
||||
/*%% $XConsortium: tt_db_key.h /main/4 1996/07/30 17:41:16 barstow $ */
|
||||
/*
|
||||
* tt_db_key.h - Defines the TT db server key class. This class is used to
|
||||
* create unique object keys and object IDs. The key layout
|
||||
* is:
|
||||
*
|
||||
* <00> <zero pad:2> <host id:4> <time sec:4> <counter:4>
|
||||
*
|
||||
* The padding goes before the host id to align the host id on an int boundary.
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#ifndef _TT_DB_KEY_H
|
||||
#define _TT_DB_KEY_H
|
||||
|
||||
#include "util/tt_object.h"
|
||||
#include "util/tt_string.h"
|
||||
|
||||
struct _Tt_key_data {
|
||||
unsigned short version;
|
||||
unsigned short padding;
|
||||
#ifdef __osf__
|
||||
/* These fields need to be: <host id:4> <time sec:4> <counter:4> */
|
||||
unsigned int hostid;
|
||||
unsigned int time_sec;
|
||||
unsigned int counter;
|
||||
#else
|
||||
unsigned long hostid;
|
||||
unsigned long time_sec;
|
||||
unsigned long counter;
|
||||
#endif /* __osf__ */
|
||||
};
|
||||
|
||||
const int TT_DB_KEY_LENGTH = sizeof(_Tt_key_data);
|
||||
|
||||
class _Tt_db_key : public _Tt_object {
|
||||
public:
|
||||
_Tt_db_key (short version_number=0);
|
||||
_Tt_db_key (const _Tt_string&);
|
||||
~_Tt_db_key ();
|
||||
|
||||
_Tt_string string () const;
|
||||
_Tt_string binary () const
|
||||
{
|
||||
_Tt_string binary_string(TT_DB_KEY_LENGTH);
|
||||
memcpy((char *)binary_string, (char *)&key, TT_DB_KEY_LENGTH);
|
||||
return binary_string;
|
||||
}
|
||||
int operator==(const _Tt_db_key &otherkey) const;
|
||||
int operator!=(const _Tt_db_key &otherkey) const
|
||||
{ return ! operator==(otherkey);}
|
||||
void print(FILE *fs) const
|
||||
{ fprintf(fs, "%s", (char *)(this->string())); }
|
||||
|
||||
|
||||
|
||||
private:
|
||||
_Tt_key_data key;
|
||||
};
|
||||
|
||||
#endif /* _TT_DB_KEY_H */
|
||||
14
cde/lib/tt/lib/db/tt_db_key_utils.C
Normal file
14
cde/lib/tt/lib/db/tt_db_key_utils.C
Normal file
@@ -0,0 +1,14 @@
|
||||
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
//%% (c) Copyright 1993, 1994 Novell, Inc.
|
||||
//%% $XConsortium: tt_db_key_utils.C /main/3 1995/10/23 10:03:14 rswiston $
|
||||
/*
|
||||
* tt_db_key_utils.cc - Defines the _Tt_db_key utilities.
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#include "db/tt_db_key_utils.h"
|
||||
|
||||
implement_ptr_to(_Tt_db_key)
|
||||
19
cde/lib/tt/lib/db/tt_db_key_utils.h
Normal file
19
cde/lib/tt/lib/db/tt_db_key_utils.h
Normal file
@@ -0,0 +1,19 @@
|
||||
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
|
||||
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
|
||||
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
|
||||
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
|
||||
/*%% $XConsortium: tt_db_key_utils.h /main/3 1995/10/23 10:03:22 rswiston $ */
|
||||
/*
|
||||
* tt_db_key_utils.h - Declares the _Tt_db_key utilities.
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#ifndef _TT_DB_KEY_UTILS_H
|
||||
#define _TT_DB_KEY_UTILS_H
|
||||
|
||||
#include "db/tt_db_key.h"
|
||||
|
||||
declare_ptr_to(_Tt_db_key)
|
||||
|
||||
#endif // _TT_DB_KEY_UTILS_H
|
||||
92
cde/lib/tt/lib/db/tt_db_network_path.C
Normal file
92
cde/lib/tt/lib/db/tt_db_network_path.C
Normal file
@@ -0,0 +1,92 @@
|
||||
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
//%% (c) Copyright 1993, 1994 Novell, Inc.
|
||||
//%% $XConsortium: tt_db_network_path.C /main/3 1995/10/23 10:03:29 rswiston $
|
||||
/*
|
||||
* tt_db_network_path.cc - Defines a function that takes a local
|
||||
* path and returns the real local path, hostname, partition
|
||||
* and real remote path of the file. The partition and real
|
||||
* remote path are for the file on its native host.
|
||||
*
|
||||
* Copyright (c) 1990 by Sun Microsystems, Inc.
|
||||
*
|
||||
* Implementation for filepath utility functions
|
||||
*
|
||||
*/
|
||||
|
||||
#include "util/tt_path.h"
|
||||
#include "util/tt_file_system.h"
|
||||
#include "util/tt_file_system_entry.h"
|
||||
#include "db/tt_db_hostname_global_map_ref.h"
|
||||
|
||||
_Tt_db_results _tt_db_network_path (const _Tt_string &path,
|
||||
_Tt_string &local_path,
|
||||
_Tt_string &hostname,
|
||||
_Tt_string &partition,
|
||||
_Tt_string &network_path)
|
||||
{
|
||||
_Tt_db_results results = TT_DB_OK;
|
||||
|
||||
|
||||
if (_tt_is_network_path(path)) {
|
||||
local_path = _tt_network_path_to_local_path(path);
|
||||
} else {
|
||||
local_path = _tt_realpath(path);
|
||||
}
|
||||
|
||||
_Tt_file_system file_system;
|
||||
_Tt_file_system_entry_ptr file_system_entry =
|
||||
file_system.bestMatchToPath(local_path);
|
||||
|
||||
hostname = file_system_entry->getHostname();
|
||||
|
||||
if (file_system_entry->isLocal()) {
|
||||
partition = file_system_entry->getMountPoint();
|
||||
|
||||
_Tt_string loop_back_mount_point =
|
||||
file_system_entry->getLoopBackMountPoint();
|
||||
|
||||
if (loop_back_mount_point.len ()) {
|
||||
// Get the path info after the mount point path
|
||||
local_path = local_path.right(local_path.len() -
|
||||
loop_back_mount_point.len());
|
||||
|
||||
// Replace the mount point path with
|
||||
// the exported partition path.
|
||||
if (partition != "/") {
|
||||
local_path = loop_back_mount_point.cat(local_path);
|
||||
}
|
||||
}
|
||||
network_path = hostname.cat(":").cat(local_path);
|
||||
} else {
|
||||
_Tt_db_hostname_global_map_ref map_ref;
|
||||
_Tt_db_client_ptr database =
|
||||
map_ref.getDB(hostname, hostname, results);
|
||||
|
||||
if (!database.is_null()) {
|
||||
_Tt_string temp_string;
|
||||
_Tt_string local_network_path;
|
||||
|
||||
if (_tt_is_network_path(path)) {
|
||||
local_network_path = path;
|
||||
} else {
|
||||
local_network_path =
|
||||
_tt_local_network_path(path);
|
||||
}
|
||||
|
||||
results = database->getFilePartition(local_network_path,
|
||||
partition,
|
||||
network_path);
|
||||
}
|
||||
|
||||
if ((results == TT_DB_ERR_DB_CONNECTION_FAILED) ||
|
||||
(results == TT_DB_ERR_RPC_CONNECTION_FAILED) ||
|
||||
(results == TT_DB_ERR_RPC_FAILED) ||
|
||||
(results == TT_DB_ERR_DB_OPEN_FAILED)) {
|
||||
map_ref.removeDB (hostname);
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
27
cde/lib/tt/lib/db/tt_db_network_path.h
Normal file
27
cde/lib/tt/lib/db/tt_db_network_path.h
Normal file
@@ -0,0 +1,27 @@
|
||||
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
|
||||
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
|
||||
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
|
||||
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
|
||||
/*%% $XConsortium: tt_db_network_path.h /main/3 1995/10/23 10:03:37 rswiston $ */
|
||||
/*
|
||||
* Tool Talk Utility - tt_db_network_path.h
|
||||
*
|
||||
* Copyright (c) 1990 by Sun Microsystems, Inc.
|
||||
*
|
||||
* Extern declarations for filepath utility functions
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _TT_DB_NETWORK_PATH_H
|
||||
#define _TT_DB_NETWORK_PATH_H
|
||||
|
||||
#include <util/tt_string.h>
|
||||
#include <db/tt_db_results.h>
|
||||
|
||||
extern _Tt_db_results _tt_db_network_path(const _Tt_string &path,
|
||||
_Tt_string &local_path,
|
||||
_Tt_string &hostname,
|
||||
_Tt_string &partition,
|
||||
_Tt_string &network_path);
|
||||
|
||||
#endif /* _TT_DB_NETWORK_PATH_H */
|
||||
804
cde/lib/tt/lib/db/tt_db_object.C
Normal file
804
cde/lib/tt/lib/db/tt_db_object.C
Normal file
@@ -0,0 +1,804 @@
|
||||
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
//%% (c) Copyright 1993, 1994 Novell, Inc.
|
||||
//%% $XConsortium: tt_db_object.C /main/3 1995/10/23 10:03:44 rswiston $
|
||||
/*
|
||||
* tt_db_object.cc - Implement the TT DB server object class.
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "db/tt_db_create_objid.h"
|
||||
#include "db/tt_db_key_utils.h"
|
||||
#include "db/tt_db_network_path.h"
|
||||
#include "db/tt_db_object_utils.h"
|
||||
#include "db/tt_db_objid_to_key.h"
|
||||
#include "db/tt_db_access.h"
|
||||
#include "db/tt_db_property.h"
|
||||
|
||||
#define TT_DB_PROPS_CACHE_LEVEL_PROPERTY "_MODIFICATION_DATE"
|
||||
|
||||
_Tt_db_object::_Tt_db_object ()
|
||||
{
|
||||
setTtDBObjectDefaults();
|
||||
}
|
||||
|
||||
_Tt_db_object::_Tt_db_object (const _Tt_string &objid)
|
||||
{
|
||||
setTtDBObjectDefaults();
|
||||
dbObjectID = objid;
|
||||
|
||||
getDBObjectHostnameFromID ();
|
||||
if (isObjectInDatabase()) {
|
||||
dbObjectPropertiesCacheLevel = -1;
|
||||
|
||||
setCurrentDBAccess ();
|
||||
dbResults =
|
||||
dbObjectDatabase->getObjectProperties(dbObjectID,
|
||||
dbObjectPropertiesCacheLevel,
|
||||
dbObjectProperties);
|
||||
|
||||
memoryObjectCreated = TRUE;
|
||||
|
||||
if ((dbResults == TT_DB_ERR_DB_CONNECTION_FAILED) ||
|
||||
(dbResults == TT_DB_ERR_RPC_CONNECTION_FAILED)) {
|
||||
dbHostnameGlobalMapRef.removeDB (dbObjectHostname);
|
||||
}
|
||||
}
|
||||
else {
|
||||
dbResults = TT_DB_ERR_NO_SUCH_OBJECT;
|
||||
}
|
||||
}
|
||||
|
||||
void _Tt_db_object::setTtDBObjectDefaults ()
|
||||
{
|
||||
checkedDatabase = FALSE;
|
||||
dbObjectAccess = new _Tt_db_access;
|
||||
dbObjectCurrentAccess = new _Tt_db_access;
|
||||
dbObjectProperties = new _Tt_db_property_list;
|
||||
dbObjectPropertiesCacheLevel = -1;
|
||||
dbResults = TT_DB_OK;
|
||||
forwardPointerFlag = FALSE;
|
||||
memoryObjectCreated = FALSE;
|
||||
}
|
||||
|
||||
_Tt_db_object::~_Tt_db_object ()
|
||||
{
|
||||
}
|
||||
|
||||
void _Tt_db_object::setCurrentAccess (const _Tt_db_access_ptr &access)
|
||||
{
|
||||
dbObjectCurrentAccess = access;
|
||||
}
|
||||
|
||||
_Tt_db_access_ptr _Tt_db_object::getCurrentAccess () const
|
||||
{
|
||||
return dbObjectCurrentAccess;
|
||||
}
|
||||
|
||||
_Tt_string _Tt_db_object::create (const _Tt_string &file)
|
||||
{
|
||||
_Tt_string empty;
|
||||
return create(file, empty);
|
||||
}
|
||||
|
||||
_Tt_string _Tt_db_object::create (const _Tt_string &file,
|
||||
const _Tt_string &key)
|
||||
{
|
||||
if (!memoryObjectCreated) {
|
||||
if (!file.len()) {
|
||||
dbResults = TT_DB_ERR_ILLEGAL_FILE;
|
||||
}
|
||||
else {
|
||||
dbResults = createMemoryObject(file, key);
|
||||
|
||||
if (dbResults == TT_DB_OK) {
|
||||
memoryObjectCreated = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
dbResults = TT_DB_ERR_OBJECT_EXISTS;
|
||||
}
|
||||
|
||||
return dbObjectID;
|
||||
}
|
||||
|
||||
_Tt_db_results _Tt_db_object::write ()
|
||||
{
|
||||
if (!isObjectInDatabase()) {
|
||||
dbResults = createDBObject();
|
||||
}
|
||||
else {
|
||||
_Tt_db_property_list_ptr properties_in_db;
|
||||
|
||||
// Find the cache level property and make sure it is up to date
|
||||
// with the actual cache level
|
||||
// XXX - This needs to be done with 4/93 DB servers. 10/93 DB servers
|
||||
// will protect the cache level property on the DB server side.
|
||||
_Tt_db_property_list_cursor properties_cursor (dbObjectProperties);
|
||||
_Tt_string cache_level_bytes (sizeof (int));
|
||||
|
||||
while (properties_cursor.next ()) {
|
||||
if (properties_cursor->name == TT_DB_PROPS_CACHE_LEVEL_PROPERTY) {
|
||||
memcpy ((char *)cache_level_bytes,
|
||||
&dbObjectPropertiesCacheLevel,
|
||||
sizeof (int));
|
||||
properties_cursor->values->flush ();
|
||||
properties_cursor->values->append (cache_level_bytes);
|
||||
}
|
||||
}
|
||||
|
||||
setCurrentDBAccess ();
|
||||
dbResults =
|
||||
dbObjectDatabase->setObjectProperties(dbObjectID,
|
||||
dbObjectProperties,
|
||||
properties_in_db,
|
||||
dbObjectPropertiesCacheLevel);
|
||||
|
||||
// If there was an update conflict, that means someone else wrote
|
||||
// new props to the DB since this object had read its cached props.
|
||||
// The _Tt_db_client object returns the properties currently in the
|
||||
// database when this type of conflict occurs.
|
||||
if (dbResults == TT_DB_ERR_UPDATE_CONFLICT) {
|
||||
dbObjectProperties = properties_in_db;
|
||||
}
|
||||
}
|
||||
|
||||
return processDBResults();
|
||||
}
|
||||
|
||||
_Tt_db_results _Tt_db_object::refresh ()
|
||||
{
|
||||
// Check if it is in the database and force it to find the object
|
||||
// if it has been moved.
|
||||
if (isObjectInDatabase(TRUE)) {
|
||||
int cache_level = dbObjectPropertiesCacheLevel;
|
||||
_Tt_db_property_list_ptr properties;
|
||||
|
||||
setCurrentDBAccess ();
|
||||
dbResults = dbObjectDatabase->getObjectProperties(dbObjectID,
|
||||
cache_level,
|
||||
properties);
|
||||
|
||||
// Update the cache if the _Tt_db_client has new property data
|
||||
if (cache_level > dbObjectPropertiesCacheLevel) {
|
||||
dbObjectPropertiesCacheLevel = cache_level;
|
||||
dbObjectProperties = properties;
|
||||
}
|
||||
}
|
||||
else {
|
||||
dbResults = TT_DB_OK;
|
||||
}
|
||||
|
||||
return processDBResults();
|
||||
}
|
||||
|
||||
_Tt_db_results _Tt_db_object::remove ()
|
||||
{
|
||||
if (isObjectInDatabase()) {
|
||||
setCurrentDBAccess ();
|
||||
dbResults = dbObjectDatabase->removeObject(dbObjectID,
|
||||
_Tt_string((char *)NULL));
|
||||
|
||||
if (dbResults == TT_DB_OK) {
|
||||
setTtDBObjectDefaults();
|
||||
}
|
||||
}
|
||||
else {
|
||||
dbResults = TT_DB_ERR_NO_SUCH_OBJECT;
|
||||
}
|
||||
|
||||
return processDBResults();
|
||||
}
|
||||
|
||||
_Tt_db_results _Tt_db_object::remove (const _Tt_string &forward_pointer)
|
||||
{
|
||||
if (isObjectInDatabase()) {
|
||||
setCurrentDBAccess ();
|
||||
dbResults = dbObjectDatabase->removeObject(dbObjectID, forward_pointer);
|
||||
|
||||
if (dbResults == TT_DB_OK) {
|
||||
setTtDBObjectDefaults();
|
||||
}
|
||||
}
|
||||
else {
|
||||
dbResults = TT_DB_ERR_NO_SUCH_OBJECT;
|
||||
}
|
||||
|
||||
return processDBResults();
|
||||
}
|
||||
|
||||
_Tt_string _Tt_db_object::copy (const _Tt_string &new_file)
|
||||
{
|
||||
_Tt_string new_objid;
|
||||
|
||||
if (!new_file.len()) {
|
||||
dbResults = TT_DB_ERR_ILLEGAL_FILE;
|
||||
return new_objid;
|
||||
}
|
||||
|
||||
if (isObjectInDatabase()) {
|
||||
dbObjectFile = getFile();
|
||||
|
||||
_Tt_string new_local_file;
|
||||
_Tt_string new_hostname;
|
||||
_Tt_string new_partition;
|
||||
_Tt_string new_file_network_path;
|
||||
dbResults = _tt_db_network_path(new_file,
|
||||
new_local_file,
|
||||
new_hostname,
|
||||
new_partition,
|
||||
new_file_network_path);
|
||||
|
||||
if (dbResults == TT_DB_OK) {
|
||||
// If we're not copying to the exact same file
|
||||
if (dbObjectFile != new_file_network_path) {
|
||||
_Tt_db_object_ptr new_object = new _Tt_db_object;
|
||||
new_objid = new_object->create(new_file_network_path);
|
||||
dbResults = new_object->getDBResults();
|
||||
|
||||
if ((dbResults == TT_DB_OK) && new_objid.len()) {
|
||||
// Refresh the current object's info
|
||||
dbResults = internalRefresh();
|
||||
if (dbResults == TT_DB_OK) {
|
||||
(void)new_object->setAccess(dbObjectAccess);
|
||||
(void)new_object->setProperties(dbObjectProperties);
|
||||
(void)new_object->setType(dbObjectType);
|
||||
dbResults = new_object->write();
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
dbResults = TT_DB_ERR_SAME_OBJECT;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
dbResults = TT_DB_ERR_NO_SUCH_OBJECT;
|
||||
}
|
||||
|
||||
dbResults = processDBResults();
|
||||
return new_objid;
|
||||
}
|
||||
|
||||
_Tt_string _Tt_db_object::move (const _Tt_string &new_file)
|
||||
{
|
||||
_Tt_string new_objid;
|
||||
|
||||
if (!new_file.len()) {
|
||||
dbResults = TT_DB_ERR_ILLEGAL_FILE;
|
||||
return new_objid;
|
||||
}
|
||||
|
||||
if (isObjectInDatabase()) {
|
||||
dbObjectFile = getFile();
|
||||
|
||||
_Tt_string new_local_file;
|
||||
_Tt_string new_hostname;
|
||||
_Tt_string new_partition;
|
||||
_Tt_string new_file_network_path;
|
||||
dbResults = _tt_db_network_path(new_file,
|
||||
new_local_file,
|
||||
new_hostname,
|
||||
new_partition,
|
||||
new_file_network_path);
|
||||
|
||||
// If we're not moving to the exact same file
|
||||
if (dbObjectFile != new_file_network_path) {
|
||||
new_objid = makeEquivalentObjectID(new_hostname, new_partition);
|
||||
|
||||
if ((dbResults == TT_DB_OK) && new_objid.len()) {
|
||||
// If the objids are still the same, we only need to change the
|
||||
// object's file in the database...
|
||||
if (dbObjectID == new_objid) {
|
||||
dbResults = dbObjectDatabase->setObjectFile(dbObjectID,
|
||||
new_file_network_path);
|
||||
|
||||
if (dbResults == TT_DB_OK) {
|
||||
dbResults = TT_DB_WRN_SAME_OBJECT_ID;
|
||||
}
|
||||
}
|
||||
// Different objids and therefore different partitions or hosts
|
||||
else {
|
||||
_Tt_db_object_ptr new_object = new _Tt_db_object;
|
||||
dbResults = new_object->setObjectID(new_objid);
|
||||
|
||||
// The new object should not exist, yet...
|
||||
if (dbResults == TT_DB_ERR_NO_SUCH_OBJECT) {
|
||||
new_object->dbObjectHostname = new_hostname;
|
||||
new_object->dbObjectFile = new_file_network_path;
|
||||
|
||||
// Refresh the current object's info
|
||||
dbResults = internalRefresh();
|
||||
if (dbResults == TT_DB_OK) {
|
||||
(void)new_object->setAccess(dbObjectAccess);
|
||||
(void)new_object->setProperties(dbObjectProperties);
|
||||
(void)new_object->setType(dbObjectType);
|
||||
dbResults = new_object->write();
|
||||
}
|
||||
}
|
||||
// If the new object already exists, then there is something
|
||||
// weird going on...
|
||||
else if (dbResults == TT_DB_OK) {
|
||||
dbResults = TT_DB_ERR_CORRUPT_DB;
|
||||
}
|
||||
|
||||
if (dbResults == TT_DB_OK) {
|
||||
// Remove current object from the DB and specify the new objid
|
||||
// as the forward pointer.
|
||||
dbResults = remove(new_objid);
|
||||
|
||||
if (dbResults == TT_DB_OK) {
|
||||
setTtDBObjectDefaults();
|
||||
dbResults = setObjectID(new_objid);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (dbResults == TT_DB_OK) {
|
||||
dbResults = TT_DB_ERR_ILLEGAL_OBJECT;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
dbResults = TT_DB_ERR_SAME_OBJECT;
|
||||
}
|
||||
}
|
||||
else {
|
||||
dbResults = TT_DB_ERR_NO_SUCH_OBJECT;
|
||||
}
|
||||
|
||||
dbResults = processDBResults();
|
||||
return new_objid;
|
||||
}
|
||||
|
||||
_Tt_db_results
|
||||
_Tt_db_object::setProperty (const _Tt_db_property_ptr &property)
|
||||
{
|
||||
if (property->name.len()) {
|
||||
// See if a property with the same name exists...
|
||||
bool_t found = FALSE;
|
||||
_Tt_db_property_list_cursor properties_cursor(dbObjectProperties);
|
||||
while (properties_cursor.next()) {
|
||||
if (properties_cursor->name == property->name) {
|
||||
found = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If a property with the same name exists...
|
||||
if (found) {
|
||||
// If the new property has no values specified, then just
|
||||
// delete the old property...
|
||||
if (property->is_empty()) {
|
||||
properties_cursor.remove();
|
||||
}
|
||||
// Else, we actually want to set some values...
|
||||
else {
|
||||
*properties_cursor = property;
|
||||
}
|
||||
}
|
||||
// Else, no property with same name exists, just append the new
|
||||
// property (if it's not empty)
|
||||
else { if (!property->is_empty())
|
||||
dbObjectProperties->append(property);
|
||||
}
|
||||
|
||||
dbResults = TT_DB_OK;
|
||||
}
|
||||
else {
|
||||
dbResults = TT_DB_ERR_ILLEGAL_PROPERTY;
|
||||
}
|
||||
|
||||
return dbResults;
|
||||
}
|
||||
|
||||
_Tt_db_results
|
||||
_Tt_db_object::setProperties (const _Tt_db_property_list_ptr &properties)
|
||||
{
|
||||
// Replace the old properties with the new list
|
||||
dbObjectProperties = properties;
|
||||
|
||||
return dbResults;
|
||||
}
|
||||
|
||||
_Tt_db_results
|
||||
_Tt_db_object::addProperty (const _Tt_db_property_ptr &property,
|
||||
bool_t unique)
|
||||
{
|
||||
if (property->name.len()) {
|
||||
bool_t found = FALSE;
|
||||
|
||||
// See if a property with the same name exists in the cache
|
||||
_Tt_db_property_list_cursor properties_cursor(dbObjectProperties);
|
||||
while (properties_cursor.next()) {
|
||||
if (properties_cursor->name == property->name) {
|
||||
found = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If a property with the same name exists...
|
||||
if (found) {
|
||||
_Tt_string_list_cursor values_cursor(property->values);
|
||||
|
||||
// If a unique property name-value combinations are to be added...
|
||||
if (unique) {
|
||||
_Tt_string_list_cursor cache_values_cursor(properties_cursor->values);
|
||||
|
||||
// Loop through the values to be added
|
||||
while (values_cursor.next()) {
|
||||
cache_values_cursor.reset();
|
||||
|
||||
// Compare versus values already in the cache
|
||||
bool_t is_unique = TRUE;
|
||||
while (cache_values_cursor.next()) {
|
||||
if (*cache_values_cursor == *values_cursor) {
|
||||
is_unique = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// If unique, append the value to the cache values
|
||||
if (is_unique) {
|
||||
properties_cursor->values->append(*values_cursor);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Else uniqueness is not a requirement...
|
||||
else {
|
||||
while (values_cursor.next()) {
|
||||
properties_cursor->values->append(*values_cursor);
|
||||
}
|
||||
}
|
||||
|
||||
dbResults = TT_DB_OK;
|
||||
}
|
||||
else {
|
||||
dbObjectProperties->append(property);
|
||||
dbResults = TT_DB_OK;
|
||||
}
|
||||
}
|
||||
else {
|
||||
dbResults = TT_DB_ERR_ILLEGAL_PROPERTY;
|
||||
}
|
||||
|
||||
return dbResults;
|
||||
}
|
||||
|
||||
_Tt_db_results
|
||||
_Tt_db_object::deleteProperty (const _Tt_db_property_ptr &property)
|
||||
{
|
||||
if (isObjectInDatabase()) {
|
||||
setCurrentDBAccess();
|
||||
|
||||
// Delete the property on the database immediately and refresh
|
||||
// the cache with the latest and greatest. If the cache level
|
||||
// here is not as high as the cache level in the DB, then the
|
||||
// delete will fail.
|
||||
dbResults =
|
||||
dbObjectDatabase->deleteObjectProperty(dbObjectID,
|
||||
property,
|
||||
dbObjectProperties,
|
||||
dbObjectPropertiesCacheLevel);
|
||||
}
|
||||
else {
|
||||
dbResults = TT_DB_ERR_NO_SUCH_OBJECT;
|
||||
}
|
||||
|
||||
return processDBResults();
|
||||
}
|
||||
|
||||
_Tt_db_property_ptr _Tt_db_object::getProperty (const _Tt_string &name)
|
||||
{
|
||||
_Tt_db_property_ptr property;
|
||||
|
||||
if (name.len()) {
|
||||
bool_t found = FALSE;
|
||||
_Tt_db_property_list_cursor properties_cursor(dbObjectProperties);
|
||||
|
||||
// See if a property matches the specified name
|
||||
while (properties_cursor.next()) {
|
||||
if (properties_cursor->name == name) {
|
||||
found = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (found) {
|
||||
property = *properties_cursor;
|
||||
dbResults = TT_DB_OK;
|
||||
}
|
||||
else {
|
||||
dbResults = TT_DB_ERR_NO_SUCH_PROPERTY;
|
||||
}
|
||||
}
|
||||
else {
|
||||
dbResults = TT_DB_ERR_ILLEGAL_PROPERTY;
|
||||
}
|
||||
|
||||
return property;
|
||||
}
|
||||
|
||||
_Tt_db_property_list_ptr _Tt_db_object::getProperties ()
|
||||
{
|
||||
dbResults = TT_DB_OK;
|
||||
return dbObjectProperties;
|
||||
}
|
||||
|
||||
_Tt_db_results _Tt_db_object::setType (const _Tt_string &type)
|
||||
{
|
||||
if (!isObjectInDatabase()) {
|
||||
dbObjectType = type;
|
||||
dbResults = TT_DB_OK;
|
||||
}
|
||||
else {
|
||||
dbResults = TT_DB_ERR_OTYPE_ALREADY_SET;
|
||||
}
|
||||
|
||||
return dbResults;
|
||||
}
|
||||
|
||||
_Tt_string _Tt_db_object::getType ()
|
||||
{
|
||||
if (!dbObjectType.len() && isObjectInDatabase()) {
|
||||
setCurrentDBAccess();
|
||||
dbResults = dbObjectDatabase->getObjectType(dbObjectID, dbObjectType);
|
||||
}
|
||||
else {
|
||||
dbResults = TT_DB_OK;
|
||||
}
|
||||
|
||||
dbResults = processDBResults();
|
||||
return dbObjectType;
|
||||
}
|
||||
|
||||
_Tt_string _Tt_db_object::getFile ()
|
||||
{
|
||||
if (isObjectInDatabase()) {
|
||||
setCurrentDBAccess();
|
||||
dbResults = dbObjectDatabase->getObjectFile(dbObjectID, dbObjectFile);
|
||||
}
|
||||
else {
|
||||
dbResults = TT_DB_OK;
|
||||
}
|
||||
|
||||
dbResults = processDBResults();
|
||||
return dbObjectFile;
|
||||
}
|
||||
|
||||
_Tt_db_results _Tt_db_object::setAccess (const _Tt_db_access_ptr &access)
|
||||
{
|
||||
dbObjectAccess = access;
|
||||
|
||||
if (isObjectInDatabase()) {
|
||||
setCurrentDBAccess();
|
||||
dbResults = dbObjectDatabase->setObjectAccess(dbObjectID, dbObjectAccess);
|
||||
}
|
||||
else {
|
||||
dbResults = TT_DB_OK;
|
||||
}
|
||||
|
||||
return processDBResults();
|
||||
}
|
||||
|
||||
_Tt_db_access_ptr _Tt_db_object::getAccess ()
|
||||
{
|
||||
if (isObjectInDatabase()) {
|
||||
setCurrentDBAccess();
|
||||
dbResults = dbObjectDatabase->getObjectAccess(dbObjectID, dbObjectAccess);
|
||||
}
|
||||
else {
|
||||
dbResults = TT_DB_OK;
|
||||
}
|
||||
|
||||
dbResults = processDBResults();
|
||||
return dbObjectAccess;
|
||||
}
|
||||
|
||||
_Tt_string _Tt_db_object::getObjectKey () const
|
||||
{
|
||||
_Tt_string key_string;
|
||||
|
||||
if (dbObjectID.len()) {
|
||||
key_string = _tt_db_objid_to_key(dbObjectID);
|
||||
}
|
||||
|
||||
return key_string;
|
||||
}
|
||||
|
||||
_Tt_db_results
|
||||
_Tt_db_object::createMemoryObject (const _Tt_string &file,
|
||||
const _Tt_string& keystr)
|
||||
{
|
||||
_Tt_string local_file;
|
||||
_Tt_string partition;
|
||||
|
||||
dbObjectID = (char *)NULL;
|
||||
dbResults = _tt_db_network_path(file,
|
||||
local_file,
|
||||
dbObjectHostname,
|
||||
partition,
|
||||
dbObjectFile);
|
||||
|
||||
if (dbResults == TT_DB_OK) {
|
||||
// Create a key for the new object,
|
||||
// or use the passed-in one if present
|
||||
_Tt_db_key_ptr key;
|
||||
if (keystr.len()) {
|
||||
key = new _Tt_db_key(keystr);
|
||||
}
|
||||
else {
|
||||
key = new _Tt_db_key();
|
||||
}
|
||||
|
||||
dbObjectID = _tt_db_create_objid(key, "NFS",
|
||||
dbObjectHostname, partition);
|
||||
}
|
||||
|
||||
return dbResults;
|
||||
}
|
||||
|
||||
void _Tt_db_object::getDBObjectHostnameFromID ()
|
||||
{
|
||||
if (dbObjectID.len()) {
|
||||
_Tt_string objid_string = dbObjectID;
|
||||
_Tt_string temp_string;
|
||||
|
||||
// Get rid of the file system type
|
||||
objid_string = objid_string.split(':', temp_string);
|
||||
if (objid_string.len() && temp_string.len()) {
|
||||
objid_string = objid_string.split(':', temp_string);
|
||||
}
|
||||
|
||||
// Get the hostname
|
||||
if (objid_string.len() && temp_string.len()) {
|
||||
objid_string = objid_string.split(':', dbObjectHostname);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_Tt_db_results _Tt_db_object::createDBObject ()
|
||||
{
|
||||
if (dbObjectID.len()) {
|
||||
if (dbObjectType.len()) {
|
||||
dbObjectDatabase = dbHostnameGlobalMapRef.getDB(dbObjectHostname,
|
||||
dbObjectHostname,
|
||||
dbResults);
|
||||
|
||||
if (!dbObjectDatabase.is_null()) {
|
||||
setCurrentDBAccess();
|
||||
dbResults =
|
||||
dbObjectDatabase->createObject (dbObjectFile,
|
||||
dbObjectID,
|
||||
dbObjectType,
|
||||
dbObjectProperties,
|
||||
dbObjectAccess,
|
||||
dbObjectPropertiesCacheLevel);
|
||||
|
||||
dbObjectPropertiesCacheLevel = -1;
|
||||
|
||||
if (dbResults == TT_DB_OK) {
|
||||
dbResults = internalRefresh ();
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
dbResults = TT_DB_ERR_NO_OTYPE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
dbResults = TT_DB_ERR_ILLEGAL_OBJECT;
|
||||
}
|
||||
|
||||
return dbResults;
|
||||
}
|
||||
|
||||
_Tt_db_results _Tt_db_object::setObjectID (const _Tt_string &new_objid)
|
||||
{
|
||||
dbObjectID = new_objid;
|
||||
getDBObjectHostnameFromID();
|
||||
|
||||
dbResults = (isObjectInDatabase(TRUE) ? TT_DB_OK :
|
||||
TT_DB_ERR_NO_SUCH_OBJECT);
|
||||
return dbResults;
|
||||
}
|
||||
|
||||
_Tt_string
|
||||
_Tt_db_object::makeEquivalentObjectID (const _Tt_string &hostname,
|
||||
const _Tt_string &partition)
|
||||
{
|
||||
_Tt_string new_objid = _tt_db_objid_to_key(dbObjectID);
|
||||
new_objid = new_objid.cat(":NFS");
|
||||
new_objid = new_objid.cat(":").cat(hostname);
|
||||
new_objid = new_objid.cat(":").cat(partition);
|
||||
return new_objid;
|
||||
}
|
||||
|
||||
bool_t _Tt_db_object::isObjectInDatabase (bool_t force)
|
||||
{
|
||||
_Tt_string forward_pointer;
|
||||
|
||||
if ((!checkedDatabase || force) && dbObjectHostname.len()) {
|
||||
// Get the DB connection for this objects DB host
|
||||
dbObjectDatabase = dbHostnameGlobalMapRef.getDB(dbObjectHostname,
|
||||
dbObjectHostname,
|
||||
dbResults);
|
||||
if (!dbObjectDatabase.is_null()) {
|
||||
setCurrentDBAccess();
|
||||
|
||||
// See if the object is in the actual database and also check for
|
||||
// a forward pointer
|
||||
_Tt_string forward_pointer;
|
||||
dbResults = dbObjectDatabase->isObjectInDatabase(dbObjectID,
|
||||
forward_pointer);
|
||||
}
|
||||
|
||||
// Either a failure or a forward pointer...
|
||||
if (dbResults != TT_DB_OK) {
|
||||
if (dbResults == TT_DB_ERR_NO_SUCH_OBJECT) {
|
||||
dbHostnameGlobalMapRef.removeDB(dbObjectHostname);
|
||||
dbObjectDatabase = (_Tt_db_client *)NULL;
|
||||
dbResults = TT_DB_OK;
|
||||
}
|
||||
else if (dbResults == TT_DB_WRN_FORWARD_POINTER) {
|
||||
// Change this objects ID to the forward pointer. The "setObjectID"
|
||||
// member function will call "isObjectInDatabase" again and the
|
||||
// forward pointer chain will eventually resolve to the final
|
||||
// resting place of the object.
|
||||
dbResults = setObjectID(forward_pointer);
|
||||
forwardPointerFlag = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
checkedDatabase = TRUE;
|
||||
}
|
||||
|
||||
return (dbObjectDatabase.is_null() ? FALSE : TRUE);
|
||||
}
|
||||
|
||||
_Tt_db_results _Tt_db_object::internalRefresh ()
|
||||
{
|
||||
setCurrentDBAccess ();
|
||||
dbResults =
|
||||
dbObjectDatabase->getObjectProperties(dbObjectID,
|
||||
dbObjectPropertiesCacheLevel,
|
||||
dbObjectProperties);
|
||||
|
||||
if (dbResults == TT_DB_OK) {
|
||||
dbResults = dbObjectDatabase->getObjectAccess(dbObjectID, dbObjectAccess);
|
||||
}
|
||||
|
||||
if (dbResults == TT_DB_OK) {
|
||||
dbResults = dbObjectDatabase->getObjectType(dbObjectID, dbObjectType);
|
||||
}
|
||||
|
||||
return dbResults;
|
||||
}
|
||||
|
||||
_Tt_db_results _Tt_db_object::processDBResults ()
|
||||
{
|
||||
// If an RPC fails, assume the DB server went down and attemp to
|
||||
// reconnect to it
|
||||
if ((dbResults == TT_DB_ERR_DB_CONNECTION_FAILED) ||
|
||||
(dbResults == TT_DB_ERR_RPC_CONNECTION_FAILED)) {
|
||||
if (!dbObjectDatabase.is_null()) {
|
||||
dbHostnameGlobalMapRef.removeDB(dbObjectHostname);
|
||||
dbObjectDatabase = dbHostnameGlobalMapRef.getDB(dbObjectHostname,
|
||||
dbObjectHostname,
|
||||
dbResults);
|
||||
|
||||
}
|
||||
}
|
||||
// Else if the results were OK, but the forward pointer flag was set,
|
||||
// return TT_WRN_FORWARD_POINTER
|
||||
else if ((dbResults == TT_DB_OK) && forwardPointerFlag) {
|
||||
forwardPointerFlag = FALSE;
|
||||
dbResults = TT_DB_WRN_FORWARD_POINTER;
|
||||
}
|
||||
|
||||
return dbResults;
|
||||
}
|
||||
177
cde/lib/tt/lib/db/tt_db_object.h
Normal file
177
cde/lib/tt/lib/db/tt_db_object.h
Normal file
@@ -0,0 +1,177 @@
|
||||
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
|
||||
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
|
||||
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
|
||||
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
|
||||
/*%% $XConsortium: tt_db_object.h /main/3 1995/10/23 10:03:53 rswiston $ */
|
||||
/*
|
||||
* tt_db_object.h - Declare the TT DB server object class. This class defines the
|
||||
* object properties interface to the DB server.
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#ifndef _TT_DB_OBJECT_H
|
||||
#define _TT_DB_OBJECT_H
|
||||
|
||||
#include "util/tt_object.h"
|
||||
#include "util/tt_string.h"
|
||||
#include "db/tt_db_file.h"
|
||||
#include "db/tt_db_hostname_global_map_ref.h"
|
||||
#include "db/tt_db_access_utils.h"
|
||||
#include "db/tt_db_property_utils.h"
|
||||
|
||||
class _Tt_db_object : public _Tt_object {
|
||||
public:
|
||||
// Instantiates a _Tt_object without any connection to an existing
|
||||
// spec or the database.
|
||||
_Tt_db_object ();
|
||||
|
||||
// If the specified ID is an existing spec in the database, then
|
||||
// the database is connected to and the spec is loaded into memory.
|
||||
_Tt_db_object (const _Tt_string &objid);
|
||||
|
||||
~_Tt_db_object ();
|
||||
|
||||
// Sets and gets the access mode of this object spec.
|
||||
void setCurrentAccess (const _Tt_db_access_ptr &access);
|
||||
_Tt_db_access_ptr getCurrentAccess () const;
|
||||
|
||||
// Creates the in memory version of the object spec and returns the
|
||||
// new object ID.
|
||||
_Tt_string create (const _Tt_string &file);
|
||||
_Tt_string create (const _Tt_string &file, const _Tt_string &key);
|
||||
|
||||
// Writes the spec to the database.
|
||||
_Tt_db_results write ();
|
||||
|
||||
// Refreshes the properties in memory with whatever is currently out
|
||||
// in the database.
|
||||
_Tt_db_results refresh ();
|
||||
|
||||
// Removes the spec from the database and/or memory and leaves the specified
|
||||
// forward pointer in its place.
|
||||
_Tt_db_results remove ();
|
||||
_Tt_db_results remove (const _Tt_string &forward_pointer);
|
||||
|
||||
// Copys the object spec to the new file
|
||||
_Tt_string copy (const _Tt_string &new_file);
|
||||
|
||||
// Moves the object spec to the new file. After the move is done,
|
||||
// this object actually contains the information of the new location.
|
||||
// However, to prevent any weird race conditions due to someone else
|
||||
// doing a move shortly after this move, it is best to just instantiate
|
||||
// a new _Tt_db_object with the new objid.
|
||||
_Tt_string move (const _Tt_string &new_file);
|
||||
|
||||
// Writes the specified object property to memory. All values of the
|
||||
// the object property with the same name are overwritten. If the value of
|
||||
// the property is empty, this deletes all properties with the same name
|
||||
// from the database.
|
||||
_Tt_db_results setProperty (const _Tt_db_property_ptr &property);
|
||||
|
||||
// Writes the specified object properties to memory. All values of
|
||||
// the object properties with the same names are overwritten. If the value
|
||||
// of some of the properties are empty, this deletes all properties with the
|
||||
// same name from the database.
|
||||
_Tt_db_results setProperties (const _Tt_db_property_list_ptr &properties);
|
||||
|
||||
// Adds an object property to the list of values of the object property
|
||||
// with the same name in memory. If the property does not already exist,
|
||||
// then the property is created. If the "unique" argument is TRUE, then
|
||||
// the property name and value combination is guaranteed to be unique
|
||||
// and will not be added to the list of values if the combination already
|
||||
// exists.
|
||||
_Tt_db_results addProperty (const _Tt_db_property_ptr &property,
|
||||
bool_t unique=FALSE);
|
||||
|
||||
// Deletes the object property value with the same name and value from the
|
||||
// DB. If the value is left empty, then all values of the property are
|
||||
// deleted. The deletion is not cached. The deletion is immediately
|
||||
// executed on disk.
|
||||
_Tt_db_results deleteProperty (const _Tt_db_property_ptr &property);
|
||||
|
||||
// Gets the values of the object property with the specified name from the
|
||||
// memory cache. If the property does not exist in memory, then the value
|
||||
// is obtained from the DB.
|
||||
_Tt_db_property_ptr getProperty (const _Tt_string &name);
|
||||
|
||||
// Gets a list of all of the object properties currently written to the DB.
|
||||
// If the object has never been written to the DB, then an error is returned.
|
||||
_Tt_db_property_list_ptr getProperties ();
|
||||
|
||||
// Sets and gets the otype of the specified object.
|
||||
_Tt_db_results setType (const _Tt_string &otype);
|
||||
_Tt_string getType ();
|
||||
|
||||
// Gets the file of the object.
|
||||
_Tt_string getFile ();
|
||||
|
||||
// Sets and gets the access mode of the specified object.
|
||||
_Tt_db_results setAccess (const _Tt_db_access_ptr &access);
|
||||
_Tt_db_access_ptr getAccess ();
|
||||
|
||||
// Returns the object ID of this object.
|
||||
const _Tt_string& getObjectID () const
|
||||
{
|
||||
return dbObjectID;
|
||||
}
|
||||
|
||||
// Returns the key porition of this object's object ID.
|
||||
_Tt_string getObjectKey () const;
|
||||
|
||||
// Gets the results of the last database operation made with this object.
|
||||
_Tt_db_results getDBResults () const
|
||||
{
|
||||
return dbResults;
|
||||
}
|
||||
|
||||
private:
|
||||
bool_t checkedDatabase;
|
||||
_Tt_db_hostname_global_map_ref dbHostnameGlobalMapRef;
|
||||
_Tt_db_access_ptr dbObjectAccess;
|
||||
_Tt_db_access_ptr dbObjectCurrentAccess;
|
||||
_Tt_db_client_ptr dbObjectDatabase;
|
||||
_Tt_string dbObjectFile;
|
||||
_Tt_string dbObjectHostname;
|
||||
_Tt_string dbObjectID;
|
||||
_Tt_db_property_list_ptr dbObjectProperties;
|
||||
int dbObjectPropertiesCacheLevel;
|
||||
_Tt_string dbObjectType;
|
||||
_Tt_db_results dbResults;
|
||||
bool_t forwardPointerFlag;
|
||||
bool_t memoryObjectCreated;
|
||||
|
||||
void setTtDBObjectDefaults ();
|
||||
_Tt_db_results createMemoryObject (const _Tt_string&, const _Tt_string&);
|
||||
void getDBObjectHostnameFromID ();
|
||||
_Tt_db_results createDBObject ();
|
||||
|
||||
//
|
||||
// Sets the internal object ID to a new ID and checks to see if the
|
||||
// object is in the database.
|
||||
//
|
||||
_Tt_db_results setObjectID (const _Tt_string&);
|
||||
|
||||
_Tt_string makeEquivalentObjectID (const _Tt_string&,
|
||||
const _Tt_string&);
|
||||
bool_t isObjectInDatabase (bool_t force = FALSE);
|
||||
_Tt_db_results internalRefresh ();
|
||||
|
||||
//
|
||||
// Does some special results processing for any public member functions
|
||||
// that do some database server operations. It should be used to get
|
||||
// the final results for all such member functions. Member functions
|
||||
// that are not public or that only work on the memory copy of the
|
||||
// object should not call processDBResults.
|
||||
//
|
||||
_Tt_db_results processDBResults ();
|
||||
|
||||
void setCurrentDBAccess ()
|
||||
{
|
||||
if (!dbObjectDatabase.is_null()) {
|
||||
dbObjectDatabase->setCurrentAccess(dbObjectCurrentAccess);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#endif // _TT_DB_OBJECT_H
|
||||
15
cde/lib/tt/lib/db/tt_db_object_utils.C
Normal file
15
cde/lib/tt/lib/db/tt_db_object_utils.C
Normal file
@@ -0,0 +1,15 @@
|
||||
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
//%% (c) Copyright 1993, 1994 Novell, Inc.
|
||||
//%% $XConsortium: tt_db_object_utils.C /main/3 1995/10/23 10:04:00 rswiston $
|
||||
/*
|
||||
* tt_db_object_utils.cc - Defines the _Tt_db_object utilities.
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#include "db/tt_db_object_utils.h"
|
||||
|
||||
implement_list_of(_Tt_db_object)
|
||||
implement_table_of(_Tt_db_object)
|
||||
21
cde/lib/tt/lib/db/tt_db_object_utils.h
Normal file
21
cde/lib/tt/lib/db/tt_db_object_utils.h
Normal file
@@ -0,0 +1,21 @@
|
||||
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
|
||||
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
|
||||
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
|
||||
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
|
||||
/*%% $XConsortium: tt_db_object_utils.h /main/3 1995/10/23 10:04:07 rswiston $ */
|
||||
/*
|
||||
* tt_db_object_utils.h - Declare the _Tt_db_object utilities.
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#ifndef _TT_DB_OBJECT_UTILS_H
|
||||
#define _TT_DB_OBJECT_UTILS_H
|
||||
|
||||
#include "util/tt_table.h"
|
||||
#include "db/tt_db_object.h"
|
||||
|
||||
declare_list_of(_Tt_db_object)
|
||||
declare_table_of(_Tt_db_object)
|
||||
|
||||
#endif // _TT_DB_OBJECT_UTILS_H
|
||||
24
cde/lib/tt/lib/db/tt_db_objid_to_key.C
Normal file
24
cde/lib/tt/lib/db/tt_db_objid_to_key.C
Normal file
@@ -0,0 +1,24 @@
|
||||
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
//%% (c) Copyright 1993, 1994 Novell, Inc.
|
||||
//%% $XConsortium: tt_db_objid_to_key.C /main/3 1995/10/23 10:04:15 rswiston $
|
||||
/*
|
||||
* Tool Talk Utility - tt_db_objid_to_key.cc
|
||||
*
|
||||
* Copyright (c) 1990 by Sun Microsystems, Inc.
|
||||
*
|
||||
* Object ID to object key conversion routine.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "db/tt_db_objid_to_key.h"
|
||||
|
||||
_Tt_string _tt_db_objid_to_key (const _Tt_string &objid)
|
||||
{
|
||||
_Tt_string key;
|
||||
_Tt_string temp = objid;
|
||||
|
||||
(void)temp.split(':', key);
|
||||
return key;
|
||||
}
|
||||
22
cde/lib/tt/lib/db/tt_db_objid_to_key.h
Normal file
22
cde/lib/tt/lib/db/tt_db_objid_to_key.h
Normal file
@@ -0,0 +1,22 @@
|
||||
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
|
||||
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
|
||||
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
|
||||
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
|
||||
/*%% $XConsortium: tt_db_objid_to_key.h /main/3 1995/10/23 10:04:22 rswiston $ */
|
||||
/*
|
||||
* Tool Talk Utility - tt_db_objid_to_key.h
|
||||
*
|
||||
* Copyright (c) 1990 by Sun Microsystems, Inc*
|
||||
*
|
||||
* Extern declarations for object ID to key conversion routine.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _TT_DB_OBJID_TO_KEY_H
|
||||
#define _TT_DB_OBJID_TO_KEY_H
|
||||
|
||||
#include <util/tt_string.h>
|
||||
|
||||
extern _Tt_string _tt_db_objid_to_key (const _Tt_string &objid);
|
||||
|
||||
#endif /* _TT_DB_OBJID_TO_KEY */
|
||||
45
cde/lib/tt/lib/db/tt_db_property.C
Normal file
45
cde/lib/tt/lib/db/tt_db_property.C
Normal file
@@ -0,0 +1,45 @@
|
||||
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
//%% (c) Copyright 1993, 1994 Novell, Inc.
|
||||
//%% $XConsortium: tt_db_property.C /main/3 1995/10/23 10:04:30 rswiston $
|
||||
/*
|
||||
* tt_db_property.cc - Implement the _Tt_db_property class
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
|
||||
#include "db/tt_db_property.h"
|
||||
|
||||
// Constructors and destructors
|
||||
|
||||
_Tt_db_property::
|
||||
_Tt_db_property ()
|
||||
{
|
||||
values = new _Tt_string_list;
|
||||
}
|
||||
|
||||
_Tt_db_property::
|
||||
~_Tt_db_property ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// whether a property is empty
|
||||
|
||||
int _Tt_db_property::
|
||||
is_empty() const
|
||||
// consider a property to be empty if it's values list is empty, or if all
|
||||
// entries in the values list are NULL content member tt_strings.
|
||||
{
|
||||
if (values->is_empty()) return TRUE; // empty values list case
|
||||
|
||||
// check the list for all NULL content member tt_strings
|
||||
_Tt_string_list_cursor values_cursor(values);
|
||||
while (values_cursor.next()) if (*values_cursor != (char*)NULL) return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
47
cde/lib/tt/lib/db/tt_db_property.h
Normal file
47
cde/lib/tt/lib/db/tt_db_property.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
|
||||
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
|
||||
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
|
||||
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
|
||||
/*%% $XConsortium: tt_db_property.h /main/3 1995/10/23 10:04:37 rswiston $ */
|
||||
/*
|
||||
* tt_db_property.h - Defines the TT DB server property class.
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#ifndef _TT_DB_PROPERTY_H
|
||||
#define _TT_DB_PROPERTY_H
|
||||
|
||||
#include "util/tt_object.h"
|
||||
#include "util/tt_string.h"
|
||||
|
||||
class _Tt_db_property : public _Tt_object {
|
||||
public:
|
||||
_Tt_db_property ();
|
||||
~_Tt_db_property ();
|
||||
int is_empty() const;
|
||||
|
||||
_Tt_string name;
|
||||
_Tt_string_list_ptr values;
|
||||
|
||||
void print (FILE *file=stdout)
|
||||
{
|
||||
fprintf(file, "Property Name: %s\n", ((char *)name ?
|
||||
(char *)name : "(NULL)"));
|
||||
|
||||
if (!values.is_null()) {
|
||||
fprintf(file, "Number of Values: %d\n", values->count());
|
||||
|
||||
int i = 0;
|
||||
_Tt_string_list_cursor values_cursor(values);
|
||||
while (values_cursor.next()) {
|
||||
if (*values_cursor != (char*)NULL)
|
||||
fprintf(file, "Property Value #%d: %s\n", i, (char *)*values_cursor);
|
||||
else fprintf(file, "Property Value #%d: NULL\n", i);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#endif // _TT_DB_PROPERTY_H
|
||||
18
cde/lib/tt/lib/db/tt_db_property_utils.C
Normal file
18
cde/lib/tt/lib/db/tt_db_property_utils.C
Normal file
@@ -0,0 +1,18 @@
|
||||
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
//%% (c) Copyright 1993, 1994 Novell, Inc.
|
||||
//%% $XConsortium: tt_db_property_utils.C /main/3 1995/10/23 10:04:44 rswiston $
|
||||
/* @(#)tt_db_property_utils.C 1.6 @(#)
|
||||
* tt_db_property_utils.cc - Defines the _Tt_db_property utilities.
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#include "db/tt_db_property.h"
|
||||
#include "db/tt_db_property_utils.h"
|
||||
|
||||
implement_list_of(_Tt_db_property)
|
||||
|
||||
|
||||
|
||||
20
cde/lib/tt/lib/db/tt_db_property_utils.h
Normal file
20
cde/lib/tt/lib/db/tt_db_property_utils.h
Normal file
@@ -0,0 +1,20 @@
|
||||
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
|
||||
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
|
||||
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
|
||||
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
|
||||
/*%% $XConsortium: tt_db_property_utils.h /main/3 1995/10/23 10:04:53 rswiston $ */
|
||||
/* @(#)tt_db_property_utils.h 1.5 @(#)
|
||||
* tt_db_property_utils.h - Declares the _Tt_db_property class utilities.
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#ifndef _TT_DB_PROPERTY_UTILS_H
|
||||
#define _TT_DB_PROPERTY_UTILS_H
|
||||
|
||||
#include "util/tt_list.h"
|
||||
class _Tt_db_property;
|
||||
|
||||
declare_list_of(_Tt_db_property)
|
||||
|
||||
#endif // _TT_DB_PROPERTY_UTILS_H
|
||||
59
cde/lib/tt/lib/db/tt_db_results.h
Normal file
59
cde/lib/tt/lib/db/tt_db_results.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
|
||||
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
|
||||
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
|
||||
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
|
||||
/*%% $XConsortium: tt_db_results.h /main/3 1995/10/23 10:05:01 rswiston $ */
|
||||
/*
|
||||
* tt_db_results.h - Defines the result values that may be returned by
|
||||
* a TT DB server operation.
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#ifndef _TT_DB_RESULTS_H
|
||||
#define _TT_DB_RESULTS_H
|
||||
|
||||
enum _Tt_db_results {
|
||||
TT_DB_OK = 0,
|
||||
TT_DB_WRN_FORWARD_POINTER = 1,
|
||||
TT_DB_WRN_SAME_OBJECT_ID = 2,
|
||||
TT_DB_ERR_DB_CONNECTION_FAILED = 3,
|
||||
TT_DB_ERR_DB_OPEN_FAILED = 4,
|
||||
TT_DB_ERR_DB_LOCKED = 5,
|
||||
TT_DB_ERR_RPC_CONNECTION_FAILED = 6,
|
||||
TT_DB_ERR_RPC_FAILED = 7,
|
||||
TT_DB_ERR_CORRUPT_DB = 8,
|
||||
TT_DB_ERR_DISK_FULL = 9,
|
||||
TT_DB_ERR_ILLEGAL_FILE = 10,
|
||||
TT_DB_ERR_ILLEGAL_OBJECT = 11,
|
||||
TT_DB_ERR_ILLEGAL_PROPERTY = 12,
|
||||
TT_DB_ERR_ILLEGAL_MESSAGE = 13,
|
||||
TT_DB_ERR_SAME_FILE = 14,
|
||||
TT_DB_ERR_SAME_OBJECT = 15,
|
||||
TT_DB_ERR_FILE_EXISTS = 16,
|
||||
TT_DB_ERR_OBJECT_EXISTS = 17,
|
||||
TT_DB_ERR_NO_SUCH_FILE = 18,
|
||||
TT_DB_ERR_NO_SUCH_OBJECT = 19,
|
||||
TT_DB_ERR_NO_SUCH_PROPERTY = 20,
|
||||
TT_DB_ERR_ACCESS_DENIED = 21,
|
||||
TT_DB_ERR_NO_ACCESS_INFO = 22,
|
||||
TT_DB_ERR_NO_OTYPE = 23,
|
||||
TT_DB_ERR_OTYPE_ALREADY_SET = 24,
|
||||
TT_DB_ERR_UPDATE_CONFLICT = 25,
|
||||
TT_DB_ERR_PROPS_CACHE_ERROR = 26,
|
||||
|
||||
// new for filename mapping. We get this
|
||||
// if there is a mild version
|
||||
// mismatch, e.g. a libtt talking to
|
||||
// a dbserver which doesn't support filename
|
||||
// mapping, and one of the new
|
||||
// API calls is used. This is relatively
|
||||
// benign, just let the user know that
|
||||
// his call is unimplemented in the system
|
||||
// he/she tried to contact, so the user can
|
||||
// differentiate this from the case where the
|
||||
// RPC call failed due to the server not running, etc.
|
||||
TT_DB_ERR_RPC_UNIMP = 27
|
||||
};
|
||||
|
||||
#endif // _TT_DB_RESULTS_H
|
||||
104
cde/lib/tt/lib/db/tt_db_rpc_message_routines.C
Normal file
104
cde/lib/tt/lib/db/tt_db_rpc_message_routines.C
Normal file
@@ -0,0 +1,104 @@
|
||||
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
//%% (c) Copyright 1993, 1994 Novell, Inc.
|
||||
//%% $XConsortium: tt_db_rpc_message_routines.C /main/3 1995/10/23 10:05:09 rswiston $
|
||||
/* @(#)tt_db_rpc_message_routines.C 1.10 94/11/17
|
||||
* tt_db_rpc_message_routines.cc - Defines routines for converting TT
|
||||
* message classes to RPC arguments.
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#include "mp/mp_message.h"
|
||||
#include "util/tt_string.h"
|
||||
#include "util/tt_xdr_utils.h"
|
||||
#include "db/tt_db_rpc_message_routines.h"
|
||||
|
||||
// If this file is being compiled with -g, then DEFINE_NEW_AND_DELETE
|
||||
// must be defined in order to prevent a dependency on the libC library.
|
||||
// The dependency is due to the fact that cfront generates an extern
|
||||
// reference to vec_new and vec_delete if it sees any access to arrays
|
||||
// of calsses or structures. In the case of this file, tt_message_list
|
||||
// contains a pointer to a structure that causes the references to be
|
||||
// generated.
|
||||
#ifdef DEFINE_NEW_AND_DELETE
|
||||
extern "C" {
|
||||
void *__vec_new (void *, int , int , void *)
|
||||
{ return (void *)NULL; }
|
||||
|
||||
void __vec_delete (void *, int , int , void *, int , int )
|
||||
{}
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
_tt_get_rpc_message (const _tt_message &rpc_message,
|
||||
_Tt_message_ptr &message)
|
||||
{
|
||||
message = (_Tt_message *)NULL;
|
||||
|
||||
if (rpc_message.body.body_len) {
|
||||
XDR xdrs;
|
||||
|
||||
xdrmem_create(&xdrs,
|
||||
rpc_message.body.body_val,
|
||||
(u_int)rpc_message.body.body_len,
|
||||
XDR_DECODE);
|
||||
|
||||
message = new _Tt_message;
|
||||
(void)message->xdr(&xdrs);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_tt_get_rpc_messages (const _tt_message_list &rpc_messages,
|
||||
_Tt_message_list_ptr &messages)
|
||||
{
|
||||
messages = (_Tt_message_list *)NULL;
|
||||
|
||||
if (rpc_messages.messages_len) {
|
||||
messages = new _Tt_message_list;
|
||||
|
||||
for (int i=0; i < rpc_messages.messages_len; i++) {
|
||||
_Tt_message_ptr message_ptr;
|
||||
|
||||
_tt_get_rpc_message(rpc_messages.messages_val [i],
|
||||
message_ptr);
|
||||
(void)messages->append(message_ptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_Tt_db_results
|
||||
_tt_set_rpc_message (const _Tt_message_ptr &message,
|
||||
_tt_message &rpc_message)
|
||||
{
|
||||
if (message.is_null()) {
|
||||
rpc_message.body.body_val = (char *)NULL;
|
||||
rpc_message.body.body_len = 0;
|
||||
} else {
|
||||
XDR xdrs;
|
||||
_Tt_xdr_size_stream xdrsz;
|
||||
u_int length;
|
||||
|
||||
if (!message->xdr((XDR *)xdrsz)) {
|
||||
return TT_DB_ERR_ILLEGAL_MESSAGE;
|
||||
} else {
|
||||
length = (u_int)xdrsz.getsize();
|
||||
}
|
||||
|
||||
_Tt_string temp_string((int)length);
|
||||
xdrmem_create(&xdrs, (char *)temp_string, length, XDR_ENCODE);
|
||||
if (!message->xdr(&xdrs)) {
|
||||
return TT_DB_ERR_ILLEGAL_MESSAGE;
|
||||
}
|
||||
|
||||
rpc_message.body.body_val = (char *)malloc(length+1);
|
||||
(void)memcpy(rpc_message.body.body_val, (char *)temp_string, length);
|
||||
rpc_message.body.body_val[length] = '\0';
|
||||
rpc_message.body.body_len = length;
|
||||
}
|
||||
|
||||
return TT_DB_OK;
|
||||
}
|
||||
25
cde/lib/tt/lib/db/tt_db_rpc_message_routines.h
Normal file
25
cde/lib/tt/lib/db/tt_db_rpc_message_routines.h
Normal file
@@ -0,0 +1,25 @@
|
||||
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
|
||||
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
|
||||
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
|
||||
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
|
||||
/*%% $XConsortium: tt_db_rpc_message_routines.h /main/3 1995/10/23 10:05:17 rswiston $ */
|
||||
/*
|
||||
* tt_db_rpc_message_routines.h - Declares routines for converting TT
|
||||
* message classes to RPC arguments.
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#ifndef _TT_DB_RPC_MESSAGE_ROUTINES_H
|
||||
#define _TT_DB_RPC_MESSAGE_ROUTINES_H
|
||||
|
||||
#include "mp/mp_message_utils.h"
|
||||
#include "db/db_server.h"
|
||||
|
||||
extern void _tt_get_rpc_message (const _tt_message&, _Tt_message_ptr&);
|
||||
extern void _tt_get_rpc_messages (const _tt_message_list&,
|
||||
_Tt_message_list_ptr&);
|
||||
extern _Tt_db_results _tt_set_rpc_message (const _Tt_message_ptr&,
|
||||
_tt_message&);
|
||||
|
||||
#endif /* _TT_DB_RPC_MESSAGE_ROUTINES_H */
|
||||
260
cde/lib/tt/lib/db/tt_db_rpc_routines.C
Normal file
260
cde/lib/tt/lib/db/tt_db_rpc_routines.C
Normal file
@@ -0,0 +1,260 @@
|
||||
//%% (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
//%% (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
//%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
//%% (c) Copyright 1993, 1994 Novell, Inc.
|
||||
//%% $XConsortium: tt_db_rpc_routines.C /main/3 1995/10/23 10:05:24 rswiston $
|
||||
/* %W @(#)
|
||||
* tt_db_rpc_routines.cc - Defines routines for converting TT DB classes to
|
||||
* RPC arguments.
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "util/tt_string.h"
|
||||
#include "util/tt_xdr_utils.h"
|
||||
#include "db/tt_db_rpc_routines.h"
|
||||
#include "db/tt_db_access.h"
|
||||
#include "db/tt_db_property.h"
|
||||
|
||||
// If this file is being compiled with -g, then DEFINE_NEW_AND_DELETE
|
||||
// must be defined in order to prevent a dependency on the libC library.
|
||||
// The dependency is due to the fact that cfront generates an extern
|
||||
// reference to vec_new and vec_delete if it sees any access to arrays
|
||||
// of calsses or structures. In the case of this file, tt_message_list
|
||||
// contains a pointer to a structure that causes the references to be
|
||||
// generated.
|
||||
#ifdef DEFINE_NEW_AND_DELETE
|
||||
extern "C" {
|
||||
void *__nw__FUi (unsigned int)
|
||||
{ return (void *)NULL; }
|
||||
|
||||
void __dl__FPv (void *)
|
||||
{}
|
||||
|
||||
void *__vec_new (void *, int, int, void *)
|
||||
{ return (void *)NULL; }
|
||||
|
||||
void __vec_delete (void *, int, int, void *, int, int)
|
||||
{}
|
||||
}
|
||||
#endif
|
||||
|
||||
void _tt_free_rpc_message (const _tt_message &rpc_message)
|
||||
{
|
||||
if (rpc_message.body.body_val) {
|
||||
free(rpc_message.body.body_val);
|
||||
}
|
||||
}
|
||||
|
||||
void _tt_free_rpc_messages (const _tt_message_list &rpc_messages)
|
||||
{
|
||||
if (rpc_messages.messages_val) {
|
||||
for (int i=0; i < rpc_messages.messages_len; i++) {
|
||||
_tt_free_rpc_message(rpc_messages.messages_val [i]);
|
||||
}
|
||||
|
||||
free((MALLOCTYPE *)rpc_messages.messages_val);
|
||||
}
|
||||
}
|
||||
|
||||
void _tt_free_rpc_strings (const _tt_string_list &rpc_strings)
|
||||
{
|
||||
if (rpc_strings.values_val) {
|
||||
for (int i=0; i < rpc_strings.values_len; i++) {
|
||||
if (rpc_strings.values_val [i].value) {
|
||||
free(rpc_strings.values_val [i].value);
|
||||
}
|
||||
}
|
||||
|
||||
free((MALLOCTYPE *)rpc_strings.values_val);
|
||||
}
|
||||
}
|
||||
|
||||
void _tt_free_rpc_property (const _tt_property &rpc_prop)
|
||||
{
|
||||
if (rpc_prop.name) {
|
||||
free(rpc_prop.name);
|
||||
}
|
||||
|
||||
if (rpc_prop.values.values_val) {
|
||||
for (int i=0; i < rpc_prop.values.values_len; i++) {
|
||||
if (rpc_prop.values.values_val [i].value.value_val) {
|
||||
free(rpc_prop.values.values_val [i].value.value_val);
|
||||
}
|
||||
}
|
||||
|
||||
free((MALLOCTYPE *)rpc_prop.values.values_val);
|
||||
}
|
||||
}
|
||||
|
||||
void _tt_free_rpc_properties (const _tt_property_list &rpc_props)
|
||||
{
|
||||
if (rpc_props.properties_val) {
|
||||
for (int i=0; i < rpc_props.properties_len; i++) {
|
||||
_tt_free_rpc_property(rpc_props.properties_val [i]);
|
||||
}
|
||||
|
||||
free((MALLOCTYPE *)rpc_props.properties_val);
|
||||
}
|
||||
}
|
||||
|
||||
void _tt_get_rpc_access (const _tt_access &rpc_access,
|
||||
_Tt_db_access_ptr &access)
|
||||
{
|
||||
access = new _Tt_db_access;
|
||||
access->user = rpc_access.user;
|
||||
access->group = rpc_access.group;
|
||||
access->mode = rpc_access.mode;
|
||||
}
|
||||
|
||||
void _tt_get_rpc_strings (const _tt_string_list &rpc_strings,
|
||||
_Tt_string_list_ptr &strings)
|
||||
{
|
||||
strings = new _Tt_string_list;
|
||||
|
||||
if (rpc_strings.values_len) {
|
||||
for (int i=0; i < rpc_strings.values_len; i++) {
|
||||
(void)strings->append(_Tt_string(rpc_strings.values_val [i].value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void _tt_get_rpc_property (const _tt_property &rpc_prop,
|
||||
_Tt_db_property_ptr &prop)
|
||||
{
|
||||
prop = new _Tt_db_property;
|
||||
|
||||
if (rpc_prop.name) {
|
||||
prop->name = rpc_prop.name;
|
||||
|
||||
for (int i=0; i < rpc_prop.values.values_len; i++) {
|
||||
int prop_value_length = rpc_prop.values.values_val [i].value.value_len;
|
||||
if (prop_value_length) {
|
||||
_Tt_string prop_value(prop_value_length);
|
||||
|
||||
memcpy((char *)prop_value,
|
||||
rpc_prop.values.values_val [i].value.value_val,
|
||||
prop_value_length);
|
||||
(void)prop->values->append(prop_value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void _tt_get_rpc_properties (const _tt_property_list &rpc_props,
|
||||
_Tt_db_property_list_ptr &props)
|
||||
{
|
||||
props = new _Tt_db_property_list;
|
||||
|
||||
if (rpc_props.properties_len) {
|
||||
for (int i=0; i < rpc_props.properties_len; i++) {
|
||||
_Tt_db_property_ptr prop;
|
||||
|
||||
_tt_get_rpc_property (rpc_props.properties_val [i], prop);
|
||||
if (prop->name.len()) {
|
||||
(void)props->append(prop);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void _tt_set_rpc_access (const _Tt_db_access_ptr &access,
|
||||
_tt_access &rpc_access)
|
||||
{
|
||||
if (access.is_null()) {
|
||||
rpc_access.user = (uid_t)-1;
|
||||
rpc_access.group = (gid_t)-1;
|
||||
rpc_access.mode = (mode_t)-1;
|
||||
}
|
||||
else {
|
||||
rpc_access.user = access->user;
|
||||
rpc_access.group = access->group;
|
||||
rpc_access.mode = access->mode;
|
||||
}
|
||||
}
|
||||
|
||||
void _tt_set_rpc_strings (const _Tt_string_list_ptr &strings,
|
||||
_tt_string_list &rpc_strings)
|
||||
{
|
||||
if (strings.is_null()) {
|
||||
rpc_strings.values_val = (_tt_string *)NULL;
|
||||
rpc_strings.values_len = 0;
|
||||
}
|
||||
else {
|
||||
int strings_count = strings->count ();
|
||||
|
||||
rpc_strings.values_val = (_tt_string *)
|
||||
malloc(sizeof(_tt_string) * strings_count);
|
||||
rpc_strings.values_len = strings_count;
|
||||
|
||||
int i = 0;
|
||||
_Tt_string_list_cursor strings_cursor(strings);
|
||||
while (strings_cursor.next()) {
|
||||
rpc_strings.values_val [i].value = strdup((char *)*strings_cursor);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void _tt_set_rpc_property (const _Tt_db_property_ptr &prop,
|
||||
_tt_property &rpc_prop)
|
||||
{
|
||||
if (prop.is_null()) {
|
||||
rpc_prop.name = (char *)NULL;
|
||||
rpc_prop.values.values_len = 0;
|
||||
rpc_prop.values.values_val = (_tt_property_value *)NULL;
|
||||
}
|
||||
else {
|
||||
int prop_values_count = prop->values->count ();
|
||||
|
||||
rpc_prop.name = strdup((char *)prop->name);
|
||||
rpc_prop.values.values_len = prop_values_count;
|
||||
rpc_prop.values.values_val = (_tt_property_value *)
|
||||
malloc (sizeof(_tt_property_value) *
|
||||
prop_values_count);
|
||||
|
||||
int i = 0;
|
||||
_Tt_string_list_cursor values_cursor(prop->values);
|
||||
while (values_cursor.next()) {
|
||||
_tt_property_value *temp_value = rpc_prop.values.values_val + i;
|
||||
int temp_value_length = (*values_cursor).len();
|
||||
|
||||
temp_value->value.value_val = (char *)malloc(temp_value_length+1);
|
||||
temp_value->value.value_len = temp_value_length;
|
||||
(void)memcpy (temp_value->value.value_val,
|
||||
(char *)*values_cursor,
|
||||
temp_value_length);
|
||||
temp_value->value.value_val[temp_value_length] = '\0';
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void _tt_set_rpc_properties (const _Tt_db_property_list_ptr &props,
|
||||
_tt_property_list &rpc_props)
|
||||
{
|
||||
if (props.is_null()) {
|
||||
rpc_props.properties_len = 0;
|
||||
rpc_props.properties_val = (_tt_property *)NULL;
|
||||
}
|
||||
else {
|
||||
int props_count = rpc_props.properties_len = props->count();
|
||||
|
||||
if (!props_count) {
|
||||
rpc_props.properties_val = (_tt_property *)NULL;
|
||||
}
|
||||
else {
|
||||
rpc_props.properties_val = (_tt_property *)
|
||||
malloc(sizeof(_tt_property) * props_count);
|
||||
|
||||
int i = 0;
|
||||
_Tt_db_property_list_cursor props_cursor(props);
|
||||
while (props_cursor.next()) {
|
||||
_tt_set_rpc_property (*props_cursor, rpc_props.properties_val [i]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
38
cde/lib/tt/lib/db/tt_db_rpc_routines.h
Normal file
38
cde/lib/tt/lib/db/tt_db_rpc_routines.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
|
||||
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
|
||||
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
|
||||
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
|
||||
/*%% $XConsortium: tt_db_rpc_routines.h /main/3 1995/10/23 10:05:32 rswiston $ */
|
||||
/*
|
||||
* tt_db_rpc_routines.h - Declares routines for converting TT DB classes to
|
||||
* RPC arguments.
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#ifndef _TT_DB_RPC_ROUTINES_H
|
||||
#define _TT_DB_RPC_ROUTINES_H
|
||||
|
||||
#include "util/tt_string.h"
|
||||
#include "db/db_server.h"
|
||||
#include "db/tt_db_property_utils.h"
|
||||
#include "db/tt_db_access_utils.h"
|
||||
#include "db/tt_db_results.h"
|
||||
|
||||
extern void _tt_free_rpc_message (const _tt_message&);
|
||||
extern void _tt_free_rpc_messages (const _tt_message_list&);
|
||||
extern void _tt_free_rpc_strings (const _tt_string_list&);
|
||||
extern void _tt_free_rpc_property (const _tt_property&);
|
||||
extern void _tt_free_rpc_properties (const _tt_property_list&);
|
||||
extern void _tt_get_rpc_access (const _tt_access&, _Tt_db_access_ptr&);
|
||||
extern void _tt_get_rpc_strings (const _tt_string_list&, _Tt_string_list_ptr&);
|
||||
extern void _tt_get_rpc_property (const _tt_property&, _Tt_db_property_ptr&);
|
||||
extern void _tt_get_rpc_properties (const _tt_property_list&,
|
||||
_Tt_db_property_list_ptr&);
|
||||
extern void _tt_set_rpc_access (const _Tt_db_access_ptr&, _tt_access&);
|
||||
extern void _tt_set_rpc_strings (const _Tt_string_list_ptr&, _tt_string_list&);
|
||||
extern void _tt_set_rpc_property (const _Tt_db_property_ptr&, _tt_property&);
|
||||
extern void _tt_set_rpc_properties (const _Tt_db_property_list_ptr&,
|
||||
_tt_property_list&);
|
||||
|
||||
#endif /* _TT_DB_RPC_ROUTINES_H */
|
||||
1966
cde/lib/tt/lib/db/tt_old_db.C
Normal file
1966
cde/lib/tt/lib/db/tt_old_db.C
Normal file
File diff suppressed because it is too large
Load Diff
318
cde/lib/tt/lib/db/tt_old_db.h
Normal file
318
cde/lib/tt/lib/db/tt_old_db.h
Normal file
@@ -0,0 +1,318 @@
|
||||
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
|
||||
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
|
||||
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
|
||||
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
|
||||
/*%% $XConsortium: tt_old_db.h /main/3 1995/10/23 10:05:54 rswiston $ */
|
||||
/*
|
||||
*
|
||||
* @(#)tt_old_db.h 1.4 30 Jul 1993
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*/
|
||||
/*
|
||||
* tt_old_db.h - Defines the old TT DB server database. This class
|
||||
* represents the actual data model used to store
|
||||
* ToolTalk databse information in the old DB server.
|
||||
* This is used purely for compatibility with the
|
||||
* old DB server.
|
||||
*
|
||||
* The actual database schema is the following:
|
||||
*
|
||||
* Table Fields Length Description
|
||||
* ----- ------ ------ -----------
|
||||
* docoid_path Contains the names of all
|
||||
* the that have properties
|
||||
* or objects in the db.
|
||||
*
|
||||
* File Key TT_DB_KEY_LENGTH Unique key that is used
|
||||
* to search (16 bytes) for
|
||||
* a file's properties and
|
||||
* objects in the other
|
||||
* tables.
|
||||
*
|
||||
* File Name Variable up to The name of the file.
|
||||
* MAXPATHLEN (256)
|
||||
*
|
||||
* Table Fields Length Description
|
||||
* ----- ------ ------ -----------
|
||||
* oid_container Contains all of the
|
||||
* mappings of file keys to
|
||||
* the keys of the objects
|
||||
* in the file.
|
||||
*
|
||||
* Object Key TT_DB_KEY_LENGTH Unique key of an object
|
||||
* in a file.
|
||||
*
|
||||
* File Key TT_DB_KEY_LENGTH Unique key of a file.
|
||||
*
|
||||
* Table Fields Length Description
|
||||
* ----- ------ ------ -----------
|
||||
* oid_prop Contains all of the
|
||||
* properties corresponding
|
||||
* to files and objects in
|
||||
* the db.
|
||||
*
|
||||
* Key TT_DB_KEY_LENGTH Unique key of an object
|
||||
* or a file.
|
||||
*
|
||||
* Property Name TT_DB_PROP_NAME_LENGTH The name of a file or
|
||||
* object property.
|
||||
*
|
||||
* Property Variable up to The value of the property.
|
||||
* ISMAXRECLEN.
|
||||
*
|
||||
* Table Fields Length Description
|
||||
* ----- ------ ------ -----------
|
||||
* oid_access Contains the access
|
||||
* privileges of all the
|
||||
* files and objects in
|
||||
* the db.
|
||||
*
|
||||
* Key TT_DB_KEY_LENGTH Unique key of an object
|
||||
* or a file.
|
||||
*
|
||||
* User ID XDR_SHORT_SIZE The user ID of the owner
|
||||
* of the object or file.
|
||||
*
|
||||
* Group ID XDR_SHORT_SIZE The group ID of the
|
||||
* object or file.
|
||||
*
|
||||
* Mode XDR_SHORT_SIZE The access mode of the
|
||||
* object or file.
|
||||
*
|
||||
* Copyright (c) 1992 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#ifndef _TT_OLD_DB_H
|
||||
#define _TT_OLD_DB_H
|
||||
|
||||
#include "util/tt_object.h"
|
||||
#include "util/tt_string.h"
|
||||
#include "db/tt_client_isam_file_utils.h"
|
||||
#include "db/tt_db_access_utils.h"
|
||||
#include "db/tt_db_client_utils.h"
|
||||
#include "db/tt_db_key_utils.h"
|
||||
#include "db/tt_db_property_utils.h"
|
||||
#include "db/tt_db_results.h"
|
||||
|
||||
class _Tt_old_db : public _Tt_object {
|
||||
public:
|
||||
// Empty constructor for _utils
|
||||
_Tt_old_db ();
|
||||
|
||||
_Tt_old_db (const _Tt_string&,
|
||||
const _Tt_db_client_ptr&);
|
||||
~_Tt_old_db ();
|
||||
|
||||
// Returns the partition this DB object is connected to
|
||||
_Tt_string getPartition () const
|
||||
{
|
||||
_Tt_string partition = (char *)dbPartition;
|
||||
return partition;
|
||||
}
|
||||
|
||||
// Creates a file in the TT DB and sets the access permissions of the
|
||||
// file.
|
||||
_Tt_db_results createFile (const _Tt_string &file,
|
||||
const _Tt_db_access_ptr &access);
|
||||
|
||||
// Creates an object in the TT DB. If the file is not in the database,
|
||||
// the file will be created using the "file_access" argument to specify
|
||||
// its access permission. If no file is specified, this is a special
|
||||
// object being created just to hold a forward pointer.
|
||||
_Tt_db_results createObject (const _Tt_string &file,
|
||||
const _Tt_string &objid,
|
||||
const _Tt_db_access_ptr &object_access,
|
||||
const _Tt_db_access_ptr &file_access);
|
||||
|
||||
_Tt_db_results removeFile (const _Tt_string &file,
|
||||
const _Tt_db_access_ptr &access);
|
||||
|
||||
_Tt_db_results removeObject (const _Tt_string &objid,
|
||||
const _Tt_db_access_ptr &access);
|
||||
|
||||
_Tt_db_results moveFile (const _Tt_string &file,
|
||||
const _Tt_string &new_file,
|
||||
const _Tt_db_access_ptr &access);
|
||||
|
||||
_Tt_db_results setFileProperty (const _Tt_string &file,
|
||||
const _Tt_db_property_ptr &property,
|
||||
const _Tt_db_access_ptr &access);
|
||||
|
||||
_Tt_db_results setFileProperties (const _Tt_string &file,
|
||||
const _Tt_db_property_list_ptr &properties,
|
||||
const _Tt_db_access_ptr &access);
|
||||
|
||||
_Tt_db_results addFileProperty (const _Tt_string &file,
|
||||
const _Tt_db_property_ptr &property,
|
||||
bool_t unique,
|
||||
const _Tt_db_access_ptr &access);
|
||||
|
||||
_Tt_db_results deleteFileProperty (const _Tt_string &file,
|
||||
const _Tt_db_property_ptr &property,
|
||||
const _Tt_db_access_ptr &access);
|
||||
|
||||
_Tt_db_results deleteFileProperties (const _Tt_string &file,
|
||||
const _Tt_db_access_ptr &access);
|
||||
|
||||
_Tt_db_results getFileProperty (const _Tt_string &file,
|
||||
const _Tt_string &name,
|
||||
const _Tt_db_access_ptr &access,
|
||||
_Tt_db_property_ptr &property);
|
||||
|
||||
_Tt_db_results getFileProperties (const _Tt_string &file,
|
||||
const _Tt_db_access_ptr &access,
|
||||
_Tt_db_property_list_ptr &properties);
|
||||
|
||||
_Tt_db_results getFileObjects (const _Tt_string &file,
|
||||
const _Tt_db_access_ptr &access,
|
||||
_Tt_string_list_ptr &objids);
|
||||
|
||||
_Tt_db_results deleteFileObjects (const _Tt_string &file,
|
||||
const _Tt_db_access_ptr &access);
|
||||
|
||||
_Tt_db_results setFileFile (const _Tt_string &file,
|
||||
const _Tt_string &new_file,
|
||||
const _Tt_db_access_ptr &access);
|
||||
|
||||
// If the specified file is a directory, this returns all of the
|
||||
// file names stored in the database that are in the directory.
|
||||
// The file itself is also in the return list.
|
||||
_Tt_db_results getFileChildren (const _Tt_string &file,
|
||||
_Tt_string_list_ptr &children);
|
||||
|
||||
_Tt_db_results setFileAccess (const _Tt_string &file,
|
||||
const _Tt_db_access_ptr &new_access,
|
||||
const _Tt_db_access_ptr &access);
|
||||
|
||||
_Tt_db_results getFileAccess (const _Tt_string &file,
|
||||
const _Tt_db_access_ptr &access,
|
||||
_Tt_db_access_ptr ¤t_access);
|
||||
|
||||
_Tt_db_results setObjectProperty (const _Tt_string &objid,
|
||||
const _Tt_db_property_ptr &property,
|
||||
const _Tt_db_access_ptr &access);
|
||||
|
||||
_Tt_db_results
|
||||
setObjectProperties (const _Tt_string &objid,
|
||||
const _Tt_db_property_list_ptr &properties,
|
||||
const _Tt_db_access_ptr &access);
|
||||
|
||||
_Tt_db_results addObjectProperty (const _Tt_string &objid,
|
||||
const _Tt_db_property_ptr &property,
|
||||
bool_t unique,
|
||||
const _Tt_db_access_ptr &access);
|
||||
|
||||
_Tt_db_results deleteObjectProperty (const _Tt_string &objid,
|
||||
const _Tt_db_property_ptr &property,
|
||||
const _Tt_db_access_ptr &access);
|
||||
|
||||
_Tt_db_results deleteObjectProperties (const _Tt_string &objid,
|
||||
const _Tt_db_access_ptr &access);
|
||||
|
||||
_Tt_db_results getObjectProperty (const _Tt_string &objid,
|
||||
const _Tt_string &name,
|
||||
const _Tt_db_access_ptr &access,
|
||||
_Tt_db_property_ptr &property);
|
||||
|
||||
_Tt_db_results
|
||||
getObjectProperties (const _Tt_string &objid,
|
||||
const _Tt_db_access_ptr &access,
|
||||
_Tt_db_property_list_ptr &properties);
|
||||
|
||||
// Used to facilitate moving an object to a new file on the same
|
||||
// partition. The file specified must be on the partition this DB
|
||||
// server object is connected to. If the file is not in the database,
|
||||
// it will be created with the access permissions of the object.
|
||||
_Tt_db_results setObjectFile (const _Tt_string &objid,
|
||||
const _Tt_string &file,
|
||||
const _Tt_db_access_ptr &access);
|
||||
|
||||
_Tt_db_results getObjectFile (const _Tt_string &objid,
|
||||
const _Tt_db_access_ptr &access,
|
||||
_Tt_string &file);
|
||||
|
||||
_Tt_db_results setObjectAccess (const _Tt_string &objid,
|
||||
const _Tt_db_access_ptr &new_access,
|
||||
const _Tt_db_access_ptr &access);
|
||||
|
||||
_Tt_db_results getObjectAccess (const _Tt_string &objid,
|
||||
const _Tt_db_access_ptr &access,
|
||||
_Tt_db_access_ptr ¤t_access);
|
||||
|
||||
_Tt_db_results getDBResults () const
|
||||
{
|
||||
return dbResults;
|
||||
}
|
||||
|
||||
const _Tt_string &getLastFileAccessed () const
|
||||
{
|
||||
return dbLastFileAccessed;
|
||||
}
|
||||
|
||||
// Needed by addsession and delsession in _Tt_db_client
|
||||
_Tt_db_results getFileKey (const _Tt_string&, _Tt_string&);
|
||||
|
||||
// Needed by addsession, delsession and gettype in _Tt_db_client
|
||||
int propertyTableFD;
|
||||
|
||||
// Some of the keys are needed by _Tt_db_client for the addsession,
|
||||
// delsession and gettype functions. All of the keys have been made
|
||||
// public in case similar needs arise later.
|
||||
_Tt_client_isam_key_descriptor_ptr fileTableFileKey;
|
||||
_Tt_client_isam_key_descriptor_ptr fileTableFilePathKey;
|
||||
_Tt_client_isam_key_descriptor_ptr fileObjectMapFileKey;
|
||||
_Tt_client_isam_key_descriptor_ptr fileObjectMapObjectKey;
|
||||
_Tt_client_isam_key_descriptor_ptr propertyTablePropertyKey;
|
||||
_Tt_client_isam_key_descriptor_ptr accessTableKey;
|
||||
|
||||
private:
|
||||
_Tt_client_isam_file_ptr fileTable;
|
||||
_Tt_client_isam_file_ptr fileObjectMap;
|
||||
_Tt_client_isam_file_ptr propertyTable;
|
||||
_Tt_client_isam_file_ptr accessTable;
|
||||
|
||||
_Tt_string dbHostname;
|
||||
_Tt_string dbPartition;
|
||||
_Tt_db_results dbResults;
|
||||
_Tt_string dbLastFileAccessed;
|
||||
|
||||
void connectToDB (const _Tt_string&, const _Tt_db_client_ptr&);
|
||||
|
||||
_Tt_db_results verifyObjectAccess (const _Tt_string&,
|
||||
const _Tt_db_access_ptr&,
|
||||
bool_t=FALSE,
|
||||
bool_t=FALSE);
|
||||
_Tt_db_results verifyUserOnlyObjectAccess (const _Tt_string&,
|
||||
const _Tt_db_access_ptr&);
|
||||
_Tt_db_results verifyAccess (const _Tt_string&,
|
||||
const _Tt_db_access_ptr&,
|
||||
bool_t=FALSE,
|
||||
bool_t=FALSE);
|
||||
_Tt_string getObjectKey (const _Tt_string&);
|
||||
|
||||
_Tt_db_results setProperty (const _Tt_string&, const _Tt_db_property_ptr&);
|
||||
_Tt_db_results setProperties (const _Tt_string&,
|
||||
const _Tt_db_property_list_ptr&);
|
||||
_Tt_db_results addProperty (const _Tt_string&,
|
||||
const _Tt_db_property_ptr&,
|
||||
bool_t);
|
||||
_Tt_db_results deleteProperty (const _Tt_string&,
|
||||
const _Tt_db_property_ptr&);
|
||||
_Tt_db_results deleteProperties (const _Tt_string&,
|
||||
bool_t=FALSE);
|
||||
_Tt_db_results getProperty (const _Tt_string&,
|
||||
const _Tt_string&,
|
||||
_Tt_db_property_ptr&);
|
||||
_Tt_db_results getProperties (const _Tt_string&,
|
||||
_Tt_db_property_list_ptr&);
|
||||
_Tt_db_results setAccess (const _Tt_string&, const _Tt_db_access_ptr&);
|
||||
_Tt_db_results getAccess (const _Tt_string&, _Tt_db_access_ptr&);
|
||||
_Tt_db_results getFile (const _Tt_string&, _Tt_string&);
|
||||
|
||||
_Tt_db_results addPropertyValue (const _Tt_string&,
|
||||
const _Tt_string&,
|
||||
const _Tt_string&);
|
||||
};
|
||||
|
||||
#endif /* _TT_OLD_DB_H */
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user