Initial import of the CDE 2.1.30 sources from the Open Group.

This commit is contained in:
Peter Howkins
2012-03-10 18:21:40 +00:00
commit 83b6996daa
18978 changed files with 3945623 additions and 0 deletions

2
cde/lib/csa/EUSinclude Normal file
View File

@@ -0,0 +1,2 @@
#include <EUSCompat.h>

130
cde/lib/csa/Imakefile Normal file
View File

@@ -0,0 +1,130 @@
XCOMM $TOG: Imakefile /main/4 1998/03/19 19:01:27 mgreess $
#define DoNormalLib NormalLibCsa
#define DoSharedLib SharedLibCsa
#define DoDebugLib DebugLibCsa
#define DoProfileLib ProfileLibCsa
#define LibName csa
#define SoRev SOCSAREV
#define IncSubdir csa
#define HasSharedData NO
#include <Threads.tmpl>
INCLUDES = -I.
OSMAJORVERSION = OSMajorVersion
OSMINORVERSION = OSMinorVersion
DEFINES = -DRFC_MIME -DLINE_COUNT -DV2 -DOW_I18N -DSVR4 \
-DREL="$(OSMAJORVERSION)$(OSMINORVERSION)" \
-DRELMAJOR="$(OSMAJORVERSION)" -DRELMINOR="$(OSMINORVERSION)"
#ifdef SharedCsaReqs
REQUIREDLIBS = SharedCsaReqs
#endif
#ifdef SunArchitecture
EXTRA_DEFINES = -xstrconst -v -DSunOS=$(OSMAJORVERSION)$(OSMINORVERSION)
SHLIBLDFLAGS = -G -z text -z defs
#endif
#ifdef HPArchitecture
EXTRA_DEFINES = -DHPUX
#endif
HEADERS = csa.h
GENERATED_SRCS = agent_xdr.c cm_clnt.c reparser.c reparser.h \
rtable2_clnt.c rtable2_xdr.c rtable3_clnt.c rtable3_xdr.c \
rtable4_clnt.c rtable4_xdr.c
all::
includes:: $(GENERATED_SRCS)
depend:: $(GENERATED_SRCS)
SRCS = agent.c agent_xdr.c api.c \
appt4.c attr.c calendar.c \
cm_clnt.c cmcbxdr.c cmsdata.c \
cmxdr.c connection.c convert2-4.c \
convert3-4.c convert4-2.c convert4-3.c \
convert4-5.c convert5-4.c debug.c \
entry.c free.c hash.c \
iso8601.c laccess.c lutil.c \
match.c nametbl.c refree.c \
reparser.y rescan.c rpccalls.c \
rtable2_clnt.c rtable2_xdr.c rtable3_clnt.c \
rtable3_xdr.c rtable4_clnt.c rtable4_xdr.c \
table.c updateattrs.c xtclient.c \
ansi_c.c
OBJS = agent.o agent_xdr.o api.o \
appt4.o attr.o calendar.o \
cm_clnt.o cmcbxdr.o cmsdata.o \
cmxdr.o connection.o convert2-4.o \
convert3-4.o convert4-2.o convert4-3.o \
convert4-5.o convert5-4.o debug.o \
entry.o free.o hash.o \
iso8601.o laccess.o lutil.o \
match.o nametbl.o refree.o \
reparser.o rescan.o rpccalls.o \
rtable2_clnt.o rtable2_xdr.o rtable3_clnt.o \
rtable3_xdr.o rtable4_clnt.o rtable4_xdr.o \
table.o updateattrs.o xtclient.o \
ansi_c.o
#include <Library.tmpl>
includes:: agent.h
DependTarget()
.SUFFIXES: .y
.y.c:
$(YACC) -d $(YFLAGS) $<
sed -e s/yyparse/_DtCm_rule_parser/g -e s/yy/_DtCm_yy/g y.tab.c > $*.c
sed s/yy/_DtCm_yy/g y.tab.h > $*.h
$(RM) y.tab.c y.tab.h
reparser.o: reparser.c
rtable2_clnt.c rtable3_clnt.c rtable4_clnt.c cm_clnt.c:
$(RM) $@
cat EUSinclude > $@
rpcgen -l $(@:_clnt.c=.x) | sed -f namechange1.sed | sed -f namechange2.sed >> $@
rtable2_xdr.c rtable3_xdr.c rtable4_xdr.c agent_xdr.c:
$(RM) $@
cat EUSinclude > $(@:.x=_xdr.c)
rpcgen -c $(@:_xdr.c=.x) | sed -f namechange1.sed | sed -f namechange2.sed >> $(@:.x=_xdr.c)
rtable4_clnt.c rtable4_xdr.c: rtable4.h namechange1.sed namechange2.sed
rtable3_clnt.c rtable3_xdr.c: rtable3.h namechange1.sed namechange2.sed
rtable2_clnt.c rtable2_xdr.c: rtable3.h namechange1.sed namechange2.sed
agent_xdr.c agent.c: agent.h
#ifdef LinuxArchitecture
EXTRASED=sed -e 's/update_failed.*=.*1,.*/update_failed = 1/g' |
#else
EXTRASED=
#endif
agent.h:
$(RM) $@
cat agent.wrapbegin > agent.h
rpcgen -h agent.x | $(EXTRASED) \
sed -f namechange1.sed | \
sed -f namechange2.sed >> agent.h
cat agent.wrapend >> agent.h
.SUFFIXES: .x
clean::
$(RM) agent.h agent_xdr.c \
$(RM) cm_clnt.c \
reparser.c reparser.h \
rtable2_clnt.c rtable2_xdr.c \
rtable3_clnt.c rtable3_xdr.c \
rtable4_clnt.c rtable4_xdr.c

784
cde/lib/csa/agent.c Normal file
View File

@@ -0,0 +1,784 @@
/* $TOG: agent.c /main/2 1998/03/16 14:42:16 mgreess $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#include <EUSCompat.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <rpc/rpc.h>
#if defined(linux)
# include <sys/poll.h>
#else
# include <poll.h>
#endif
#if defined(SunOS) || defined(USL) || defined(__uxp__)
#include <netconfig.h>
#include <netdir.h>
#else
#include <sys/signal.h>
#include <sys/socket.h>
#include <sys/errno.h>
#endif /* SunOS || USL || __uxp__ */
#include <X11/Intrinsic.h>
#include "agent.h"
#include "cmcb.h"
#include "entry.h"
#include "debug.h"
#include "iso8601.h"
#include "free.h"
#include "misc.h"
/*
* callback info
* - contain update information from backend
*/
typedef struct cb_info {
int vers;
char *cal;
char *user;
int reason;
void *data;
struct cb_info *next;
} _CallbackInfo;
static _CallbackInfo *cb_head = NULL, *cb_tail = NULL;
u_long _DtCm_transient = 0;
static u_long prognum = 0x40000000;
static int mapped = 0;
/******************************************************************************
* forward declaration of static functions used within the file
******************************************************************************/
#if defined(SunOS) || defined(USL) || defined(__uxp__)
static u_long gettransient (u_long version);
#else
static u_long gettransient (int proto, u_long vers, int *sockp);
#endif
static void _DtCm_handle_callback();
static CSA_return_code _ConvertCallbackData(cmcb_update_callback_args *args,
_CallbackInfo **cbi);
static CSA_return_code _CopyAttributeNames(uint fnum, char **fnames,
CSA_uint32 *tnum, char ***tnames);
static boolean_t _ProcessV1Callback(_CallbackInfo *ptr);
static boolean_t _ProcessV2Callback(_CallbackInfo *ptr);
static void _FreeCallbackInfo(_CallbackInfo *ptr);
/*****************************************************************************
* extern functions used in the library
*****************************************************************************/
/*
* Register rpc service for server callback
*/
extern void
_DtCm_init_agent()
{
int s = RPC_ANYSOCK;
XtInputId id;
#if defined(SunOS) && SunOS < 55 || defined(USL) || defined(__uxp__)
extern boolean_t rpc_reg(const u_long, const u_long, const u_long,
const char *(*)(), const xdrproc_t, const xdrproc_t,
const char *);
#endif
#if defined(SunOS) || defined(USL)|| defined(__uxp__)
extern void (*sigset(int, void (*)(int)))(int);
#else
extern void (*sigset())();
#endif
/* locking candidate for MT-safe purpose */
if (mapped == 1)
return;
DP(("libdtcm: _DtCm_init_agent\n"));
#if defined(SunOS) || defined(USL) || defined(__uxp__)
(void)rpcb_unset(_DtCm_transient, AGENTVERS, NULL);
if ((_DtCm_transient = gettransient((u_long)1)) == 0) {
_DtCm_print_errmsg("Cannot get transient program number\n");
_DtCm_print_errmsg("Callback cannot be enabled.\n");
return;
}
/* register v1 callback */
if (rpc_reg(_DtCm_transient, AGENTVERS, update_callback,
(const char *(*)())_DtCm_update_callback_1, _DtCm_xdr_Table_Res_4,
_DtCm_xdr_Update_Status, "udp") == -1) {
_DtCm_print_errmsg("Cannot register v1 callback handler\n");
_DtCm_print_errmsg("Callback cannot be enabled.\n");
}
/* register v2 callback */
if (rpc_reg(_DtCm_transient, AGENTVERS_2, CMCB_UPDATE_CALLBACK,
(const char *(*)())cmcb_update_callback_2_svc,
xdr_cmcb_update_callback_args, xdr_void, "udp") == -1) {
_DtCm_print_errmsg("Cannot register v2 callback handler\n");
_DtCm_print_errmsg("Callback cannot be enabled.\n");
}
#else
(void)pmap_unset(_DtCm_transient, AGENTVERS);
if ((_DtCm_transient = gettransient(IPPROTO_UDP,(u_long)1, &s)) == 0) {
_DtCm_print_errmsg("Cannot get transient program number\n");
_DtCm_print_errmsg("Callback cannot be enabled.\n");
return;
}
if (registerrpc(_DtCm_transient, AGENTVERS, update_callback,
(char *(*)())_DtCm_update_callback_1, _DtCm_xdr_Table_Res_4,
_DtCm_xdr_Update_Status) == -1) {
_DtCm_print_errmsg("Cannot register v1 callback handler\n");
_DtCm_print_errmsg("Callback cannot be enabled.\n");
}
if (registerrpc(_DtCm_transient, AGENTVERS_2, CMCB_UPDATE_CALLBACK,
(char *(*)())cmcb_update_callback_2_svc,
xdr_cmcb_update_callback_args, xdr_void) == -1) {
_DtCm_print_errmsg("Cannot register v2 callback handler\n");
_DtCm_print_errmsg("Callback cannot be enabled.\n");
}
#endif /* SunOS || USL || __uxp__ */
/* locking candidate for MT-safe purpose */
mapped = 1;
}
/*
* Unregister with the rpc service.
*/
extern void
_DtCm_destroy_agent()
{
if (mapped == 0)
return;
DP(("libdtcm: _DtCm_destroy_agent\n"));
#if defined(SunOS) || defined(USL) || defined(__uxp__)
(void) rpcb_unset(_DtCm_transient, AGENTVERS, NULL);
(void) rpcb_unset(_DtCm_transient, AGENTVERS_2, NULL);
#else
(void) pmap_unset(_DtCm_transient, AGENTVERS);
(void) pmap_unset(_DtCm_transient, AGENTVERS_2);
#endif /* SunOS || USL || __uxp__ */
/* locking candidate for MT-safe purpose */
mapped = 0;
}
extern void
_DtCm_process_updates()
{
int i, j, nfd;
fd_set rpc_bits;
fd_mask fmask, *inbits;
struct pollfd pfd[FD_SETSIZE];
struct pollfd *p;
int last;
int do_rpc;
while (B_TRUE) {
rpc_bits = svc_fdset;
/* convert to pollfd structure */
inbits = rpc_bits.fds_bits;
p = pfd;
for (i = 0; i < FD_SETSIZE; i += NFDBITS) {
fmask = *inbits;
for (j = 0; fmask != 0 ; j++, fmask >>= 1) {
if (fmask & 0x1) {
p->fd = i + j;
if (p->fd >= FD_SETSIZE)
break;
p->events = POLLIN;
p++;
}
}
inbits++;
}
/* poll and return right away */
i = p - pfd;
nfd = poll(pfd, i, 0);
if (nfd <= 0)
/* done */
return;
/* if set, handle rpc calls */
/* convert back to fd_set structure */
last = -1;
do_rpc = 0;
FD_ZERO(&rpc_bits);
for (p = pfd; i-- > 0; p++) {
j = p->fd / NFDBITS;
if (j != last) {
inbits = &rpc_bits.fds_bits[j];
last = j;
}
if (p->revents & POLLIN) {
*inbits |= (1 << (p->fd % NFDBITS));
do_rpc = 1;
}
}
if (do_rpc)
svc_getreqset(&rpc_bits);
}
}
/*
* The server calls this routine when an update event occurs;
* It's job is to notify CM asynchronously that an
* update has occurred. It has to do it this
* way (i.e. raise a signal) because the client
* can't make an rpc call until this procedure call has
* returned to the server.
*/
Update_Status *
_DtCm_update_callback_1(Table_Res_4 *t, void *dummy)
{
static Update_Status status = update_succeeded;
_CallbackInfo *cbi;
DP(("agent.c: _DtCm_update_callback_1()\n"));
/*
* no point to save data for version 4 and before
* since the info from old backends does not contain
* calendar info
* so we just invoke all registered callback with no data
*/
if (cbi = (_CallbackInfo *)calloc(1, sizeof(_CallbackInfo))) {
cbi->vers = AGENTVERS;
if (cb_tail == NULL)
cb_head = cbi;
else
cb_tail->next = cbi;
cb_tail = cbi;
}
/* handle callback from backend */
_DtCm_handle_callback();
return (&status);
}
/*
* Handler for v2 callback protocol
*/
void *
cmcb_update_callback_2_svc(cmcb_update_callback_args *args, struct svc_req *d)
{
_CallbackInfo *cbi;
DP(("agent.c: cmcb_update_callback_2_svc()\n"));
if (args == NULL)
return (NULL);
if (_ConvertCallbackData(args, &cbi) == CSA_SUCCESS) {
cbi->vers = AGENTVERS_2;
if (cb_tail == NULL)
cb_head = cbi;
else
cb_tail->next = cbi;
cb_tail = cbi;
/* handle callback from backend */
_DtCm_handle_callback();
}
return (NULL);
}
/******************************************************************************
* static functions used within in the file
******************************************************************************/
/*
* get transient program number for callbacks.
*/
#if defined(SunOS) || defined(USL) || defined(__uxp__)
static u_long
gettransient (u_long version)
{
int stat;
struct nd_hostserv host = {HOST_SELF, "rpcbind"};
struct nd_addrlist *addrp;
struct netbuf *addr;
struct netconfig *netconf;
netconf = getnetconfigent("udp");
if (!netconf) {
DP(("(gettransient) getnetconfigent(udp) failed\n"));
freenetconfigent(netconf);
return 0;
}
stat = netdir_getbyname(netconf, &host, &addrp);
if (stat) {
DP(("(gettransient) netdir_getbyname failed\n"));
netdir_free(addrp, ND_ADDRLIST);
freenetconfigent(netconf);
return 0;
}
if (addrp->n_cnt < 1) {
DP(("(gettransient) netdir_getbyname - zero addresses\n"));
netdir_free(addrp, ND_ADDRLIST);
freenetconfigent(netconf);
return 0;
}
addr = addrp->n_addrs;
while (!rpcb_set(prognum++, version, netconf, addr))
continue;
netdir_free(addrp, ND_ADDRLIST);
freenetconfigent(netconf);
prognum--;
return prognum;
}
#else /* SunOS || USL || __uxp__ */
static u_long
gettransient (int proto, u_long vers, int *sockp)
{
int s, len, socktype;
struct sockaddr_in addr;
switch (proto) {
case IPPROTO_UDP:
socktype = SOCK_DGRAM;
break;
case IPPROTO_TCP:
socktype = SOCK_STREAM;
break;
default:
DP(("unknown protocol type\n"));
return 0;
}
if (*sockp == RPC_ANYSOCK) {
if ((s = socket(AF_INET, socktype, 0)) < 0) {
perror("socket");
return 0;
}
*sockp = s;
} else
s = *sockp;
addr.sin_addr.s_addr = 0;
addr.sin_family = AF_INET;
addr.sin_port = 0;
len = sizeof(addr);
if (bind(s, (struct sockaddr *)&addr, len) != 0) {
perror("bind");
return 0;
}
if (getsockname(s, (struct sockaddr *)&addr, &len) < 0) {
perror("getsockname");
return 0;
}
while (!pmap_set(prognum++, vers, proto, ntohs(addr.sin_port)))
continue;
return (prognum-1);
}
#endif /* not SunOS || USL || __uxp__ */
static void
_DtCm_handle_callback()
{
_CallbackInfo *ptr, *prev;
Calendar *cal;
_DtCmCallbackEntry *cb;
boolean_t keep = B_FALSE;
DP(("agent.c: _DtCm_handle_callback()\n"));
for (ptr = cb_head, prev = NULL; ptr != NULL; ) {
/* we only handle version 1 and version 2 */
if (ptr->vers == AGENTVERS)
keep = _ProcessV1Callback(ptr);
else
keep = _ProcessV2Callback(ptr);
if (!keep) {
if (prev == NULL)
cb_head = ptr->next;
else
prev->next = ptr->next;
_FreeCallbackInfo(ptr);
} else {
prev = ptr;
}
ptr = ptr->next;
}
cb_tail = prev;
}
static CSA_return_code
_ConvertCallbackData(cmcb_update_callback_args *args, _CallbackInfo **cbi)
{
_CallbackInfo *ncbi;
CSA_calendar_user *user;
CSA_logon_callback_data *ldata;
CSA_calendar_deleted_callback_data *rdata;
CSA_calendar_attr_update_callback_data *cdata;
CSA_add_entry_callback_data *adata;
CSA_delete_entry_callback_data *ddata;
CSA_update_entry_callback_data *udata;
char timebuf[BUFSIZ];
if ((ncbi = (_CallbackInfo *)calloc(1, sizeof(_CallbackInfo))) == NULL)
return (CSA_E_INSUFFICIENT_MEMORY);
if (args->calendar && (ncbi->cal = strdup(args->calendar)) == NULL) {
free(ncbi);
return (CSA_E_INSUFFICIENT_MEMORY);
}
if (args->user && (ncbi->user = strdup(args->user)) == NULL) {
_FreeCallbackInfo(ncbi);
return (CSA_E_INSUFFICIENT_MEMORY);
}
if ((user = (CSA_calendar_user *)calloc(1, sizeof(CSA_calendar_user)))
== NULL) {
_FreeCallbackInfo(ncbi);
return (CSA_E_INSUFFICIENT_MEMORY);
} else
user->user_name = ncbi->user;
ncbi->reason = args->data.reason;
switch (ncbi->reason) {
case CSA_CB_CALENDAR_LOGON:
if ((ldata = (CSA_logon_callback_data *)calloc(1,
sizeof(CSA_logon_callback_data))) == NULL) {
free(user);
_FreeCallbackInfo(ncbi);
return (CSA_E_INSUFFICIENT_MEMORY);
}
ldata->user = user;
ncbi->data = (void *)ldata;
break;
case CSA_CB_CALENDAR_DELETED:
if ((rdata = (CSA_calendar_deleted_callback_data *)calloc(1,
sizeof(CSA_calendar_deleted_callback_data))) == NULL) {
free(user);
_FreeCallbackInfo(ncbi);
return (CSA_E_INSUFFICIENT_MEMORY);
}
rdata->user = user;
ncbi->data = (void *)rdata;
break;
case CSA_CB_CALENDAR_ATTRIBUTE_UPDATED:
if ((cdata = (CSA_calendar_attr_update_callback_data *)
calloc(1, sizeof(
CSA_calendar_attr_update_callback_data))) == NULL) {
free(user);
_FreeCallbackInfo(ncbi);
return (CSA_E_INSUFFICIENT_MEMORY);
}
cdata->user = user;
ncbi->data = (void *)cdata;
if (_CopyAttributeNames(args->data.data.cdata->num_names,
args->data.data.cdata->names, &cdata->number_attributes,
&cdata->attribute_names)) {
_FreeCallbackInfo(ncbi);
return (CSA_E_INSUFFICIENT_MEMORY);
}
break;
case CSA_CB_ENTRY_ADDED:
if ((adata = (CSA_add_entry_callback_data *)calloc(1,
sizeof(CSA_add_entry_callback_data))) == NULL) {
free(user);
_FreeCallbackInfo(ncbi);
return (CSA_E_INSUFFICIENT_MEMORY);
}
adata->user = user;
ncbi->data = (void *)adata;
if (args->data.data.adata->id && (adata->added_entry_id.data =
(unsigned char *)strdup(args->data.data.adata->id))
== NULL) {
_FreeCallbackInfo(ncbi);
return (CSA_E_INSUFFICIENT_MEMORY);
} else
adata->added_entry_id.size =
strlen((char *)adata->added_entry_id.data);
break;
case CSA_CB_ENTRY_DELETED:
if ((ddata = (CSA_delete_entry_callback_data *)calloc(1,
sizeof(CSA_delete_entry_callback_data))) == NULL) {
free(user);
_FreeCallbackInfo(ncbi);
return (CSA_E_INSUFFICIENT_MEMORY);
}
ddata->user = user;
ncbi->data = (void *)ddata;
if (args->data.data.ddata->id && (ddata->deleted_entry_id.data =
(unsigned char *)strdup(args->data.data.ddata->id))
== NULL) {
_FreeCallbackInfo(ncbi);
return (CSA_E_INSUFFICIENT_MEMORY);
} else
ddata->deleted_entry_id.size =
strlen((char *)ddata->deleted_entry_id.data);
_csa_tick_to_iso8601(args->data.data.ddata->time, timebuf);
if ((ddata->date_and_time = strdup(timebuf)) == NULL) {
_FreeCallbackInfo(ncbi);
return (CSA_E_INSUFFICIENT_MEMORY);
}
ddata->scope = args->data.data.ddata->scope;
break;
case CSA_CB_ENTRY_UPDATED:
if ((udata = (CSA_update_entry_callback_data *)calloc(1,
sizeof(CSA_update_entry_callback_data))) == NULL) {
free(user);
_FreeCallbackInfo(ncbi);
return (CSA_E_INSUFFICIENT_MEMORY);
}
udata->user = user;
ncbi->data = (void *)udata;
if (args->data.data.udata->newid && (udata->new_entry_id.data =
(unsigned char *)strdup(args->data.data.udata->newid))
== NULL) {
_FreeCallbackInfo(ncbi);
return (CSA_E_INSUFFICIENT_MEMORY);
} else
udata->new_entry_id.size =
strlen((char *)udata->new_entry_id.data);
if (args->data.data.udata->oldid && (udata->old_entry_id.data =
(unsigned char *)strdup(args->data.data.udata->oldid))
== NULL) {
_FreeCallbackInfo(ncbi);
return (CSA_E_INSUFFICIENT_MEMORY);
} else
udata->old_entry_id.size =
strlen((char *)udata->old_entry_id.data);
_csa_tick_to_iso8601(args->data.data.udata->time, timebuf);
if ((udata->date_and_time = strdup(timebuf)) == NULL) {
_FreeCallbackInfo(ncbi);
return (CSA_E_INSUFFICIENT_MEMORY);
}
udata->scope = args->data.data.udata->scope;
break;
}
*cbi = ncbi;
return (CSA_SUCCESS);
}
static CSA_return_code
_CopyAttributeNames(uint fnum, char **fnames, CSA_uint32 *tnum, char ***tnames)
{
int i;
char **nnames;
if (fnum == 0) {
*tnum = 0;
*tnames = NULL;
return (CSA_SUCCESS);
}
if ((nnames = calloc(1, sizeof(char *) * fnum)) == NULL)
return (CSA_E_INSUFFICIENT_MEMORY);
for (i = 0; i < fnum; i++) {
if ((nnames[i] = strdup(fnames[i])) == NULL)
break;
}
if (i == fnum) {
*tnum = i;
*tnames = nnames;
return (CSA_SUCCESS);
} else {
_DtCm_free_character_pointers(i, nnames);
free(nnames);
return (CSA_E_INSUFFICIENT_MEMORY);
}
}
/*
* pre callback protocol V2, there is no distinction
* between different reasons, and no data passed. So
* there's only one possible thing to do, and that's
* run all the callbacks.
*/
static boolean_t
_ProcessV1Callback(_CallbackInfo *ptr)
{
Calendar *cal;
_DtCmCallbackEntry *cb;
boolean_t keep = B_FALSE;
for (cal = _DtCm_active_cal_list; cal != NULL; cal = cal->next) {
if (cal->rpc_version >= _DtCM_FIRST_EXTENSIBLE_SERVER_VERSION)
continue;
if (cal->do_reasons &
(CSA_CB_ENTRY_ADDED | CSA_CB_ENTRY_DELETED |
CSA_CB_ENTRY_UPDATED))
{
/* only do dumb processing if it was a V4 server */
for (cb = cal->cb_list; cb != NULL; cb = cb->next) {
if (cal->do_reasons & cb->reason) {
cb->handler((CSA_session_handle)cal,
cal->do_reasons & cb->reason,
(CSA_buffer) NULL,
cb->client_data,
(CSA_extension*) NULL);
}
}
} else if (cal->all_reasons & (CSA_CB_ENTRY_ADDED |
CSA_CB_ENTRY_DELETED | CSA_CB_ENTRY_UPDATED))
keep = B_TRUE;
}
return (keep);
}
static boolean_t
_ProcessV2Callback(_CallbackInfo *ptr)
{
Calendar *cal;
_DtCmCallbackEntry *cb;
boolean_t keep = B_FALSE;
for (cal = _DtCm_active_cal_list; cal != NULL; cal = cal->next) {
if (cal->rpc_version < _DtCM_FIRST_EXTENSIBLE_SERVER_VERSION ||
strcmp(ptr->cal, cal->name))
continue;
if (cal->do_reasons & ptr->reason) {
/* only do dumb processing if it was a V4 server */
for (cb = cal->cb_list; cb != NULL; cb = cb->next) {
if (ptr->reason & cb->reason) {
cb->handler((CSA_session_handle)cal,
ptr->reason,
(CSA_buffer)ptr->data,
cb->client_data,
(CSA_extension*) NULL);
}
}
} else if (cal->all_reasons & ptr->reason)
keep = B_TRUE;
}
return (keep);
}
static void
_FreeCallbackInfo(_CallbackInfo *ptr)
{
CSA_logon_callback_data *ldata;
CSA_calendar_deleted_callback_data *rdata;
CSA_calendar_attr_update_callback_data *cdata;
CSA_add_entry_callback_data *adata;
CSA_delete_entry_callback_data *ddata;
CSA_update_entry_callback_data *udata;
if (ptr) {
if (ptr->cal) free(ptr->cal);
if (ptr->user) free(ptr->user);
if (ptr->data) switch (ptr->reason) {
case CSA_CB_CALENDAR_LOGON:
ldata = ptr->data;
if (ldata->user) free(ldata->user);
free(ldata);
break;
case CSA_CB_CALENDAR_DELETED:
rdata = ptr->data;
if (rdata->user) free(rdata->user);
free(rdata);
break;
case CSA_CB_CALENDAR_ATTRIBUTE_UPDATED:
cdata = (CSA_calendar_attr_update_callback_data *)
ptr->data;
if (cdata->user) free(cdata->user);
if (cdata->number_attributes > 0)
_DtCm_free_character_pointers(
cdata->number_attributes,
cdata->attribute_names);
free(cdata);
break;
case CSA_CB_ENTRY_ADDED:
adata = (CSA_add_entry_callback_data *)ptr->data;
if (adata->user) free(adata->user);
if (adata->added_entry_id.data)
free(adata->added_entry_id.data);
free(adata);
break;
case CSA_CB_ENTRY_DELETED:
ddata = (CSA_delete_entry_callback_data *)ptr->data;
if (ddata->date_and_time) free(ddata->date_and_time);
if (ddata->user) free(ddata->user);
if (ddata->deleted_entry_id.data)
free(ddata->deleted_entry_id.data);
free(ddata);
break;
case CSA_CB_ENTRY_UPDATED:
udata = (CSA_update_entry_callback_data *)ptr->data;
if (udata->user) free(udata->user);
if (udata->date_and_time) free(udata->date_and_time);
if (udata->old_entry_id.data)
free(udata->old_entry_id.data);
if (udata->new_entry_id.data)
free(udata->new_entry_id.data);
free(udata);
}
free(ptr);
}
}

View File

@@ -0,0 +1,14 @@
#ifndef _AGENTX_H
#define _AGENTX_H
#if defined(HPUX)
#include <rpc/types.h>
#endif /* HPUX */
#if defined(linux)
# if defined __STDC__
# define REDEFINE_STDC
# undef __STDC__
# endif
#endif /* linux */

12
cde/lib/csa/agent.wrapend Normal file
View File

@@ -0,0 +1,12 @@
#ifdef HPUX
#undef hpux
#define hpux
#endif
#endif
#if defined(linux)
# if defined REDEFINE_STDC
# undef REDEFINE_STDC
# define __STDC__
# endif
#endif /* linux */

37
cde/lib/csa/agent.x Normal file
View File

@@ -0,0 +1,37 @@
/*******************************************************************************
**
** agent.x
**
** static char sccsid[] = "@(#)agent.x 1.5 94/07/16 Copyr 1991 Sun Microsystems, Inc.";
**
** $XConsortium: agent.x /main/1 1996/04/21 19:21:23 drk $
**
** RESTRICTED CONFIDENTIAL INFORMATION:
**
** The information in this document is subject to special
** restrictions in a confidential disclosure agreement between
** HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
** document outside HP, IBM, Sun, USL, SCO, or Univel without
** Sun's specific written approval. This document and all copies
** and derivative works thereof must be returned or destroyed at
** Sun's request.
**
** Copyright 1993 Sun Microsystems, Inc. All rights reserved.
**
*******************************************************************************/
%#include "rtable4.h"
enum Update_Status {
update_succeeded=0,
update_failed=1
};
/* The AGENTPROG actually isn't used for callback.
A transient number will be generated instead. It's
just declared here as a "syntax" holder for rpcgen
*/
program AGENTPROG {
version AGENTVERS {
Update_Status update_callback(Table_Res) = 1;
}=1;
}=00;

18
cde/lib/csa/agent_p.h Normal file
View File

@@ -0,0 +1,18 @@
/* $XConsortium: agent_p.h /main/1 1996/04/21 19:21:26 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#ifndef _AGENT_P_H
#define _AGENT_P_H
#include "ansi_c.h"
extern void _DtCm_init_agent P(());
extern void _DtCm_destroy_agent P(());
extern void _DtCm_process_updates P(());
#endif /* _AGENT_P_H */

61
cde/lib/csa/ansi_c.c Normal file
View File

@@ -0,0 +1,61 @@
/* $XConsortium: ansi_c.c /main/1 1996/04/21 19:25:03 drk $
*
* (c) Copyright 1996 Digital Equipment Corporation.
* (c) Copyright 1996 Hewlett-Packard Company.
* (c) Copyright 1996 International Business Machines Corp.
* (c) Copyright 1993-1996 Sun Microsystems, Inc.
* (c) Copyright 1996 Novell, Inc.
* (c) Copyright 1996 FUJITSU LIMITED.
* (c) Copyright 1996 Hitachi.
*/
#include <ctype.h>
#include "ansi_c.h"
#ifdef NEED_STRCASECMP
/*
* In case strcasecmp and strncasecmp are not provided by the system
* here are ones which do the trick.
*/
int
strcasecmp(register const char *s1,
register const char *s2)
{
register int c1, c2;
while (*s1 && *s2) {
c1 = isupper(*s1) ? tolower(*s1) : *s1;
c2 = isupper(*s2) ? tolower(*s2) : *s2;
if (c1 != c2)
return (c1 - c2);
s1++;
s2++;
}
return (int) (*s1 - *s2);
}
int
strncasecmp(register const char *s1,
register const char *s2,
register size_t count)
{
register int c1, c2;
if (!count)
return 0;
while (*s1 && *s2) {
c1 = isupper(*s1) ? tolower(*s1) : *s1;
c2 = isupper(*s2) ? tolower(*s2) : *s2;
if ((c1 != c2) || (! --count))
return (c1 - c2);
s1++;
s2++;
}
return (int) (*s1 - *s2);
}
#else
static int unused = 0; /* Make the compiler happy. */
#endif

41
cde/lib/csa/ansi_c.h Normal file
View File

@@ -0,0 +1,41 @@
/* $XConsortium: ansi_c.h /main/1 1996/04/21 19:21:28 drk $
*
* (c) Copyright 1996 Digital Equipment Corporation.
* (c) Copyright 1993,1994,1996 Hewlett-Packard Company.
* (c) Copyright 1993,1994,1996 International Business Machines Corp.
* (c) Copyright 1993,1994,1996 Sun Microsystems, Inc.
* (c) Copyright 1993,1994,1996 Novell, Inc.
* (c) Copyright 1996 FUJITSU LIMITED.
* (c) Copyright 1996 Hitachi.
*/
#ifndef _ANSI_C_H
#define _ANSI_C_H
#include <stdlib.h>
/*
** For all function declarations, if ANSI, then use a prototype
*/
#if defined(__STDC__)
#define P(args) args
#else
#define P(args) ()
#endif
#ifdef SunOS
extern char *fconvert P((double, int, int*, int*, char*));
extern int isascii P((int));
extern int kill P((long, int));
extern char *mktemp P((char*));
extern int strcasecmp P((const char*, const char*));
extern int strncasecmp P((const char*, const char*, size_t));
extern char *strdup P((const char*));
#endif
#ifdef NEED_STRCASECMP
int strcasecmp P((const char*, const char*));
int strncasecmp P((const char*, const char*, size_t));
#endif
#endif

1327
cde/lib/csa/api.c Normal file

File diff suppressed because it is too large Load Diff

602
cde/lib/csa/appt4.c Normal file
View File

@@ -0,0 +1,602 @@
/* $XConsortium: appt4.c /main/1 1996/04/21 19:21:34 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
/*
* this file contains allocate and free routines for v4 data structures
*/
#include <EUSCompat.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "appt4.h"
#define FAUX_STRING "Appointment"
/*
* forward declaration of static functions used within the file
*/
static void free_tag4(Tag_4 *t);
static Attribute_4 *copy_attr4(Attribute_4 *a4);
static Tag_4 *copy_tag4(Tag_4 *t4);
/*****************************************************************************
* extern functions
*****************************************************************************/
extern Appt_4 *
_DtCm_make_appt4(boolean_t alloc)
{
Appt_4 *a;
if ((a = (Appt_4 *)calloc(1, sizeof(Appt_4))) == NULL)
return NULL;
if ((a->tag = (Tag_4 *)calloc(1, sizeof(Tag_4))) == NULL) {
free(a);
return NULL;
}
a->tag->tag = appointment_4;
a->tag->next = NULL;
a->tag->showtime = B_TRUE;
a->period.period = single_4;
a->appt_status = active_4;
a->privacy = public_4;
if (alloc) {
a->what = calloc(1, sizeof(1));
a->author = calloc(1, sizeof(1));
a->client_data = calloc(1, sizeof(1));
}
a->next = NULL;
return(a);
}
extern Appt_4 *
_DtCm_copy_one_appt4(Appt_4 *a4)
{
Appt_4 *ptr, *copy;
if (a4 == NULL)
return NULL;
ptr = a4->next;
a4->next = NULL;
copy = _DtCm_copy_appt4(a4);
a4->next = ptr;
return (copy);
}
extern Appt_4 *
_DtCm_copy_appt4(Appt_4 *a4)
{
Appt_4 *a, *head, *prev;
boolean_t cleanup = B_FALSE;
prev = head = NULL;
while (a4 != NULL) {
if ((a = (Appt_4 *)calloc(1, sizeof(Appt_4))) == NULL) {
cleanup = B_TRUE;
break;
}
a->appt_id.tick = a4->appt_id.tick;
a->appt_id.key = a4->appt_id.key;
a->duration = a4->duration;
a->ntimes = a4->ntimes;
if (a4->what) {
if ((a->what = strdup(a4->what)) == NULL) {
_DtCm_free_appt4(a);
cleanup = B_TRUE;
break;
}
} else if ((a->what = (char *)calloc(1, 1)) == NULL) {
_DtCm_free_appt4(a);
cleanup = B_TRUE;
break;
}
a->period.period = a4->period.period;
a->period.nth = a4->period.nth;
a->period.enddate = a4->period.enddate;
if (a4->author) {
if ((a->author = strdup(a4->author)) == NULL) {
_DtCm_free_appt4(a);
cleanup = B_TRUE;
break;
}
} else if ((a->author = (char *)calloc(1, 1)) == NULL) {
_DtCm_free_appt4(a);
cleanup = B_TRUE;
break;
}
if (a4->client_data) {
if ((a->client_data = strdup(a4->client_data)) == NULL) {
_DtCm_free_appt4(a);
cleanup = B_TRUE;
break;
}
} else if ((a->client_data = (char *)calloc(1, 1)) == NULL) {
_DtCm_free_appt4(a);
cleanup = B_TRUE;
break;
}
if (a4->exception &&
(a->exception = _DtCm_copy_excpt4(a4->exception)) == NULL) {
_DtCm_free_appt4(a);
cleanup = B_TRUE;
break;
}
if (a4->attr && (a->attr = copy_attr4(a4->attr)) == NULL) {
_DtCm_free_appt4(a);
cleanup = B_TRUE;
break;
}
if (a4->tag) {
if ((a->tag = copy_tag4(a4->tag)) == NULL) {
free(a);
cleanup = B_TRUE;
break;
}
} else if ((a->tag = (Tag_4 *)calloc(1, sizeof(Tag_4))) == NULL) {
free(a);
cleanup = B_TRUE;
break;
} else {
a->tag->tag = appointment_4;
a->tag->showtime = B_TRUE;
a->tag->next = NULL;
}
a->appt_status = a4->appt_status;
a->privacy = a4->privacy;
a->next = NULL;
if (head == NULL)
head = a;
else
prev->next = a;
prev = a;
a4 = a4->next;
}
if (cleanup == B_TRUE) {
_DtCm_free_appt4(head);
head = NULL;
}
return (head);
}
/*
* Copy one appointment.
* The what field is set to "Appointment".
*/
extern Appt_4 *
_DtCm_copy_semiprivate_appt4(Appt_4 *original)
{
Appt_4 *temp, *copy = NULL;
if (original != NULL) {
temp = original->next;
original->next = NULL;
if ((copy = _DtCm_copy_appt4(original)) != NULL) {
if (copy->what != NULL)
free(copy->what);
if ((copy->what = (char *)strdup(FAUX_STRING)) == NULL)
{
_DtCm_free_appt4(copy);
copy = NULL;
}
}
original->next = temp;
}
return(copy);
}
extern Abb_Appt_4 *
_DtCm_appt_to_abbrev4(Appt_4 *original)
{
Abb_Appt_4 *new = NULL;
if (original != NULL) {
if ((new = (Abb_Appt_4 *)calloc(1, sizeof(Abb_Appt_4))) == NULL)
return NULL;
if ((new->tag = copy_tag4(original->tag)) == NULL) {
free(new);
return NULL;
}
new->appt_id.tick = original->appt_id.tick;
new->appt_id.key = original->appt_id.key;
if ((new->what = (char *)strdup(original->what)) == NULL) {
_DtCm_free_abbrev_appt4(new);
return NULL;
}
new->duration = original->duration;
new->period.period = original->period.period;
new->period.nth = original->period.nth;
new->period.enddate = original->period.enddate;
new->appt_status = original->appt_status;
new->privacy = original->privacy;
new->next=NULL;
}
return(new);
}
/*
* The what field is set to "Appointment".
*/
extern Abb_Appt_4 *
_DtCm_appt_to_semiprivate_abbrev4(Appt_4 *original)
{
Abb_Appt_4 *new = _DtCm_appt_to_abbrev4(original);
if (new != NULL) {
if (new->what != NULL)
free(new->what);
if ((new->what = strdup(FAUX_STRING)) == NULL) {
_DtCm_free_abbrev_appt4(new);
new = NULL;
}
}
return(new);
}
extern void
_DtCm_free_appt4(Appt_4 *a)
{
Appt_4 *ptr;
while (a != NULL) {
ptr = a->next;
if (a->what != NULL)
free(a->what);
if (a->author != NULL)
free(a->author);
if (a->tag != NULL)
free_tag4(a->tag);
if (a->attr != NULL)
_DtCm_free_attr4(a->attr);
if (a->exception != NULL)
_DtCm_free_excpt4(a->exception);
free(a);
a = ptr;
}
}
extern void
_DtCm_free_abbrev_appt4(Abb_Appt_4 *a)
{
Abb_Appt_4 *ptr;
while (a != NULL) {
ptr = a->next;
if (a->what != NULL) {
free(a->what);
}
if (a->tag != NULL) {
free_tag4(a->tag);
}
free(a);
a = ptr;
}
}
Attribute_4 *
_DtCm_make_attr4()
{
Attribute_4 *a;
if ((a = (Attribute_4 *)calloc(1, sizeof(Attribute_4))) == NULL)
return NULL;
if ((a->attr = (char *)calloc(1, 1)) == NULL) {
free(a);
return NULL;
}
if ((a->value = (char *)calloc(1, 1)) == NULL) {
_DtCm_free_attr4(a);
return NULL;
}
if ((a->clientdata = (char *)calloc(1, 1)) == NULL) {
_DtCm_free_attr4(a);
return NULL;
}
return(a);
}
extern void
_DtCm_free_attr4(Attribute_4 *a)
{
Attribute_4 *ptr;
while (a != NULL) {
ptr = a->next;
if (a->attr != NULL)
free(a->attr);
if (a->value != NULL)
free(a->value);
if (a->clientdata != NULL)
free(a->clientdata);
free(a);
a = ptr;
}
}
extern Reminder_4 *
_DtCm_copy_reminder4(Reminder_4 *r4)
{
Reminder_4 *rem, *head, *prev;
prev = head = NULL;
while (r4 != NULL) {
rem = (Reminder_4 *)calloc(1, sizeof(Reminder_4));
rem->appt_id = r4->appt_id;
rem->tick = r4->tick;
rem->attr.next = NULL;
rem->attr.attr = strdup(r4->attr.attr);
rem->attr.value = strdup(r4->attr.value);
rem->attr.clientdata = strdup(r4->attr.clientdata);
rem->next = NULL;
if (head == NULL)
head = rem;
else
prev->next = rem;
prev = rem;
r4 = r4->next;
}
return(head);
}
extern void
_DtCm_free_reminder4(Reminder_4 *r)
{
Reminder_4 *ptr;
while (r != NULL) {
ptr = r->next;
if (r->attr.attr != NULL)
free (r->attr.attr);
if (r->attr.value != NULL)
free (r->attr.value);
if (r->attr.clientdata != NULL)
free (r->attr.clientdata);
free (r);
r = ptr;
}
}
extern void
_DtCm_free_keyentry4(Uid_4 *k)
{
Uid_4 *ptr;
while (k != NULL) {
ptr = k->next;
free(k);
k = ptr;
}
}
extern Access_Entry_4 *
_DtCm_make_access_entry4(char *who, int perms)
{
Access_Entry_4 *e;
if (who==NULL) return((Access_Entry_4 *)NULL);
if ((e = (Access_Entry_4 *)calloc(1, sizeof(Access_Entry_4))) == NULL)
return NULL;
if ((e->who = strdup(who)) == NULL) {
free(e);
return NULL;
}
e->access_type = perms;
e->next = NULL;
return(e);
}
extern void
_DtCm_free_access_list4(Access_Entry_4 *e)
{
Access_Entry_4 *ptr;
while (e != NULL) {
ptr = e->next;
if (e->who != NULL)
free(e->who);
free(e);
e = ptr;
}
}
extern void
_DtCm_free_excpt4(Except_4 *e)
{
Except_4 *ptr;
while (e != NULL) {
ptr = e->next;
free(e);
e = ptr;
}
}
extern Except_4 *
_DtCm_copy_excpt4(Except_4 *e4)
{
Except_4 *e, *head, *prev;
boolean_t cleanup = B_FALSE;
prev = head = NULL;
while (e4 != NULL) {
if ((e = (Except_4 *)calloc(1, sizeof(Except_4))) == NULL) {
cleanup = B_TRUE;
break;
}
e->ordinal = e4->ordinal;
e->next = NULL;
if (head == NULL)
head = e;
else
prev->next = e;
prev = e;
e4 = e4->next;
}
if (cleanup == B_TRUE) {
_DtCm_free_excpt4(head);
head = NULL;
}
return (head);
}
/******************************************************************************
* static functions used within the file
******************************************************************************/
static void
free_tag4(Tag_4 *t)
{
Tag_4 *ptr;
while (t != NULL) {
ptr = t->next;
free(t);
t = ptr;
}
}
/* Copy an attribute list recursively */
static Attribute_4 *
copy_attr4(Attribute_4 *a4)
{
Attribute_4 *a, *head, *prev;
boolean_t cleanup = B_FALSE;
prev = head = NULL;
while (a4 != NULL) {
if ((a = (Attribute_4 *)calloc(1, sizeof(Attribute_4)))
== NULL) {
cleanup = B_TRUE;
break;
}
if ((a->attr = strdup(a4->attr)) == NULL) {
free(a);
cleanup = B_TRUE;
break;
}
if ((a->value = strdup(a4->value)) == NULL) {
_DtCm_free_attr4(a);
cleanup = B_TRUE;
break;
}
if ((a->clientdata = strdup(a4->clientdata)) == NULL) {
_DtCm_free_attr4(a);
cleanup = B_TRUE;
break;
}
if (head == NULL)
head = a;
else
prev->next = a;
prev = a;
a4 = a4->next;
}
if (cleanup == B_TRUE) {
_DtCm_free_attr4(head);
head = NULL;
}
return (head);
}
static Tag_4 *
copy_tag4(Tag_4 *t4)
{
Tag_4 *t, *head, *prev;
boolean_t cleanup = B_FALSE;
prev = head = NULL;
while (t4 != NULL) {
if ((t = (Tag_4 *)calloc(1, sizeof(Tag_4))) == NULL) {
cleanup = B_TRUE;
break;
}
t->tag = t4->tag;
t->showtime = t4->showtime;
t->next = NULL;
if (head == NULL)
head = t;
else
prev->next = t;
prev = t;
t4 = t4->next;
}
if (cleanup == B_TRUE) {
free_tag4(head);
head = NULL;
}
return (head);
}

57
cde/lib/csa/appt4.h Normal file
View File

@@ -0,0 +1,57 @@
/* $XConsortium: appt4.h /main/1 1996/04/21 19:21:37 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#ifndef _APPT4_H
#define _APPT4_H
/*
* this file contains allocate and free routines for v4 data structures
*/
#include "rtable4.h"
#include "ansi_c.h"
extern Appt_4 *_DtCm_make_appt4 P(());
extern Appt_4 *_DtCm_copy_one_appt4 P((Appt_4 *a4));
extern Appt_4 *_DtCm_copy_appt4 P((Appt_4 *a4));
extern Appt_4 *_DtCm_copy_semiprivate_appt4 P((Appt_4 *original));
extern Except_4 *_DtCm_copy_excpt4 P((Except_4 *e4));
extern Abb_Appt_4 *_DtCm_appt_to_abbrev4 P((Appt_4 *original));
extern Abb_Appt_4 *_DtCm_appt_to_semiprivate_abbrev4 P((Appt_4 *original));
extern void _DtCm_free_appt4 P((Appt_4 *a));
extern void _DtCm_free_abbrev_appt4 P((Abb_Appt_4 *a));
extern Attribute_4 * _DtCm_make_attr4 P(());
extern void _DtCm_free_attr4 P((Attribute_4 *a));
extern Reminder_4 *_DtCm_copy_reminder4 P((Reminder_4 *r4));
extern void _DtCm_free_reminder4 P((Reminder_4 *r));
extern void _DtCm_free_keyentry4 P((Uid_4 *k));
extern Access_Entry_4 *_DtCm_make_access_entry4 P((char *who, int perms));
extern Access_Entry_4 *_DtCm_copy_access_list4 P((Access_Entry_4 *l4));
extern void _DtCm_free_access_list4 P((Access_Entry_4 *l));
extern void _DtCm_free_excpt4 P((Except_4 *e));
extern char * _DtCm_get_default_what_string P(());
#endif

1972
cde/lib/csa/attr.c Normal file

File diff suppressed because it is too large Load Diff

259
cde/lib/csa/attr.h Normal file
View File

@@ -0,0 +1,259 @@
/* $XConsortium: attr.h /main/1 1996/04/21 19:21:44 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#ifndef _ATTR_H
#define _ATTR_H
#include <EUSCompat.h>
#include "ansi_c.h"
#include "csa.h"
#include "cm.h"
/*
* types of reminder used by old versions
*/
#define _DtCM_OLD_ATTR_BEEP_REMINDER "bp"
#define _DtCM_OLD_ATTR_FLASH_REMINDER "fl"
#define _DtCM_OLD_ATTR_MAIL_REMINDER "ml"
#define _DtCM_OLD_ATTR_POPUP_REMINDER "op"
/*
* number of attributes for old and new format calendars
*/
#define _DtCM_OLD_CAL_ATTR_SIZE 9
#define _DtCM_OLD_ENTRY_ATTR_SIZE 19
#define _DtCM_DEFINED_CAL_ATTR_SIZE 15
#define _DtCM_DEFINED_ENTRY_ATTR_SIZE 34
/*
* "repeat forever" value used in old format calendars
*/
#define _DtCM_OLD_REPEAT_FOREVER 999999999
/*
* Attribute number supported by old backends
*/
typedef enum {
_DtCm_old_attr_unknown,
_DtCm_old_attr_id,
_DtCm_old_attr_time,
_DtCm_old_attr_type,
_DtCm_old_attr_type2,
_DtCm_old_attr_duration,
_DtCm_old_attr_what,
_DtCm_old_attr_author,
_DtCm_old_attr_beep_reminder,
_DtCm_old_attr_flash_reminder,
_DtCm_old_attr_mail_reminder,
_DtCm_old_attr_popup_reminder,
_DtCm_old_attr_repeat_type,
_DtCm_old_attr_repeat_times,
_DtCm_old_attr_showtime,
_DtCm_old_attr_status,
_DtCm_old_attr_privacy,
_DtCm_old_attr_repeat_nth_interval,
_DtCm_old_attr_repeat_nth_weeknum,
_DtCm_old_attr_end_date
} _DtCm_old_attrs;
/* attribute information structure */
typedef struct {
int index;
CSA_enum type;
int fst_vers; /* 1st data version supporting this
* attr
*/
_DtCm_old_attrs oldattr;
boolean_t nex_ro; /* readonly for non-extensible file
* version
*/
boolean_t ex_ro; /* readonly for extensible file version
*/
} _DtCmAttrInfo;
/* calendar attribute information */
extern _DtCmAttrInfo _CSA_cal_attr_info[];
/* entry attribute information */
extern _DtCmAttrInfo _CSA_entry_attr_info[];
/*
* external function declarations
*/
extern CSA_return_code _DtCm_check_cal_csa_attributes P((
int fvers,
uint num_attrs,
CSA_attribute *attrs,
char *cname,
boolean_t checkreadonly,
boolean_t firsttime,
boolean_t checkattrnum));
extern CSA_return_code _DtCm_check_cal_cms_attributes P((
int fvers,
uint num_attrs,
cms_attribute *attrs,
char *owner,
char *cname,
boolean_t checkreadonly,
boolean_t firsttime,
boolean_t checkattrnum));
extern CSA_return_code _DtCm_check_entry_attributes P((
int fversion,
uint size,
CSA_attribute *attrs,
CSA_flags utype,
boolean_t checkattrnum));
extern CSA_return_code _DtCm_check_entry_cms_attributes P((
int fvers,
uint num_attrs,
cms_attribute *attrs,
CSA_flags utype,
boolean_t checkattrnum));
extern CSA_return_code _DtCm_copy_cms_attributes P((
uint srcsize,
cms_attribute *srcattrs,
uint *dstsize,
cms_attribute **dstattrs));
extern CSA_return_code _DtCm_copy_cms_attribute P((
cms_attribute *to,
cms_attribute *from,
boolean_t copyname));
extern CSA_return_code _DtCm_copy_cms_attr_val P((
cms_attribute_value *from,
cms_attribute_value **to));
extern cms_access_entry *_DtCm_copy_cms_access_list P((
cms_access_entry *alist));
extern CSA_date_time_list _DtCm_copy_date_time_list P((
CSA_date_time_list dlist));
extern CSA_return_code _DtCm_cms2csa_attribute P((
cms_attribute from,
CSA_attribute *to));
extern CSA_return_code _DtCm_cms2csa_attrval P((
cms_attribute_value *from,
CSA_attribute_value **to));
extern CSA_return_code _DtCm_cms2csa_access_list P((
cms_access_entry *cmslist,
CSA_access_rights **csalist));
extern CSA_return_code _DtCm_csa2cms_access_list P((
CSA_access_rights *csalist,
cms_access_entry **cmslist));
extern CSA_return_code _DtCm_copy_reminder P((
CSA_reminder *from,
CSA_reminder **to));
extern CSA_return_code _DtCm_copy_opaque_data P((
CSA_opaque_data *from,
CSA_opaque_data **to));
extern void _DtCm_free_csa_access_list P((CSA_access_list alist));
extern void _DtCm_free_cms_attributes P((
uint size,
cms_attribute *attrs));
extern void _DtCm_free_attributes P((
uint size,
CSA_attribute * attrs));
extern void _DtCm_free_cms_attribute_values P((
uint size,
cms_attribute *attrs));
extern void _DtCm_free_attribute_values P((
uint size,
CSA_attribute *attrs));
extern void _DtCm_free_cms_attribute_value P((
cms_attribute_value *val));
extern void _DtCm_free_attribute_value P((
CSA_attribute_value *val));
extern void _DtCm_free_cms_access_entry P((cms_access_entry *list));
extern void _DtCm_free_date_time_list P((CSA_date_time_list list));
extern void _DtCm_free_reminder P((CSA_reminder *val));
extern void _DtCm_free_opaque_data P((CSA_opaque_data *val));
extern char *_DtCm_old_reminder_name_to_name P((
char *oldname));
extern int _DtCm_old_reminder_name_to_index P((
char *name));
extern CSA_return_code _DtCm_get_old_attr_by_name P((
char *name,
_DtCm_old_attrs *attr));
extern CSA_return_code _DtCm_get_old_attr_by_index P((
int index,
_DtCm_old_attrs *attr));
extern CSA_return_code _DtCm_set_uint32_attrval P((
uint numval,
cms_attribute_value **val));
extern CSA_return_code _DtCm_set_sint32_attrval P((
int numval,
cms_attribute_value **val));
extern CSA_return_code _DtCm_set_string_attrval P((
char *strval,
cms_attribute_value **val,
CSA_enum type));
extern CSA_return_code _DtCm_set_user_attrval P((
char *user,
cms_attribute_value **val));
extern CSA_return_code _DtCm_set_reminder_attrval P((
CSA_reminder *remval,
cms_attribute_value **val));
extern CSA_return_code _DtCm_set_access_attrval P((
cms_access_entry *aval,
cms_attribute_value **val));
extern CSA_return_code _DtCm_set_opaque_attrval P((
CSA_opaque_data *opqval,
cms_attribute_value **val));
extern CSA_return_code _DtCm_set_csa_access_attrval P((
cms_access_entry *aval,
CSA_attribute_value **val));
extern CSA_return_code _DtCm_set_csa_uint32_attrval P((
uint numval,
CSA_attribute_value **attrval));
extern CSA_return_code _DtCm_set_csa_string_attrval P((
char *strval,
CSA_attribute_value **attrval,
CSA_enum type));
extern void _DtCm_get_attribute_types(uint size, int *types);
#endif

667
cde/lib/csa/calendar.c Normal file
View File

@@ -0,0 +1,667 @@
/* $XConsortium: calendar.c /main/1 1996/04/21 19:21:47 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
/*****************************************************************************
* Functions that manage the calendar data structures.
*****************************************************************************/
#include <EUSCompat.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pwd.h>
#include "calendar.h"
#include "entry.h"
#include "cmsdata.h"
#include "agent_p.h"
#include "rpccalls.h"
#include "debug.h"
#include "attr.h"
#include "xtclient.h"
#include "misc.h"
#include "free.h"
#include "nametbl.h"
#include "lutil.h"
/* linked list of calendar structure representing opened calendars */
Calendar *_DtCm_active_cal_list = NULL;
/******************************************************************************
* forward declaration of static functions used within the file
******************************************************************************/
static CSA_return_code _get_owner_from_old_cal(Calendar *cal, char *buf);
static CSA_return_code _get_calendar_owner(Calendar *cal, uint num_names,
char **names, CSA_attribute *attr);
static CSA_return_code _get_calendar_name(Calendar *cal, CSA_attribute *attr);
static CSA_return_code _get_product_identifier(Calendar *cal,
CSA_attribute *attr);
static CSA_return_code _get_version_supported(Calendar *cal,
CSA_attribute *attr);
static CSA_return_code _get_server_version(Calendar *cal, CSA_attribute *attr);
static CSA_return_code _get_data_version(Calendar *cal, CSA_attribute *attr);
static CSA_return_code _get_access_list(Calendar *cal, uint num_names,
char ** names, CSA_attribute *attr);
static CSA_return_code _get_number_entries(Calendar *cal, uint num_names,
char ** names, CSA_attribute *attr);
/*****************************************************************************
* extern functions used in the library
*****************************************************************************/
/*
* Allocate a calendar structure and initialize it with
* the location, and name of the calendar.
*/
extern Calendar *
_DtCm_new_Calendar(const char *calendar)
{
Calendar *cal;
int i;
_DtCm_init_hash();
if ((cal = (Calendar *)malloc(sizeof(Calendar))) == NULL)
return(NULL);
memset((void *)cal, NULL, sizeof(Calendar));
if ((cal->name = strdup(calendar)) == NULL) {
free(cal);
return(NULL);
}
cal->location = strchr(cal->name, '@');
cal->location++;
/* set up attribute array */
if ((cal->attrs = (cms_attribute *)calloc(1,
sizeof(cms_attribute) * (_DtCm_cal_name_tbl->size + 1))) == NULL) {
free(cal->name);
free(cal);
return(NULL);
}
for (i = 1; i <= _DtCm_cal_name_tbl->size; i++) {
if ((cal->attrs[i].name.name =
strdup(_DtCm_cal_name_tbl->names[i])) == NULL) {
/* clean up */
cal->num_attrs = i - 1;
_DtCm_free_Calendar(cal);
return(NULL);
} else
cal->attrs[i].name.num = i;
}
cal->num_attrs = _DtCm_cal_name_tbl->size;
if (_DtCm_active_cal_list == NULL) {
_DtCm_active_cal_list = cal;
cal->next = NULL;
cal->prev = NULL;
}
else {
cal->next = _DtCm_active_cal_list;
_DtCm_active_cal_list->prev = cal;
_DtCm_active_cal_list = cal;
}
cal->cal_tbl = _DtCm_cal_name_tbl;
cal->entry_tbl = _DtCm_entry_name_tbl;
cal->handle = (void *)cal;
return(cal);
}
/*
* After freeing up memory pointed to by cal,
* put it in the free list.
*/
extern void
_DtCm_free_Calendar(Calendar *cal)
{
_DtCmCallbackEntry *cb, *ptr;
/* remove from active list */
if (_DtCm_active_cal_list == cal)
_DtCm_active_cal_list = cal->next;
if (cal->prev != NULL)
cal->prev->next = cal->next;
if (cal->next != NULL)
cal->next->prev = cal->prev;
/* free up resources used by it */
if (cal->name) free(cal->name);
if (cal->ehead) _DtCm_free_libentries((_DtCm_libentry *)cal->ehead);
if (cal->cal_tbl != _DtCm_cal_name_tbl)
_DtCm_free_name_table(cal->cal_tbl);
if (cal->entry_tbl != _DtCm_entry_name_tbl)
_DtCm_free_name_table(cal->entry_tbl);
cb = cal->cb_list;
while (cb) {
ptr = cb->next;
free(cb);
cb = ptr;
}
/*
* no need to free attribute values now
* since the values are passed to client
* directly.
* need to free attribute values if they
* are cached later
*/
_DtCm_free_cms_attribute_values(cal->num_attrs, cal->attrs);
free(cal->attrs);
memset((void *)cal, '\0', sizeof(Calendar));
/* if no calendar is open, destroy rpc mapping */
if (_DtCm_active_cal_list == NULL)
_DtCm_destroy_agent();
}
/*
* Given the calendar handle, return the internal calendar data structure.
*/
extern Calendar *
_DtCm_get_Calendar(CSA_session_handle calhandle)
{
Calendar *cal = (Calendar *)calhandle;
if (cal == NULL || cal->handle != (void *)cal)
return (NULL);
else
return ((Calendar *)calhandle);
}
/*
* Add linked list of entry data structures to the calendar.
*/
extern uint
_DtCm_add_to_entry_list(Calendar *cal, caddr_t elist)
{
int i;
_DtCm_libentry *entries = (_DtCm_libentry *)elist;
if (entries == NULL)
return (0);
if (cal->ehead == NULL)
cal->ehead = elist;
else {
((_DtCm_libentry *)cal->etail)->next = entries;
entries->prev = (_DtCm_libentry *)cal->etail;
}
/* find tail of given entry list */
i = 1;
entries->cal = cal;
while (entries->next != NULL) {
i++;
entries->next->cal = cal;
entries = entries->next;
}
cal->etail = (caddr_t)entries;
#ifdef CM_DEBUG
_DtCm_count_entry_in_list(cal->ehead);
#endif
return (i);
}
extern void
_DtCm_remove_from_entry_list(
Calendar *cal,
caddr_t head,
caddr_t tail)
{
_DtCm_libentry *ehead = (_DtCm_libentry *)head;
_DtCm_libentry *etail = (_DtCm_libentry *)tail;
if (ehead == NULL || tail == NULL)
return;
if (ehead == (_DtCm_libentry *)cal->ehead)
cal->ehead = (caddr_t)etail->next;
if (etail == (_DtCm_libentry *)cal->etail)
cal->etail = (caddr_t)ehead->prev;
/* remove from list */
if (ehead->prev != NULL)
ehead->prev->next = etail->next;
if (etail->next != NULL)
etail->next->prev = ehead->prev;
etail->next = ehead->prev = NULL;
#ifdef CM_DEBUG
_DtCm_count_entry_in_list(cal->ehead);
#endif
}
extern void
_DtCm_reset_cal_attrs(Calendar *cal)
{
cal->got_attrs = B_FALSE;
}
/*
* Assume good parameters. Caller should check before calling this.
*/
extern CSA_return_code
_DtCm_list_old_cal_attr_names(
Calendar *cal,
CSA_uint32 *num_names_r,
char **names_r[])
{
CSA_return_code stat;
char **names, buf[BUFSIZ];
int i, j;
if ((names = _DtCm_alloc_character_pointers(_DtCM_OLD_CAL_ATTR_SIZE))
== NULL)
return (CSA_E_INSUFFICIENT_MEMORY);
/* find out whether we know the owner of the calendar */
if ((stat = _get_owner_from_old_cal(cal, buf)) != CSA_SUCCESS)
return (stat);
for (i = 1, j = 0; i <= _DtCM_DEFINED_CAL_ATTR_SIZE; i++) {
if (_CSA_cal_attr_info[i].fst_vers > 0 &&
_CSA_cal_attr_info[i].fst_vers <= cal->file_version) {
if (i == CSA_CAL_ATTR_CALENDAR_OWNER_I && *buf == NULL)
continue;
if ((names[j] =
strdup(_CSA_calendar_attribute_names[i])) == NULL)
{
_DtCm_free(names);
return (CSA_E_INSUFFICIENT_MEMORY);
} else
j++;
}
}
*names_r = names;
*num_names_r = j;
return (CSA_SUCCESS);
}
extern CSA_return_code
_DtCm_get_all_cal_attrs(
Calendar *cal,
CSA_uint32 *num_attrs,
CSA_attribute **attrs)
{
CSA_return_code stat;
int i, j;
CSA_attribute *attrs_r;
if (num_attrs == NULL || attrs == NULL)
return (CSA_E_INVALID_PARAMETER);
if (cal->rpc_version >= _DtCM_FIRST_EXTENSIBLE_SERVER_VERSION) {
if ((stat = _DtCm_rpc_get_cal_attrs(cal, 0, 0, NULL))
!= CSA_SUCCESS)
return (stat);
if ((attrs_r = _DtCm_alloc_attributes(cal->num_attrs)) == NULL)
return (CSA_E_INSUFFICIENT_MEMORY);
/* get attributes */
for (i = 1, j = 0; i <= cal->num_attrs; i++) {
if (cal->attrs[i].value != NULL) {
if ((stat = _DtCm_cms2csa_attribute(
cal->attrs[i], &attrs_r[j])) != CSA_SUCCESS)
{
_DtCm_free(attrs_r);
return (stat);
} else
j++;
}
}
*num_attrs = j;
*attrs = attrs_r;
return (CSA_SUCCESS);
} else
return (_DtCm_get_cal_attrs_by_name(cal,
_DtCM_DEFINED_CAL_ATTR_SIZE + 1,
_CSA_calendar_attribute_names, num_attrs, attrs));
}
/*
* If it's not found, the attribute value is set to NULL.
*/
extern CSA_return_code
_DtCm_get_cal_attrs_by_name(
Calendar *cal,
CSA_uint32 num_names,
CSA_attribute_reference *names,
CSA_uint32 *num_attrs,
CSA_attribute **attrs)
{
CSA_return_code stat = CSA_SUCCESS;
CSA_attribute *attrs_r;
int i, j, index;
if (num_attrs == 0 || attrs == NULL)
return (CSA_E_INVALID_PARAMETER);
if ((attrs_r = _DtCm_alloc_attributes(num_names)) == NULL)
return (CSA_E_INSUFFICIENT_MEMORY);
for (i = 0, j = 0; i < num_names; i++) {
if (names[i] == NULL)
continue;
index = _DtCm_get_index_from_table(cal->cal_tbl, names[i]);
switch (index) {
case CSA_X_DT_CAL_ATTR_SERVER_VERSION_I:
stat = _get_server_version(cal, &attrs_r[j]);
break;
case CSA_X_DT_CAL_ATTR_DATA_VERSION_I:
stat = _get_data_version(cal, &attrs_r[j]);
break;
case CSA_CAL_ATTR_ACCESS_LIST_I:
stat = _get_access_list(cal, num_names, names,
&attrs_r[j]);
break;
case CSA_CAL_ATTR_NUMBER_ENTRIES_I:
stat = _get_number_entries(cal, num_names,
names, &attrs_r[j]);
break;
case CSA_CAL_ATTR_CALENDAR_NAME_I:
stat = _get_calendar_name(cal, &attrs_r[j]);
break;
case CSA_CAL_ATTR_CALENDAR_OWNER_I:
stat = _get_calendar_owner(cal, num_names, names,
&attrs_r[j]);
break;
case CSA_CAL_ATTR_PRODUCT_IDENTIFIER_I:
stat = _get_product_identifier(cal, &attrs_r[j]);
break;
case CSA_CAL_ATTR_VERSION_I:
stat = _get_version_supported(cal, &attrs_r[j]);
break;
default:
if (cal->rpc_version >=
_DtCM_FIRST_EXTENSIBLE_SERVER_VERSION)
{
if (cal->file_version <
_DtCM_FIRST_EXTENSIBLE_DATA_VERSION &&
index == -1)
break;
if (cal->got_attrs == B_FALSE &&
(stat = _DtCm_rpc_get_cal_attrs(cal, 0,
num_names, names)) == CSA_SUCCESS) {
/* there might by new attributes */
if (index == -1 &&
(index = _DtCm_get_index_from_table(
cal->cal_tbl, names[i])) == -1)
break;
}
if (stat == CSA_SUCCESS &&
cal->attrs[index].value)
stat = _DtCm_cms2csa_attribute(
cal->attrs[index], &attrs_r[j]);
}
break;
}
if (stat == CSA_SUCCESS) {
if (attrs_r[j].value != NULL)
j++;
} else {
_DtCm_free(attrs_r);
return (stat);
}
}
*num_attrs = j;
if (j > 0) {
*attrs = attrs_r;
} else {
*attrs = NULL;
_DtCm_free(attrs_r);
}
return (CSA_SUCCESS);
}
/*
* Debugging function - count the number of entries in the list and print it out
*/
extern void
_DtCm_count_entry_in_list(caddr_t elist)
{
int i;
_DtCm_libentry *list;
for (i = 0, list = (_DtCm_libentry *)elist;
list != NULL;
i++, list = list->next)
;
fprintf(stderr, "number of entries = %d\n", i);
}
/******************************************************************************
* static functions used within in the file
******************************************************************************/
/*
* owner should point to a buffer big enough to hold the owner name
* We test whether the calendar name is a user name, if so, the
* owner will be the same as the calendar name.
* Otherwise, we don't know the owner.
*/
static CSA_return_code
_get_owner_from_old_cal(Calendar *cal, char *owner)
{
char *calname;
if ((calname = _DtCmGetPrefix(cal->name, '@')) == NULL)
return (CSA_E_INSUFFICIENT_MEMORY);
if (_DtCmIsUserName(calname) == B_TRUE)
strcpy(owner, calname);
else
*owner = NULL;
free(calname);
return (CSA_SUCCESS);
}
static CSA_return_code
_get_calendar_owner(
Calendar *cal,
uint num_names,
char **names,
CSA_attribute *attr)
{
CSA_return_code stat;
CSA_attribute_value *val;
char *owner, buf[BUFSIZ];
if (cal->rpc_version >= _DtCM_FIRST_EXTENSIBLE_SERVER_VERSION) {
if (cal->got_attrs == B_FALSE) {
if ((stat = _DtCm_rpc_get_cal_attrs(cal, 0, num_names,
names)) != CSA_SUCCESS)
return (stat);
}
owner = cal->attrs[CSA_CAL_ATTR_CALENDAR_OWNER_I].value->\
item.string_value;
} else {
if ((stat = _get_owner_from_old_cal(cal, buf)) != CSA_SUCCESS)
return (stat);
else if (*buf == NULL)
return (CSA_SUCCESS);
else
owner = buf;
}
if (attr->name = strdup(CSA_CAL_ATTR_CALENDAR_OWNER)) {
if ((val = (CSA_attribute_value *)calloc(1,
sizeof(CSA_attribute_value))) == NULL) {
free(attr->name);
return (CSA_E_INSUFFICIENT_MEMORY);
}
val->type = CSA_VALUE_CALENDAR_USER;
if ((val->item.calendar_user_value = (CSA_calendar_user *)
calloc(1, sizeof(CSA_calendar_user))) == NULL) {
free(val);
free(attr->name);
return (CSA_E_INSUFFICIENT_MEMORY);
}
if (val->item.calendar_user_value->user_name = strdup(owner)) {
attr->value = val;
return (CSA_SUCCESS);
} else {
free(val->item.calendar_user_value);
free(val);
free(attr->name);
return (CSA_E_INSUFFICIENT_MEMORY);
}
} else
return (CSA_E_INSUFFICIENT_MEMORY);
}
static CSA_return_code
_get_calendar_name(Calendar *cal, CSA_attribute *attr)
{
if (attr->name = strdup(CSA_CAL_ATTR_CALENDAR_NAME))
return (_DtCm_set_csa_string_attrval(cal->name, &attr->value,
CSA_VALUE_STRING));
else
return (CSA_E_INSUFFICIENT_MEMORY);
}
static CSA_return_code
_get_product_identifier(Calendar *cal, CSA_attribute *attr)
{
if (attr->name = strdup(CSA_CAL_ATTR_PRODUCT_IDENTIFIER))
return (_DtCm_set_csa_string_attrval(_DtCM_PRODUCT_IDENTIFIER,
&attr->value, CSA_VALUE_STRING));
else
return (CSA_E_INSUFFICIENT_MEMORY);
}
static CSA_return_code
_get_version_supported(Calendar *cal, CSA_attribute *attr)
{
char buf[10];
if (attr->name = strdup(CSA_CAL_ATTR_VERSION))
return (_DtCm_set_csa_string_attrval(
_DtCM_SPEC_VERSION_SUPPORTED, &attr->value,
CSA_VALUE_STRING));
else
return (CSA_E_INSUFFICIENT_MEMORY);
}
static CSA_return_code
_get_server_version(Calendar *cal, CSA_attribute *attr)
{
if (attr->name = strdup(CSA_X_DT_CAL_ATTR_SERVER_VERSION))
return (_DtCm_set_csa_uint32_attrval(cal->rpc_version,
&attr->value));
else
return (CSA_E_INSUFFICIENT_MEMORY);
}
static CSA_return_code
_get_data_version(Calendar *cal, CSA_attribute *attr)
{
if (attr->name = strdup(CSA_X_DT_CAL_ATTR_DATA_VERSION))
return (_DtCm_set_csa_uint32_attrval(cal->file_version,
&attr->value));
else
return (CSA_E_INSUFFICIENT_MEMORY);
}
static CSA_return_code
_get_access_list(
Calendar *cal,
uint num_names,
char **names,
CSA_attribute *attr)
{
CSA_return_code stat = CSA_SUCCESS;
if (cal->rpc_version < _DtCM_FIRST_EXTENSIBLE_SERVER_VERSION)
stat = _DtCm_rpc_get_cal_attrs(cal, CSA_CAL_ATTR_ACCESS_LIST_I,
0, NULL);
else if (cal->got_attrs == B_FALSE)
stat = _DtCm_rpc_get_cal_attrs(cal, 0, num_names, names);
if (stat == CSA_SUCCESS)
stat = _DtCm_cms2csa_attribute(
cal->attrs[CSA_CAL_ATTR_ACCESS_LIST_I], attr);
return (stat);
}
static CSA_return_code
_get_number_entries(
Calendar *cal,
uint num_names,
char **names,
CSA_attribute *attr)
{
CSA_return_code stat = CSA_SUCCESS;
if (cal->rpc_version < _DtCM_FIRST_EXTENSIBLE_SERVER_VERSION)
stat = _DtCm_rpc_get_cal_attrs(cal,
CSA_CAL_ATTR_NUMBER_ENTRIES_I, 0, NULL);
else if (cal->got_attrs == B_FALSE)
stat = _DtCm_rpc_get_cal_attrs(cal, 0, num_names, names);
if (stat == CSA_SUCCESS)
stat = _DtCm_cms2csa_attribute(
cal->attrs[CSA_CAL_ATTR_NUMBER_ENTRIES_I], attr);
return (stat);
}

108
cde/lib/csa/calendar.h Normal file
View File

@@ -0,0 +1,108 @@
/* $XConsortium: calendar.h /main/1 1996/04/21 19:21:50 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#ifndef _CALENDAR_H
#define _CALENDAR_H
/*
* This file contains the internal data structure of calendars.
*/
#include <EUSCompat.h>
#include "ansi_c.h"
#include "csa.h"
#include "connection.h"
#include "nametbl.h"
#include "attr.h"
#include "cm.h"
typedef struct cbq {
CSA_flags reason;
CSA_callback handler;
CSA_buffer client_data;
struct cbq *next;
struct cbq *prev;
} _DtCmCallbackEntry;
/*
* Calendar object structure
*/
typedef struct cal {
void *handle;
int rpc_version; /* server version */
int file_version;
_DtCmNameTable *cal_tbl;
_DtCmNameTable *entry_tbl;
char *name; /* calendar@location */
char *location;
boolean_t async_process; /* asynchronous update enabled*/
CSA_flags all_reasons; /* all events registered */
CSA_flags do_reasons; /* events to process */
_DtCmCallbackEntry *cb_list;
_DtCm_Connection conn; /* connection info */
uint num_attrs;
cms_attribute *attrs;
boolean_t got_attrs;
int access;
caddr_t ehead; /* list of entries associated */
caddr_t etail; /* with the calendar. */
struct cal *next;
struct cal *prev;
} Calendar;
/* linked list of active calendars */
extern Calendar *_DtCm_active_cal_list;
/* function prototypes */
extern Calendar * _DtCm_new_Calendar P((
const char *calenadr));
extern void _DtCm_free_Calendar P((
Calendar *cal));
extern Calendar *_DtCm_get_Calendar P((
CSA_session_handle calhandle));
extern uint _DtCm_add_to_entry_list P((
Calendar *cal,
caddr_t elist));
extern void _DtCm_remove_from_entry_list P((
Calendar *cal,
caddr_t head,
caddr_t tail));
extern CSA_return_code _DtCm_list_old_cal_attr_names P((
Calendar *cal,
CSA_uint32 *num_names_r,
char **names_r[]));
extern CSA_return_code _DtCm_set_cal_attr P((
Calendar *cal,
CSA_attribute attr));
extern CSA_return_code _DtCm_get_all_cal_attrs P((
Calendar *cal,
CSA_uint32 *num_attrs,
CSA_attribute **attrs));
extern CSA_return_code _DtCm_get_cal_attrs_by_name P((
Calendar *cal,
CSA_uint32 num_names,
CSA_attribute_reference *names,
CSA_uint32 *num_attrs,
CSA_attribute **attrs));
extern void _DtCm_reset_cal_attrs P((
Calendar *cal));
extern void _DtCm_count_entry_in_list P((
caddr_t elist));
#endif

689
cde/lib/csa/cm.h Normal file
View File

@@ -0,0 +1,689 @@
/* $XConsortium: cm.h /main/1 1996/04/21 19:21:53 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#ifndef _CM_H
#define _CM_H
#ifndef SunOS
#include <rpc/types.h>
#endif /* HPUX */
#include <rpc/rpc.h>
#ifdef __cplusplus
extern "C" {
#endif
#include "csa.h"
#include "connection.h"
/*
* cms_name - a user name or calendar name which is
* variable length character string
*/
typedef char *cms_name;
/*
* buffer - a variable length character string
*/
typedef char *buffer;
/*
* cms_access_entry - data structure for the access list attribute
*/
struct cms_access_entry {
cms_name user;
u_int rights;
struct cms_access_entry *next;
};
typedef struct cms_access_entry cms_access_entry;
/*
* cms_attribute_value - data structure for attribute value
*/
struct cms_attribute_value {
int type;
union {
CSA_boolean boolean_value;
CSA_enum enumerated_value;
CSA_flags flags_value;
long sint32_value;
unsigned long uint32_value;
char *string_value;
char *calendar_user_value;
char *date_time_value;
char *date_time_range_value;
char *time_duration_value;
cms_access_entry *access_list_value;
CSA_date_time_entry *date_time_list_value;
CSA_reminder *reminder_value;
CSA_opaque_data *opaque_data_value;
} item;
};
typedef struct cms_attribute_value cms_attribute_value;
/*
* cms_key consists of the time and the unique
* identifier of the entry.
*/
struct cms_key {
time_t time;
long id;
};
typedef struct cms_key cms_key;
/*
* num contains the hashed number for the associated name assigned
* by the server. Client should not change its value.
* If it's zero, name is not hashed yet.
*/
struct cms_attr_name {
short num;
cms_name name;
};
typedef struct cms_attr_name cms_attr_name;
/*
*
*/
struct cms_attribute {
cms_attr_name name;
cms_attribute_value *value;
};
typedef struct cms_attribute cms_attribute;
/*
* An entry is identified by an identifier unique within the calendar
* and has a variable number of attributes associated with it.
*/
struct cms_entry {
cms_key key;
u_int num_attrs;
cms_attribute *attrs;
struct cms_entry *next;
};
typedef struct cms_entry cms_entry;
/*
* cms_enumerate_calendar_attr_res
*
* If stat is CSA_SUCCESS, names contains an array of names.
*/
struct cms_enumerate_calendar_attr_res {
CSA_return_code stat;
u_int num_names;
cms_attr_name *names;
};
typedef struct cms_enumerate_calendar_attr_res cms_enumerate_calendar_attr_res;
/*
* cms_list_calendars_res
*
* If stat is CSA_SUCCESS, names contains an array of names.
*/
struct cms_list_calendars_res {
CSA_return_code stat;
u_int num_names;
cms_name *names;
};
typedef struct cms_list_calendars_res cms_list_calendars_res;
/*
* cms_open_args - used by CMS_OPEN_CALENDAR
*/
struct cms_open_args {
cms_name cal;
int pid;
};
typedef struct cms_open_args cms_open_args;
/*
* cms_open_res - returned by CMS_OPEN_CALENDAR
*
* If stat is DtCm_OK,
* svr_vers contains the version number of the server,
* file_vers contains the version number of the callog file,
* user_access is the calling user's access right to the calendar
* num_attrs indicates the size of the array pointed to by attrs,
* and attrs contains an array of calendar attributes.
*/
struct cms_open_res {
CSA_return_code stat;
int svr_vers;
int file_vers;
u_int user_access;
u_int num_attrs;
cms_attribute *attrs;
};
typedef struct cms_open_res cms_open_res;
/*
* cms_create_args - used by CMS_CREATE_CALENDAR
*/
struct cms_create_args {
cms_name cal;
buffer char_set;
int pid;
u_int num_attrs;
cms_attribute *attrs;
};
typedef struct cms_create_args cms_create_args;
/*
* cms_remove_args - used by CMS_REMOVE_CALENDAR
*/
struct cms_remove_args {
cms_name cal;
int pid;
};
typedef struct cms_remove_args cms_remove_args;
/*
* cms_register_args - used by CMS_REGISTER and CMS_UNREGISTER
*/
struct cms_register_args {
cms_name cal;
u_int update_type;
u_long prognum;
u_long versnum;
u_long procnum;
int pid;
};
typedef struct cms_register_args cms_register_args;
/*
* cms_get_cal_attr_res - used by CMS_GET_CALENDAR_ATTR
*
* If stat is CSA_SUCCESS, attrs contains an array of attributes.
*/
struct cms_get_cal_attr_res {
CSA_return_code stat;
u_int num_attrs;
cms_attribute *attrs;
};
typedef struct cms_get_cal_attr_res cms_get_cal_attr_res;
/*
* cms_get_cal_attr_args - used by CMS_GET_CALENDAR_ATTR
*/
struct cms_get_cal_attr_args {
cms_name cal;
u_int num_names;
cms_attr_name *names;
};
typedef struct cms_get_cal_attr_args cms_get_cal_attr_args;
/*
* cms_set_cal_attr_args - used by CMS_SET_CALENDAR_ATTR
*/
struct cms_set_cal_attr_args {
cms_name cal;
int pid;
u_int num_attrs;
cms_attribute *attrs;
};
typedef struct cms_set_cal_attr_args cms_set_cal_attr_args;
/*
* cms_archive_res - used by CMS_ARCHIVE
*
* If stat is CSA_SUCCESS, data contains the data to be archived
*/
struct cms_archive_res {
CSA_return_code stat;
buffer data;
};
typedef struct cms_archive_res cms_archive_res;
/*
* cms_archive_args - used by CMS_ARCHIVE
*/
struct cms_archive_args {
cms_name cal;
bool_t delete;
buffer char_set;
CSA_uint32 num_attrs;
cms_attribute *attrs;
CSA_enum *ops;
};
typedef struct cms_archive_args cms_archive_args;
/*
* cms_restore_args - used by CMS_RESTORE
*/
struct cms_restore_args {
cms_name cal;
buffer data;
buffer char_set;
CSA_uint32 num_attrs;
cms_attribute *attrs;
CSA_enum *ops;
};
typedef struct cms_restore_args cms_restore_args;
/*
* cms_reminder
*/
struct cms_reminder_ref {
buffer reminder_name;
buffer entryid;
cms_key key;
time_t runtime;
struct cms_reminder_ref *next;
};
typedef struct cms_reminder_ref cms_reminder_ref;
/*
* cms_reminder_res - used by CMS_LOOKUP_REMINDER
*
* If stat is CSA_SUCCESS, rems contains an array of reminders.
*/
struct cms_reminder_res {
CSA_return_code stat;
cms_reminder_ref *rems;
};
typedef struct cms_reminder_res cms_reminder_res;
/*
* cms_reminder_args - used by CMS_LOOKUP_REMINDER
*/
struct cms_reminder_args {
cms_name cal;
time_t tick;
u_int num_names;
cms_attr_name *names;
};
typedef struct cms_reminder_args cms_reminder_args;
/*
* cms_entries_res
*
* If stat is CSA_SUCCESS, entries contains an array of entries.
*/
struct cms_entries_res {
CSA_return_code stat;
cms_entry *entries;
};
typedef struct cms_entries_res cms_entries_res;
/*
* cms_lookup_entries_args - used by CMS_LOOKUP_ENTRIES
*/
struct cms_lookup_entries_args {
cms_name cal;
buffer char_set;
u_int num_attrs;
cms_attribute *attrs;
CSA_enum *ops;
};
typedef struct cms_lookup_entries_args cms_lookup_entries_args;
/*
* cms_enumerate_args - used by CMS_ENUERATE_SEQUENCE
*/
struct cms_enumerate_args {
cms_name cal;
long id;
long start;
long end;
};
typedef struct cms_enumerate_args cms_enumerate_args;
/*
* If stat is CSA_SUCCESS, attrs contains an array of
* attributes.
*/
struct cms_get_entry_attr_res_item {
CSA_return_code stat;
cms_key key;
u_int num_attrs;
cms_attribute *attrs;
struct cms_get_entry_attr_res_item *next;
};
typedef struct cms_get_entry_attr_res_item cms_get_entry_attr_res_item;
/*
* cms_get_entry_attr_res - used by CMS_GET_ENTRY_ATTR
*
* If stat is CSA_SUCCESS, entries contains an array of
* cms_get_entry_attr_res_item structures.
*/
struct cms_get_entry_attr_res {
CSA_return_code stat;
cms_get_entry_attr_res_item *entries;
};
typedef struct cms_get_entry_attr_res cms_get_entry_attr_res;
/*
* cms_get_entry_attr_args - used by CMS_GET_ENTRY_ATTR
*/
struct cms_get_entry_attr_args {
cms_name cal;
u_int num_keys;
cms_key *keys;
u_int num_names;
cms_attr_name *names;
};
typedef struct cms_get_entry_attr_args cms_get_entry_attr_args;
/*
* cms_entry_res
*
* If stat is CSA_SUCCESS, entry points to an entry.
*/
struct cms_entry_res {
CSA_return_code stat;
cms_entry *entry;
};
typedef struct cms_entry_res cms_entry_res;
/*
* cms_insert_args - used by CMS_INSERT_ENTRY
*/
struct cms_insert_args {
cms_name cal;
int pid;
u_int num_attrs;
cms_attribute *attrs;
};
typedef struct cms_insert_args cms_insert_args;
/*
* cms_update_args - used by CMS_UPDATE_ENTRY
*/
struct cms_update_args {
cms_name cal;
int pid;
cms_key entry;
int scope;
u_int num_attrs;
cms_attribute *attrs;
};
typedef struct cms_update_args cms_update_args;
/*
* cms_delete_args - used by CMS_DELETE_ENTRY
*/
struct cms_delete_args {
cms_name cal;
int pid;
cms_key entry;
int scope;
};
typedef struct cms_delete_args cms_delete_args;
#define TABLEPROG ((unsigned long)(100068))
#define TABLEVERS ((unsigned long)(5))
#if defined(__STDC__) || defined(__cplusplus)
#define CMS_PING ((unsigned long)(0))
extern void * cms_ping_5(void *, _DtCm_Connection *);
extern void * cms_ping_5_svc(void *, struct svc_req *);
#define CMS_LIST_CALENDARS ((unsigned long)(1))
extern cms_list_calendars_res * cms_list_calendars_5(void *, _DtCm_Connection *);
extern cms_list_calendars_res * cms_list_calendars_5_svc(void *, struct svc_req *);
#define CMS_OPEN_CALENDAR ((unsigned long)(2))
extern cms_open_res * cms_open_calendar_5(cms_open_args *, _DtCm_Connection *);
extern cms_open_res * cms_open_calendar_5_svc(cms_open_args *, struct svc_req *);
#define CMS_CREATE_CALENDAR ((unsigned long)(3))
extern CSA_return_code * cms_create_calendar_5(cms_create_args *, _DtCm_Connection *);
extern CSA_return_code * cms_create_calendar_5_svc(cms_create_args *, struct svc_req *);
#define CMS_REMOVE_CALENDAR ((unsigned long)(4))
extern CSA_return_code * cms_remove_calendar_5(cms_remove_args *, _DtCm_Connection *);
extern CSA_return_code * cms_remove_calendar_5_svc(cms_remove_args *, struct svc_req *);
#define CMS_REGISTER ((unsigned long)(5))
extern CSA_return_code * cms_register_5(cms_register_args *, _DtCm_Connection *);
extern CSA_return_code * cms_register_5_svc(cms_register_args *, struct svc_req *);
#define CMS_UNREGISTER ((unsigned long)(6))
extern CSA_return_code * cms_unregister_5(cms_register_args *, _DtCm_Connection *);
extern CSA_return_code * cms_unregister_5_svc(cms_register_args *, struct svc_req *);
#define CMS_ENUMERATE_CALENDAR_ATTR ((unsigned long)(7))
extern cms_enumerate_calendar_attr_res * cms_enumerate_calendar_attr_5(cms_name *, _DtCm_Connection *);
extern cms_enumerate_calendar_attr_res * cms_enumerate_calendar_attr_5_svc(cms_name *, struct svc_req *);
#define CMS_GET_CALENDAR_ATTR ((unsigned long)(8))
extern cms_get_cal_attr_res * cms_get_calendar_attr_5(cms_get_cal_attr_args *, _DtCm_Connection *);
extern cms_get_cal_attr_res * cms_get_calendar_attr_5_svc(cms_get_cal_attr_args *, struct svc_req *);
#define CMS_SET_CALENDAR_ATTR ((unsigned long)(9))
extern CSA_return_code * cms_set_calendar_attr_5(cms_set_cal_attr_args *, _DtCm_Connection *);
extern CSA_return_code * cms_set_calendar_attr_5_svc(cms_set_cal_attr_args *, struct svc_req *);
#define CMS_ARCHIVE ((unsigned long)(10))
extern cms_archive_res * cms_archive_5(cms_archive_args *, _DtCm_Connection *);
extern cms_archive_res * cms_archive_5_svc(cms_archive_args *, struct svc_req *);
#define CMS_RESTORE ((unsigned long)(11))
extern CSA_return_code * cms_restore_5(cms_restore_args *, _DtCm_Connection *);
extern CSA_return_code * cms_restore_5_svc(cms_restore_args *, struct svc_req *);
#define CMS_LOOKUP_REMINDER ((unsigned long)(12))
extern cms_reminder_res * cms_lookup_reminder_5(cms_reminder_args *, _DtCm_Connection *);
extern cms_reminder_res * cms_lookup_reminder_5_svc(cms_reminder_args *, struct svc_req *);
#define CMS_LOOKUP_ENTRIES ((unsigned long)(13))
extern cms_entries_res * cms_lookup_entries_5(cms_lookup_entries_args *, _DtCm_Connection *);
extern cms_entries_res * cms_lookup_entries_5_svc(cms_lookup_entries_args *, struct svc_req *);
#define CMS_ENUMERATE_SEQUENCE ((unsigned long)(14))
extern cms_entries_res * cms_enumerate_sequence_5(cms_enumerate_args *, _DtCm_Connection *);
extern cms_entries_res * cms_enumerate_sequence_5_svc(cms_enumerate_args *, struct svc_req *);
#define CMS_GET_ENTRY_ATTR ((unsigned long)(15))
extern cms_get_entry_attr_res * cms_get_entry_attr_5(cms_get_entry_attr_args *, _DtCm_Connection *);
extern cms_get_entry_attr_res * cms_get_entry_attr_5_svc(cms_get_entry_attr_args *, struct svc_req *);
#define CMS_INSERT_ENTRY ((unsigned long)(16))
extern cms_entry_res * cms_insert_entry_5(cms_insert_args *, _DtCm_Connection *);
extern cms_entry_res * cms_insert_entry_5_svc(cms_insert_args *, struct svc_req *);
#define CMS_UPDATE_ENTRY ((unsigned long)(17))
extern cms_entry_res * cms_update_entry_5(cms_update_args *, _DtCm_Connection *);
extern cms_entry_res * cms_update_entry_5_svc(cms_update_args *, struct svc_req *);
#define CMS_DELETE_ENTRY ((unsigned long)(18))
extern CSA_return_code * cms_delete_entry_5(cms_delete_args *, _DtCm_Connection *);
extern CSA_return_code * cms_delete_entry_5_svc(cms_delete_args *, struct svc_req *);
extern int tableprog_5_freeresult(SVCXPRT *, xdrproc_t, caddr_t);
#else /* K&R C */
#define CMS_PING ((unsigned long)(0))
extern void * cms_ping_5();
extern void * cms_ping_5_svc();
#define CMS_LIST_CALENDARS ((unsigned long)(1))
extern cms_list_calendars_res * cms_list_calendars_5();
extern cms_list_calendars_res * cms_list_calendars_5_svc();
#define CMS_OPEN_CALENDAR ((unsigned long)(2))
extern cms_open_res * cms_open_calendar_5();
extern cms_open_res * cms_open_calendar_5_svc();
#define CMS_CREATE_CALENDAR ((unsigned long)(3))
extern CSA_return_code * cms_create_calendar_5();
extern CSA_return_code * cms_create_calendar_5_svc();
#define CMS_REMOVE_CALENDAR ((unsigned long)(4))
extern CSA_return_code * cms_remove_calendar_5();
extern CSA_return_code * cms_remove_calendar_5_svc();
#define CMS_REGISTER ((unsigned long)(5))
extern CSA_return_code * cms_register_5();
extern CSA_return_code * cms_register_5_svc();
#define CMS_UNREGISTER ((unsigned long)(6))
extern CSA_return_code * cms_unregister_5();
extern CSA_return_code * cms_unregister_5_svc();
#define CMS_ENUMERATE_CALENDAR_ATTR ((unsigned long)(7))
extern cms_enumerate_calendar_attr_res * cms_enumerate_calendar_attr_5();
extern cms_enumerate_calendar_attr_res * cms_enumerate_calendar_attr_5_svc();
#define CMS_GET_CALENDAR_ATTR ((unsigned long)(8))
extern cms_get_cal_attr_res * cms_get_calendar_attr_5();
extern cms_get_cal_attr_res * cms_get_calendar_attr_5_svc();
#define CMS_SET_CALENDAR_ATTR ((unsigned long)(9))
extern CSA_return_code * cms_set_calendar_attr_5();
extern CSA_return_code * cms_set_calendar_attr_5_svc();
#define CMS_ARCHIVE ((unsigned long)(10))
extern cms_archive_res * cms_archive_5();
extern cms_archive_res * cms_archive_5_svc();
#define CMS_RESTORE ((unsigned long)(11))
extern CSA_return_code * cms_restore_5();
extern CSA_return_code * cms_restore_5_svc();
#define CMS_LOOKUP_REMINDER ((unsigned long)(12))
extern cms_reminder_res * cms_lookup_reminder_5();
extern cms_reminder_res * cms_lookup_reminder_5_svc();
#define CMS_LOOKUP_ENTRIES ((unsigned long)(13))
extern cms_entries_res * cms_lookup_entries_5();
extern cms_entries_res * cms_lookup_entries_5_svc();
#define CMS_ENUMERATE_SEQUENCE ((unsigned long)(14))
extern cms_entries_res * cms_enumerate_sequence_5();
extern cms_entries_res * cms_enumerate_sequence_5_svc();
#define CMS_GET_ENTRY_ATTR ((unsigned long)(15))
extern cms_get_entry_attr_res * cms_get_entry_attr_5();
extern cms_get_entry_attr_res * cms_get_entry_attr_5_svc();
#define CMS_INSERT_ENTRY ((unsigned long)(16))
extern cms_entry_res * cms_insert_entry_5();
extern cms_entry_res * cms_insert_entry_5_svc();
#define CMS_UPDATE_ENTRY ((unsigned long)(17))
extern cms_entry_res * cms_update_entry_5();
extern cms_entry_res * cms_update_entry_5_svc();
#define CMS_DELETE_ENTRY ((unsigned long)(18))
extern CSA_return_code * cms_delete_entry_5();
extern CSA_return_code * cms_delete_entry_5_svc();
extern int tableprog_5_freeresult();
#endif /* K&R C */
/* the xdr functions */
#if defined(__STDC__) || defined(__cplusplus)
extern bool_t xdr_cms_name(XDR *, cms_name*);
extern bool_t xdr_buffer(XDR *, buffer*);
extern bool_t xdr_cms_access_entry(XDR *, cms_access_entry*);
extern bool_t xdr_cms_key(XDR *, cms_key*);
extern bool_t xdr_cms_attr_name(XDR *, cms_attr_name*);
extern bool_t xdr_cms_attribute(XDR *, cms_attribute*);
extern bool_t xdr_cms_entry(XDR *, cms_entry*);
extern bool_t xdr_cms_enumerate_calendar_attr_res(XDR *, cms_enumerate_calendar_attr_res*);
extern bool_t xdr_cms_list_calendars_res(XDR *, cms_list_calendars_res*);
extern bool_t xdr_cms_open_args(XDR *, cms_open_args*);
extern bool_t xdr_cms_open_res(XDR *, cms_open_res*);
extern bool_t xdr_cms_create_args(XDR *, cms_create_args*);
extern bool_t xdr_cms_remove_args(XDR *, cms_remove_args*);
extern bool_t xdr_cms_register_args(XDR *, cms_register_args*);
extern bool_t xdr_cms_get_cal_attr_res(XDR *, cms_get_cal_attr_res*);
extern bool_t xdr_cms_get_cal_attr_args(XDR *, cms_get_cal_attr_args*);
extern bool_t xdr_cms_set_cal_attr_args(XDR *, cms_set_cal_attr_args*);
extern bool_t xdr_cms_archive_res(XDR *, cms_archive_res*);
extern bool_t xdr_cms_archive_args(XDR *, cms_archive_args*);
extern bool_t xdr_cms_restore_args(XDR *, cms_restore_args*);
extern bool_t xdr_cms_reminder_ref(XDR *, cms_reminder_ref*);
extern bool_t xdr_cms_reminder_res(XDR *, cms_reminder_res*);
extern bool_t xdr_cms_reminder_args(XDR *, cms_reminder_args*);
extern bool_t xdr_cms_entries_res(XDR *, cms_entries_res*);
extern bool_t xdr_cms_lookup_entries_args(XDR *, cms_lookup_entries_args*);
extern bool_t xdr_cms_enumerate_args(XDR *, cms_enumerate_args*);
extern bool_t xdr_cms_get_entry_attr_res_item(XDR *, cms_get_entry_attr_res_item*);
extern bool_t xdr_cms_get_entry_attr_res(XDR *, cms_get_entry_attr_res*);
extern bool_t xdr_cms_get_entry_attr_args(XDR *, cms_get_entry_attr_args*);
extern bool_t xdr_cms_entry_res(XDR *, cms_entry_res*);
extern bool_t xdr_cms_insert_args(XDR *, cms_insert_args*);
extern bool_t xdr_cms_update_args(XDR *, cms_update_args*);
extern bool_t xdr_cms_delete_args(XDR *, cms_delete_args*);
#else /* K&R C */
extern bool_t xdr_cms_name();
extern bool_t xdr_buffer();
extern bool_t xdr_cms_access_entry();
extern bool_t xdr_cms_key();
extern bool_t xdr_cms_attr_name();
extern bool_t xdr_cms_attribute();
extern bool_t xdr_cms_entry();
extern bool_t xdr_cms_enumerate_calendar_attr_res();
extern bool_t xdr_cms_list_calendars_res();
extern bool_t xdr_cms_open_args();
extern bool_t xdr_cms_open_res();
extern bool_t xdr_cms_create_args();
extern bool_t xdr_cms_remove_args();
extern bool_t xdr_cms_register_args();
extern bool_t xdr_cms_get_cal_attr_res();
extern bool_t xdr_cms_get_cal_attr_args();
extern bool_t xdr_cms_set_cal_attr_args();
extern bool_t xdr_cms_archive_res();
extern bool_t xdr_cms_archive_args();
extern bool_t xdr_cms_restore_args();
extern bool_t xdr_cms_reminder_ref();
extern bool_t xdr_cms_reminder_res();
extern bool_t xdr_cms_reminder_args();
extern bool_t xdr_cms_entries_res();
extern bool_t xdr_cms_lookup_entries_args();
extern bool_t xdr_cms_enumerate_args();
extern bool_t xdr_cms_get_entry_attr_res_item();
extern bool_t xdr_cms_get_entry_attr_res();
extern bool_t xdr_cms_get_entry_attr_args();
extern bool_t xdr_cms_entry_res();
extern bool_t xdr_cms_insert_args();
extern bool_t xdr_cms_update_args();
extern bool_t xdr_cms_delete_args();
#endif /* K&R C */
#ifdef __cplusplus
}
#endif
#ifdef HPUX
#undef hpux
#define hpux
#endif
#endif

581
cde/lib/csa/cm.x Normal file
View File

@@ -0,0 +1,581 @@
/* $XConsortium: cm.x /main/1 1996/04/21 19:21:56 drk $ */
/*
* (c) Copyright 1996 Digital Equipment Corporation.
* (c) Copyright 1993,1994,1996 Hewlett-Packard Company.
* (c) Copyright 1993,1994,1996 International Business Machines Corp.
* (c) Copyright 1993,1994,1996 Sun Microsystems, Inc.
* (c) Copyright 1993,1994,1996 Novell, Inc.
* (c) Copyright 1996 FUJITSU LIMITED.
* (c) Copyright 1996 Hitachi.
*/
/*
* Calendar manager service RPC protocol.
*/
#if defined(RPC_HDR) || defined(RPC_XDR)
%
%#include "csa.h"
%#include "connection.h"
#ifdef RPC_XDR
%#include "cmxdr.h"
#endif
%
%
%/*
% * cms_name - a user name or calendar name which is
% * variable length character string
% */
typedef string cms_name<>;
%
%/*
% * buffer - a variable length character string
% */
typedef string buffer<>;
%
%/*
% * cms_access_entry - data structure for the access list attribute
% */
struct cms_access_entry {
cms_name user;
u_int rights;
cms_access_entry *next;
};
%
%/*
% * cms_attribute_value - data structure for attribute value
% */
%struct cms_attribute_value {
% int type;
% union {
% CSA_boolean boolean_value;
% CSA_enum enumerated_value;
% CSA_flags flags_value;
% int sint32_value;
% uint uint32_value;
% char *string_value;
% char *calendar_user_value;
% char *date_time_value;
% char *date_time_range_value;
% char *time_duration_value;
% cms_access_entry *access_list_value;
% CSA_date_time_entry *date_time_list_value;
% CSA_reminder *reminder_value;
% CSA_opaque_data *opaque_data_value;
% } item;
%};
%typedef struct cms_attribute_value cms_attribute_value;
%
%
%/*
% * cms_key consists of the time and the unique
% * identifier of the entry.
% */
struct cms_key {
time_t time;
long id;
};
%
%/*
% * num contains the hashed number for the associated name assigned
% * by the server. Client should not change its value.
% * If it's zero, name is not hashed yet.
% */
struct cms_attr_name {
short num;
cms_name name;
};
%
%/*
% *
% */
struct cms_attribute {
cms_attr_name name;
cms_attribute_value *value;
};
%
%
%/*
% * An entry is identified by an identifier unique within the calendar
% * and has a variable number of attributes associated with it.
% */
struct cms_entry {
cms_key key;
u_int num_attrs;
cms_attribute *attrs;
struct cms_entry *next;
};
%
%
%/*
% * cms_enumerate_calendar_attr_res
% *
% * If stat is CSA_SUCCESS, names contains an array of names.
% */
struct cms_enumerate_calendar_attr_res {
CSA_return_code stat;
CSA_uint32 num_names;
cms_attr_name *names;
};
%
%
%/*
% * cms_list_calendars_res
% *
% * If stat is CSA_SUCCESS, names contains an array of names.
% */
struct cms_list_calendars_res {
CSA_return_code stat;
CSA_uint32 num_names;
cms_name *names;
};
%
%
%/*
% * cms_open_args - used by CMS_OPEN_CALENDAR
% */
struct cms_open_args {
cms_name cal;
int pid;
};
%
%
%/*
% * cms_open_res - returned by CMS_OPEN_CALENDAR
% *
% * If stat is DtCm_OK,
% * svr_vers contains the version number of the server,
% * file_vers contains the version number of the callog file,
% * user_access is the calling user's access right to the calendar
% * num_attrs indicates the size of the array pointed to by attrs,
% * and attrs contains an array of calendar attributes.
% */
struct cms_open_res {
CSA_return_code stat;
int svr_vers;
int file_vers;
u_int user_access;
CSA_uint32 num_attrs;
cms_attribute *attrs;
};
%
%
%/*
% * cms_create_args - used by CMS_CREATE_CALENDAR
% */
struct cms_create_args {
cms_name cal;
buffer char_set;
int pid;
CSA_uint32 num_attrs;
cms_attribute *attrs;
};
%
%
%/*
% * cms_remove_args - used by CMS_REMOVE_CALENDAR
% */
struct cms_remove_args {
cms_name cal;
int pid;
};
%
%
%/*
% * cms_register_args - used by CMS_REGISTER and CMS_UNREGISTER
% */
struct cms_register_args {
cms_name cal;
u_int update_type;
u_long prognum;
u_long versnum;
u_long procnum;
int pid;
};
%
%
%/*
% * cms_get_cal_attr_res - used by CMS_GET_CALENDAR_ATTR
% *
% * If stat is CSA_SUCCESS, attrs contains an array of attributes.
% */
struct cms_get_cal_attr_res {
CSA_return_code stat;
CSA_uint32 num_attrs;
cms_attribute *attrs;
};
%
%
%/*
% * cms_get_cal_attr_args - used by CMS_GET_CALENDAR_ATTR
% */
struct cms_get_cal_attr_args {
cms_name cal;
CSA_uint32 num_names;
cms_attr_name *names;
};
%
%
%/*
% * cms_set_cal_attr_args - used by CMS_SET_CALENDAR_ATTR
% */
struct cms_set_cal_attr_args {
cms_name cal;
int pid;
CSA_uint32 num_attrs;
cms_attribute *attrs;
};
%
%
%/*
% * cms_archive_res - used by CMS_ARCHIVE
% *
% * If stat is CSA_SUCCESS, data contains the data to be archived
% */
struct cms_archive_res {
CSA_return_code stat;
buffer data;
};
%
%
%/*
% * cms_archive_args - used by CMS_ARCHIVE
% */
struct cms_archive_args {
cms_name cal;
bool delete;
buffer char_set;
CSA_uint32 num_attrs;
cms_attribute *attrs;
int *ops;
};
%
%
%/*
% * cms_restore_args - used by CMS_RESTORE
% */
struct cms_restore_args {
cms_name cal;
buffer data;
buffer char_set;
CSA_uint32 num_attrs;
cms_attribute *attrs;
int *ops;
};
%
%
%/*
% * cms_reminder
% */
struct cms_reminder_ref {
buffer reminder_name;
buffer entryid;
cms_key key;
long runtime;
struct cms_reminder_ref *next;
};
%
%
%/*
% * cms_reminder_res - used by CMS_LOOKUP_REMINDER
% *
% * If stat is CSA_SUCCESS, rems contains an array of reminders.
% */
struct cms_reminder_res {
CSA_return_code stat;
cms_reminder_ref *rems;
};
%
%
%/*
% * cms_reminder_args - used by CMS_LOOKUP_REMINDER
% */
struct cms_reminder_args {
cms_name cal;
long tick;
CSA_uint32 num_names;
cms_attr_name *names;
};
%
%
%/*
% * cms_entries_res
% *
% * If stat is CSA_SUCCESS, entries contains an array of entries.
% */
struct cms_entries_res {
CSA_return_code stat;
cms_entry *entries;
};
%
%
%/*
% * cms_lookup_entries_args - used by CMS_LOOKUP_ENTRIES
% */
struct cms_lookup_entries_args {
cms_name cal;
buffer char_set;
CSA_uint32 num_attrs;
cms_attribute *attrs;
int *ops;
};
%
%
%/*
% * cms_enumerate_args - used by CMS_ENUERATE_SEQUENCE
% */
struct cms_enumerate_args {
cms_name cal;
long id;
long start;
long end;
};
%
%/*
% * If stat is CSA_SUCCESS, attrs contains an array of
% * attributes.
% */
struct cms_get_entry_attr_res_item {
CSA_return_code stat;
cms_key key;
CSA_uint32 num_attrs;
cms_attribute *attrs;
struct cms_get_entry_attr_res_item *next;
};
%
%
%/*
% * cms_get_entry_attr_res - used by CMS_GET_ENTRY_ATTR
% *
% * If stat is CSA_SUCCESS, entries contains an array of
% * cms_get_entry_attr_res_item structures.
% */
struct cms_get_entry_attr_res {
CSA_return_code stat;
cms_get_entry_attr_res_item *entries;
};
%
%
%/*
% * cms_get_entry_attr_args - used by CMS_GET_ENTRY_ATTR
% */
struct cms_get_entry_attr_args {
cms_name cal;
u_int num_keys;
cms_key *keys;
CSA_uint32 num_names;
cms_attr_name *names;
};
%
%
%/*
% * cms_entry_res
% *
% * If stat is CSA_SUCCESS, entry points to an entry.
% */
struct cms_entry_res {
CSA_return_code stat;
cms_entry *entry;
};
%
%
%/*
% * cms_insert_args - used by CMS_INSERT_ENTRY
% */
struct cms_insert_args {
cms_name cal;
int pid;
CSA_uint32 num_attrs;
cms_attribute *attrs;
};
%
%
%/*
% * cms_update_args - used by CMS_UPDATE_ENTRY
% */
struct cms_update_args {
cms_name cal;
int pid;
cms_key entry;
int scope;
CSA_uint32 num_attrs;
cms_attribute *attrs;
};
%
%
%/*
% * cms_delete_args - used by CMS_DELETE_ENTRY
% */
struct cms_delete_args {
cms_name cal;
int pid;
cms_key entry;
int scope;
};
#endif /* RPC_HDR */
program TABLEPROG {
/* RPC Language description of the calendar protocol */
version TABLEVERS {
void
CMS_PING(void) = 0;
/*
* List all calendars supported by the server.
*/
cms_list_calendars_res
CMS_LIST_CALENDARS(void) = 1;
/*
* Check existence of the calendar.
* Names and tags of all calendar attribute
* will be returned.
*/
cms_open_res
CMS_OPEN_CALENDAR(cms_open_args) = 2;
/*
* Create a calendar and initialize it with
* the given attributes.
*/
CSA_return_code
CMS_CREATE_CALENDAR(cms_create_args) = 3;
/*
* Remove the calendar.
*/
CSA_return_code
CMS_REMOVE_CALENDAR(cms_remove_args) = 4;
/*
* Register client for callbacks.
*/
CSA_return_code
CMS_REGISTER(cms_register_args) = 5;
/*
* Unregister the client.
*/
CSA_return_code
CMS_UNREGISTER(cms_register_args) = 6;
/*
* Enumerate all calendar attributes.
*/
cms_enumerate_calendar_attr_res
CMS_ENUMERATE_CALENDAR_ATTR(cms_name) = 7;
/*
* Get calendar attribute values.
*/
cms_get_cal_attr_res
CMS_GET_CALENDAR_ATTR(cms_get_cal_attr_args) = 8;
/*
* Set calendar attribute values.
*/
CSA_return_code
CMS_SET_CALENDAR_ATTR(cms_set_cal_attr_args) = 9;
/*
* Get data to be archived.
*/
cms_archive_res
CMS_ARCHIVE(cms_archive_args) = 10;
/*
* Restore data to the calendar.
*/
CSA_return_code
CMS_RESTORE(cms_restore_args) = 11;
/*
* Lookup reminders relative to the given tick.
*/
cms_reminder_res
CMS_LOOKUP_REMINDER(cms_reminder_args) = 12;
/*
* Lookup entries that match the given criteria.
* Attribute values of predefined attributes are returned.
* For other attributes, only the names are
* returned but not the values.
*/
cms_entries_res
CMS_LOOKUP_ENTRIES(cms_lookup_entries_args) = 13;
/*
* Lookup instances of a repeating entry
* The attribute list specify the entry
* id and a time range.
* If the entry repeats indefinitely,
* the time range is mandatory.
*/
cms_entries_res
CMS_ENUMERATE_SEQUENCE(cms_enumerate_args) = 14;
/*
* Get entry attribute values.
*/
cms_get_entry_attr_res
CMS_GET_ENTRY_ATTR(cms_get_entry_attr_args) = 15;
/*
* Insert an entry.
*/
cms_entry_res
CMS_INSERT_ENTRY(cms_insert_args) = 16;
/*
* Update an entry.
*/
cms_entry_res
CMS_UPDATE_ENTRY(cms_update_args) = 17;
/*
* Delete an entry.
*/
CSA_return_code
CMS_DELETE_ENTRY(cms_delete_args) = 18;
} = 5;
} = 100068;

137
cde/lib/csa/cmcb.h Normal file
View File

@@ -0,0 +1,137 @@
/* $XConsortium: cmcb.h /main/1 1996/04/21 19:21:59 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#ifndef _CMCB_H
#define _CMCB_H
#ifndef SunOS
#include <rpc/types.h>
#endif
#include <rpc/rpc.h>
#ifdef __cplusplus
extern "C" {
#endif
#include "csa.h"
#include "cm.h"
/*
* cal_attr_data - contain names of calendar attributes updated
*/
struct cmcb_cal_attr_data {
u_int num_names;
cms_name *names;
};
typedef struct cmcb_cal_attr_data cmcb_cal_attr_data;
/*
* add_entry_data - contain information of the deleted entry
*/
struct cmcb_add_entry_data {
char *id;
};
typedef struct cmcb_add_entry_data cmcb_add_entry_data;
/*
* delete_entry_data - contain information of the deleted entry
*/
struct cmcb_delete_entry_data {
char *id;
int scope;
long time;
};
typedef struct cmcb_delete_entry_data cmcb_delete_entry_data;
/*
* update_entry_data - contain information of the updated entry
* if new entry id is not resulted from the update, oldid will be
* set to a NULL string ("").
*/
struct cmcb_update_entry_data {
char *newid;
char *oldid;
int scope;
long time;
};
typedef struct cmcb_update_entry_data cmcb_update_entry_data;
/*
* update_data - contains the update reason and specific information
* about the update. No additional data is provided for CSA_CALENDAR_LOGON,
* CSA_CALENDAR_DELETED, and CSA_CALENDAR_ATTRIBUTE_UPDATED
*/
struct cmcb_update_data {
int reason;
union {
cmcb_cal_attr_data *cdata; /* data for cal attrs update */
cmcb_add_entry_data *adata; /* data for CSA_ENTRY_ADDED */
cmcb_delete_entry_data *ddata; /* data for CSA_ENTRY_DELETED */
cmcb_update_entry_data *udata; /* data for CSA_ENTRY_UPDATED */
} data;
};
typedef struct cmcb_update_data cmcb_update_data;
struct cmcb_update_callback_args {
char *calendar;
char *user;
cmcb_update_data data;
};
typedef struct cmcb_update_callback_args cmcb_update_callback_args;
#define AGENTVERS_2 ((unsigned long)(2))
#if defined(__STDC__) || defined(__cplusplus)
#define CMCB_UPDATE_CALLBACK ((unsigned long)(1))
extern void * cmcb_update_callback_2(cmcb_update_callback_args *, CLIENT *);
extern void * cmcb_update_callback_2_svc(cmcb_update_callback_args *, struct svc_req *);
extern int agentprog_2_freeresult(SVCXPRT *, xdrproc_t, caddr_t);
#else /* K&R C */
#define CMCB_UPDATE_CALLBACK ((unsigned long)(1))
extern void * cmcb_update_callback_2();
extern void * cmcb_update_callback_2_svc();
extern int agentprog_2_freeresult();
#endif /* K&R C */
/* the xdr functions */
#if defined(__STDC__) || defined(__cplusplus)
extern bool_t xdr_cmcb_cal_attr_data(XDR *, cmcb_cal_attr_data*);
extern bool_t xdr_cmcb_add_entry_data(XDR *, cmcb_add_entry_data*);
extern bool_t xdr_cmcb_delete_entry_data(XDR *, cmcb_delete_entry_data*);
extern bool_t xdr_cmcb_update_entry_data(XDR *, cmcb_update_entry_data*);
extern bool_t xdr_cmcb_update_data(XDR *, cmcb_update_data*);
extern bool_t xdr_cmcb_update_callback_args(XDR *, cmcb_update_callback_args*);
#else /* K&R C */
extern bool_t xdr_cmcb_cal_attr_data();
extern bool_t xdr_cmcb_add_entry_data();
extern bool_t xdr_cmcb_delete_entry_data();
extern bool_t xdr_cmcb_update_entry_data();
extern bool_t xdr_cmcb_update_data();
extern bool_t xdr_cmcb_update_callback_args();
#endif /* K&R C */
#ifdef __cplusplus
}
#endif
#ifdef HPUX
#undef hpux
#define hpux
#endif
#endif

111
cde/lib/csa/cmcb.x Normal file
View File

@@ -0,0 +1,111 @@
/*******************************************************************************
**
** cmcb.x
**
** static char sccsid[] = "@(#)cmcb.x 1.3 94/09/22 Copyr 1991 Sun Microsystems, Inc.";
**
** $XConsortium: cmcb.x /main/1 1996/04/21 19:22:02 drk $
**
** RESTRICTED CONFIDENTIAL INFORMATION:
**
** The information in this document is subject to special
** restrictions in a confidential disclosure agreement between
** HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
** document outside HP, IBM, Sun, USL, SCO, or Univel without
** Sun's specific written approval. This document and all copies
** and derivative works thereof must be returned or destroyed at
** Sun's request.
**
** Copyright 1993 Sun Microsystems, Inc. All rights reserved.
**
*******************************************************************************/
/*
* Calendar manager service callback RPC protocol.
*/
#if defined(RPC_HDR) || defined(RPC_XDR)
%
%#include "csa.h"
%#include "cm.h"
%
%
%/*
% * cal_attr_data - contain names of calendar attributes updated
% *
% */
struct cmcb_cal_attr_data {
u_int num_names;
cms_name *names;
};
%
%/*
% * add_entry_data - contain information of the deleted entry
% */
struct cmcb_add_entry_data {
string id<>;
};
%
%/*
% * delete_entry_data - contain information of the deleted entry
% */
struct cmcb_delete_entry_data {
string id<>;
int scope;
time_t time;
};
%
%/*
% * update_entry_data - contain information of the updated entry
% * if new entry id is not resulted from the update, oldid will be
% * set to a NULL string ("").
% */
struct cmcb_update_entry_data {
string newid<>;
string oldid<>;
int scope;
time_t time;
};
%
%/*
% * update_data - contains the update reason and specific information
% * about the update. No additional data is provided for CSA_CALENDAR_LOGON,
% * CSA_CALENDAR_DELETED, and CSA_CALENDAR_ATTRIBUTE_UPDATED
% */
%struct cmcb_update_data {
% int reason;
% union {
% cmcb_cal_attr_data *cdata; /* data for cal attrs updated */
% cmcb_add_entry_data *adata; /* data for CSA_ENTRY_ADDED */
% cmcb_delete_entry_data *ddata; /* data for CSA_ENTRY_DELETED */
% cmcb_update_entry_data *udata; /* data for CSA_ENTRY_UPDATED */
% } data;
%};
%typedef struct cmcb_update_data cmcb_update_data;
%
struct cmcb_update_callback_args {
string calendar<>;
string user<>;
cmcb_update_data data;
};
#endif /* RPC_HDR */
/*
* The AGENTPROG actually isn't used for callback.
* A transient number will be generated instead. It's
* just declared here as a "syntax" holder for rpcgen
*/
program AGENTPROG {
version AGENTVERS_2 {
void CMCB_UPDATE_CALLBACK(cmcb_update_callback_args) = 1;
} = 2;
} = 0;

142
cde/lib/csa/cmcbxdr.c Normal file
View File

@@ -0,0 +1,142 @@
/* $XConsortium: cmcbxdr.c /main/1 1996/04/21 19:22:05 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
/*
* xdr routines for v2 callback protocol data structures
*/
#include <EUSCompat.h>
#include "cmcb.h"
#include "csa.h"
/*
* cal_attr_data - contain names of calendar attributes updated
*/
bool_t
xdr_cmcb_cal_attr_data(register XDR *xdrs, cmcb_cal_attr_data *objp)
{
register long *buf;
if (!xdr_array(xdrs, (char **)&objp->names, (u_int *) &objp->num_names,
~0, sizeof (cms_name), (xdrproc_t) xdr_cms_name))
return (FALSE);
return (TRUE);
}
/*
* add_entry_data - contain information of the deleted entry
*/
bool_t
xdr_cmcb_add_entry_data(register XDR *xdrs, cmcb_add_entry_data *objp)
{
register long *buf;
if (!xdr_string(xdrs, &objp->id, ~0))
return (FALSE);
return (TRUE);
}
/*
* delete_entry_data - contain information of the deleted entry
*/
bool_t
xdr_cmcb_delete_entry_data(register XDR *xdrs, cmcb_delete_entry_data *objp)
{
register long *buf;
if (!xdr_string(xdrs, &objp->id, ~0))
return (FALSE);
if (!xdr_int(xdrs, &objp->scope))
return (FALSE);
if (!xdr_long(xdrs, &objp->time))
return (FALSE);
return (TRUE);
}
/*
* update_entry_data - contain information of the updated entry
* if new entry id is not resulted from the update, oldid will be
* set to a NULL string ("").
*/
bool_t
xdr_cmcb_update_entry_data(register XDR *xdrs, cmcb_update_entry_data *objp)
{
register long *buf;
if (!xdr_string(xdrs, &objp->newid, ~0))
return (FALSE);
if (!xdr_string(xdrs, &objp->oldid, ~0))
return (FALSE);
if (!xdr_int(xdrs, &objp->scope))
return (FALSE);
if (!xdr_long(xdrs, &objp->time))
return (FALSE);
return (TRUE);
}
bool_t
xdr_cmcb_update_data(register XDR *xdrs, cmcb_update_data *objp)
{
register long *buf;
if (!xdr_int(xdrs, &objp->reason))
return (FALSE);
switch (objp->reason) {
case CSA_CB_CALENDAR_ATTRIBUTE_UPDATED:
if (!xdr_pointer(xdrs, (char **)&objp->data.cdata,
sizeof (cmcb_cal_attr_data),
(xdrproc_t) xdr_cmcb_cal_attr_data))
return (FALSE);
break;
case CSA_CB_ENTRY_ADDED:
if (!xdr_pointer(xdrs, (char **)&objp->data.adata,
sizeof (cmcb_add_entry_data),
(xdrproc_t) xdr_cmcb_add_entry_data))
return (FALSE);
break;
case CSA_CB_ENTRY_DELETED:
if (!xdr_pointer(xdrs, (char **)&objp->data.ddata,
sizeof (cmcb_delete_entry_data),
(xdrproc_t) xdr_cmcb_delete_entry_data))
return (FALSE);
break;
case CSA_CB_ENTRY_UPDATED:
if (!xdr_pointer(xdrs, (char **)&objp->data.udata,
sizeof (cmcb_update_entry_data),
(xdrproc_t) xdr_cmcb_update_entry_data))
return (FALSE);
break;
}
return (TRUE);
}
bool_t
xdr_cmcb_update_callback_args(register XDR *xdrs, cmcb_update_callback_args *objp)
{
register long *buf;
if (!xdr_string(xdrs, &objp->calendar, ~0))
return (FALSE);
if (!xdr_string(xdrs, &objp->user, ~0))
return (FALSE);
if (!xdr_cmcb_update_data(xdrs, &objp->data))
return (FALSE);
return (TRUE);
}

157
cde/lib/csa/cmsdata.c Normal file
View File

@@ -0,0 +1,157 @@
/* $XConsortium: cmsdata.c /main/1 1996/04/21 19:22:08 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#include <EUSCompat.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "csa.h"
#include "cmsdata.h"
#include "nametbl.h"
#include "attr.h"
/* standard calendar attr name and entry attr name table */
_DtCmNameTable *_DtCm_cal_name_tbl = NULL;
_DtCmNameTable *_DtCm_entry_name_tbl = NULL;
/*
* allocate a cms_entry structure and initialized with
* all the library defined attribute names
*/
extern cms_entry *
_DtCm_make_cms_entry(_DtCmNameTable *tbl)
{
int i;
cms_entry *ptr;
if ((ptr = (cms_entry *)calloc(1, sizeof(cms_entry))) == NULL)
return (NULL);
/* initialize the entry with attribute names */
if ((ptr->attrs = (cms_attribute *)calloc(1,
sizeof(cms_attribute)*(tbl->size + 1))) == NULL) {
free(ptr);
return (NULL);
}
for (i = 1; i <= tbl->size; i++) {
if ((ptr->attrs[i].name.name = strdup(tbl->names[i])) == NULL) {
/* clean up */
ptr->num_attrs = i - 1;
_DtCm_free_cms_entry(ptr);
return (NULL);
}
ptr->attrs[i].name.num = i;
}
ptr->num_attrs = tbl->size;
return (ptr);
}
extern CSA_return_code
_DtCm_copy_cms_entry(cms_entry *e, cms_entry **e_r)
{
cms_entry *ptr;
CSA_return_code stat;
if (e == NULL || e_r == NULL)
return (CSA_E_INVALID_PARAMETER);
if ((ptr = (cms_entry *)calloc(1, sizeof(cms_entry))) == NULL)
return (CSA_E_INSUFFICIENT_MEMORY);
if ((stat = _DtCm_copy_cms_attributes(e->num_attrs, e->attrs,
&ptr->num_attrs, &ptr->attrs)) != CSA_SUCCESS) {
free(ptr);
return (stat);
} else {
ptr->key = e->key;
*e_r = ptr;
return (CSA_SUCCESS);
}
}
extern void
_DtCm_free_cms_entry(cms_entry *entry)
{
if (entry == NULL)
return;
if (entry->num_attrs > 0) {
_DtCm_free_cms_attributes(entry->num_attrs + 1, entry->attrs);
free(entry->attrs);
}
free(entry);
}
extern void
_DtCm_free_cms_entries(cms_entry *entry)
{
cms_entry *ptr;
while (entry) {
ptr = entry->next;
_DtCm_free_cms_entry(entry);
entry = ptr;
}
}
extern void
_DtCm_init_hash()
{
static boolean_t done = B_FALSE;
if (done == B_FALSE) {
/* need to check whether table is actually created */
_DtCm_cal_name_tbl = _DtCm_make_name_table(
_DtCM_DEFINED_CAL_ATTR_SIZE,
_CSA_calendar_attribute_names);
_DtCm_entry_name_tbl = _DtCm_make_name_table(
_DtCM_DEFINED_ENTRY_ATTR_SIZE,
_CSA_entry_attribute_names);
done = B_TRUE;
}
}
/*
* attr->name.num contains the correct index for the attribute
*/
extern CSA_return_code
_DtCmGrowAttrArray(uint *num_attrs, cms_attribute **attrs, cms_attribute *attr)
{
cms_attribute *newptr;
CSA_return_code stat;
int index;
index = attr->name.num;
if ((newptr = (cms_attribute *)realloc(*attrs,
sizeof(cms_attribute) * (index + 1))) == NULL)
return (CSA_E_INSUFFICIENT_MEMORY);
else {
*attrs = newptr;
memset((void *)&(*attrs)[*num_attrs+1], NULL,
sizeof(cms_attribute) * (index - *num_attrs));
}
if ((stat = _DtCm_copy_cms_attribute(&(*attrs)[index], attr, B_TRUE))
== CSA_SUCCESS) {
*num_attrs = index;
}
return (stat);
}

38
cde/lib/csa/cmsdata.h Normal file
View File

@@ -0,0 +1,38 @@
/* $XConsortium: cmsdata.h /main/1 1996/04/21 19:22:11 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#ifndef _CMSDATA_H
#define _CMSDATA_H
#include <EUSCompat.h>
#include "ansi_c.h"
#include "nametbl.h"
#include "cm.h"
/* standard calendar attr name and entry attr name table */
extern _DtCmNameTable *_DtCm_cal_name_tbl;
extern _DtCmNameTable *_DtCm_entry_name_tbl;
extern void _DtCm_init_hash P(());
extern cms_entry *_DtCm_make_cms_entry P((_DtCmNameTable *tbl));
extern CSA_return_code _DtCm_copy_cms_entry P((
cms_entry *e,
cms_entry **e_r));
extern void _DtCm_free_cms_entry P((cms_entry *entry));
extern void _DtCm_free_cms_entries P((cms_entry *entry));
extern CSA_return_code _DtCmGrowAttrArray P((
uint *num_attr,
cms_attribute **attrs,
cms_attribute *attr));
#endif

834
cde/lib/csa/cmxdr.c Normal file
View File

@@ -0,0 +1,834 @@
/* $XConsortium: cmxdr.c /main/1 1996/04/21 19:22:14 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
/*
* xdr routines for xapia csa data structures
*/
#include <EUSCompat.h>
#include "cm.h"
#include "csa.h"
#include "cmxdr.h"
/* Functions generated by rtable4.x */
/*
* time_t is a typedef which is system dependent
*/
bool_t
xdr_time_t(register XDR *xdrs, time_t *objp)
{
#ifdef __osf__
if (!xdr_int(xdrs, objp))
return (FALSE);
#else
if (!xdr_long(xdrs, objp))
return (FALSE);
#endif
return (TRUE);
}
/*
* cms_name - a user name or calendar name which is
* variable length character string
*/
bool_t
xdr_cms_name(register XDR *xdrs, cms_name *objp)
{
register long *buf;
if (!xdr_string(xdrs, objp, ~0))
return (FALSE);
return (TRUE);
}
/*
* cms_access_entry - data structure for the access list attribute
*/
bool_t
xdr_cms_access_entry(register XDR *xdrs, cms_access_entry *objp)
{
register long *buf;
if (!xdr_string(xdrs, &objp->user, ~0))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->rights))
return (FALSE);
if (!xdr_pointer(xdrs, (char **)&objp->next, sizeof (cms_access_entry),
(xdrproc_t) xdr_cms_access_entry))
return (FALSE);
return (TRUE);
}
/*
* cms_key consists of the time and the unique
* identifier of the entry.
*/
bool_t
xdr_cms_key(register XDR *xdrs, cms_key *objp)
{
register long *buf;
if (!xdr_time_t(xdrs, &objp->time))
return (FALSE);
if (!xdr_long(xdrs, &objp->id))
return (FALSE);
return (TRUE);
}
bool_t
xdr_CSA_opaque_data(register XDR *xdrs, CSA_opaque_data *objp)
{
register long *buf;
if (!xdr_bytes(xdrs, (char **)&objp->data, (u_int *) &objp->size, ~0))
return (FALSE);
return (TRUE);
}
bool_t
xdr_CSA_reminder(register XDR *xdrs, CSA_reminder *objp)
{
register long *buf;
if (!xdr_string(xdrs, &objp->lead_time, ~0))
return (FALSE);
if (!xdr_string(xdrs, &objp->snooze_time, ~0))
return (FALSE);
if (!xdr_u_long(xdrs, &objp->repeat_count))
return (FALSE);
if (!xdr_CSA_opaque_data(xdrs, &objp->reminder_data))
return (FALSE);
return (TRUE);
}
bool_t
xdr_CSA_date_time_entry(register XDR *xdrs, CSA_date_time_entry *objp)
{
register long *buf;
if (!xdr_string(xdrs, &objp->date_time, ~0))
return (FALSE);
if (!xdr_pointer(xdrs, (char **)&objp->next,
sizeof (CSA_date_time_entry), (xdrproc_t) xdr_CSA_date_time_entry))
return (FALSE);
return (TRUE);
}
bool_t
xdr_cms_attribute_value(register XDR *xdrs, cms_attribute_value *objp)
{
register long *buf;
if (!xdr_int(xdrs, &objp->type))
return (FALSE);
switch (objp->type) {
case CSA_VALUE_SINT32:
case CSA_VALUE_ENUMERATED:
if (!xdr_long(xdrs, &objp->item.sint32_value))
return (FALSE);
break;
case CSA_VALUE_BOOLEAN:
case CSA_VALUE_FLAGS:
case CSA_VALUE_UINT32:
if (!xdr_u_long(xdrs, &objp->item.uint32_value))
return (FALSE);
break;
case CSA_VALUE_STRING:
case CSA_VALUE_CALENDAR_USER:
case CSA_VALUE_DATE_TIME:
case CSA_VALUE_DATE_TIME_RANGE:
case CSA_VALUE_TIME_DURATION:
if (!xdr_string(xdrs, &objp->item.string_value, ~0))
return (FALSE);
break;
case CSA_VALUE_ACCESS_LIST:
if (!xdr_pointer(xdrs, (char **)&objp->item.access_list_value,
sizeof (cms_access_entry),
(xdrproc_t) xdr_cms_access_entry))
return (FALSE);
break;
case CSA_VALUE_DATE_TIME_LIST:
if (!xdr_pointer(xdrs,
(char **)&objp->item.date_time_list_value,
sizeof (CSA_date_time_entry),
(xdrproc_t) xdr_CSA_date_time_entry))
return (FALSE);
break;
case CSA_VALUE_REMINDER:
if (!xdr_pointer(xdrs,
(char **)&objp->item.reminder_value,
sizeof (CSA_reminder), (xdrproc_t) xdr_CSA_reminder))
return (FALSE);
break;
case CSA_VALUE_OPAQUE_DATA:
if (!xdr_pointer(xdrs, (char **)&objp->item.opaque_data_value,
sizeof (CSA_opaque_data), (xdrproc_t) xdr_CSA_opaque_data))
return (FALSE);
break;
}
return (TRUE);
}
/*
* num contains the hashed number for the associated name assigned
* by the server. Client should not change its value.
* If it's zero, name is not hashed yet.
*/
bool_t
xdr_cms_attr_name(register XDR *xdrs, cms_attr_name *objp)
{
register long *buf;
if (!xdr_short(xdrs, &objp->num))
return (FALSE);
if (!xdr_string(xdrs, &objp->name, ~0))
return (FALSE);
return (TRUE);
}
/*
*
*/
bool_t
xdr_cms_attribute(register XDR *xdrs, cms_attribute *objp)
{
register long *buf;
if (!xdr_cms_attr_name(xdrs, &objp->name))
return (FALSE);
if (!xdr_pointer(xdrs, (char **)&objp->value,
sizeof (CSA_attribute_value), (xdrproc_t) xdr_cms_attribute_value))
return (FALSE);
return (TRUE);
}
/*
* An entry is identified by an identifier unique within the calendar
* and has a variable number of attributes associated with it.
*/
bool_t
xdr_cms_entry(register XDR *xdrs, cms_entry *objp)
{
register long *buf;
if (!xdr_cms_key(xdrs, &objp->key))
return (FALSE);
if (!xdr_array(xdrs, (char **)&objp->attrs, (u_int *) &objp->num_attrs,
~0, sizeof (cms_attribute), (xdrproc_t) xdr_cms_attribute))
return (FALSE);
if (!xdr_pointer(xdrs, (char **)&objp->next, sizeof (cms_entry),
(xdrproc_t) xdr_cms_entry))
return (FALSE);
return (TRUE);
}
/*
* cms_enumerate_calendar_attr_res
*
* If stat is CSA_SUCCESS, names contains an array of names.
*/
bool_t
xdr_cms_enumerate_calendar_attr_res(register XDR *xdrs, cms_enumerate_calendar_attr_res *objp)
{
register long *buf;
if (!xdr_u_long(xdrs, &objp->stat))
return (FALSE);
if (!xdr_array(xdrs, (char **)&objp->names, (u_int *) &objp->num_names,
~0, sizeof (cms_attr_name), (xdrproc_t) xdr_cms_attr_name))
return (FALSE);
return (TRUE);
}
/*
* cms_list_calendars_res
*
* If stat is CSA_SUCCESS, names contains an array of names.
*/
bool_t
xdr_cms_list_calendars_res(register XDR *xdrs, cms_list_calendars_res *objp)
{
register long *buf;
if (!xdr_u_long(xdrs, &objp->stat))
return (FALSE);
if (!xdr_array(xdrs, (char **)&objp->names, (u_int *) &objp->num_names,
~0, sizeof (cms_name), (xdrproc_t) xdr_cms_name))
return (FALSE);
return (TRUE);
}
/*
* cms_open_args - used by CMS_OPEN_CALENDAR
*/
bool_t
xdr_cms_open_args(register XDR *xdrs, cms_open_args *objp)
{
register long *buf;
if (!xdr_string(xdrs, &objp->cal, ~0))
return (FALSE);
if (!xdr_int(xdrs, &objp->pid))
return (FALSE);
return (TRUE);
}
/*
* cms_open_res - returned by CMS_OPEN_CALENDAR
*
* If stat is DtCm_OK,
* svr_vers contains the version number of the server,
* file_vers contains the version number of the callog file,
* user_access is the calling user's access right to the calendar
* num_attrs indicates the size of the array pointed to by attrs,
* and attrs contains an array of calendar attributes.
*/
bool_t
xdr_cms_open_res(register XDR *xdrs, cms_open_res *objp)
{
register long *buf;
if (!xdr_u_long(xdrs, &objp->stat))
return (FALSE);
if (!xdr_int(xdrs, &objp->svr_vers))
return (FALSE);
if (!xdr_int(xdrs, &objp->file_vers))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->user_access))
return (FALSE);
if (!xdr_array(xdrs, (char **)&objp->attrs, &objp->num_attrs,
~0, sizeof (cms_attribute), (xdrproc_t) xdr_cms_attribute))
return (FALSE);
return (TRUE);
}
/*
* cms_create_args - used by CMS_CREATE_CALENDAR
*/
bool_t
xdr_cms_create_args(register XDR *xdrs, cms_create_args *objp)
{
register long *buf;
if (!xdr_string(xdrs, &objp->cal, ~0))
return (FALSE);
if (!xdr_string(xdrs, &objp->char_set, ~0))
return (FALSE);
if (!xdr_int(xdrs, &objp->pid))
return (FALSE);
if (!xdr_array(xdrs, (char **)&objp->attrs, (u_int *) &objp->num_attrs,
~0, sizeof (cms_attribute), (xdrproc_t) xdr_cms_attribute))
return (FALSE);
return (TRUE);
}
/*
* cms_remove_args - used by CMS_REMOVE_CALENDAR
*/
bool_t
xdr_cms_remove_args(register XDR *xdrs, cms_remove_args *objp)
{
register long *buf;
if (!xdr_string(xdrs, &objp->cal, ~0))
return (FALSE);
if (!xdr_int(xdrs, &objp->pid))
return (FALSE);
return (TRUE);
}
/*
* cms_register_args - used by CMS_REGISTER and CMS_UNREGISTER
*/
bool_t
xdr_cms_register_args(register XDR *xdrs, cms_register_args *objp)
{
register long *buf;
if (!xdr_string(xdrs, &objp->cal, ~0))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->update_type))
return (FALSE);
if (!xdr_u_long(xdrs, &objp->prognum))
return (FALSE);
if (!xdr_u_long(xdrs, &objp->versnum))
return (FALSE);
if (!xdr_u_long(xdrs, &objp->procnum))
return (FALSE);
if (!xdr_int(xdrs, &objp->pid))
return (FALSE);
return (TRUE);
}
/*
* cms_get_cal_attr_res - used by CMS_GET_CALENDAR_ATTR
*
* If stat is CSA_SUCCESS, attrs contains an array of attributes.
*/
bool_t
xdr_cms_get_cal_attr_res(register XDR *xdrs, cms_get_cal_attr_res *objp)
{
register long *buf;
if (!xdr_u_long(xdrs, &objp->stat))
return (FALSE);
if (!xdr_array(xdrs, (char **)&objp->attrs, (u_int *) &objp->num_attrs,
~0, sizeof (cms_attribute), (xdrproc_t) xdr_cms_attribute))
return (FALSE);
return (TRUE);
}
/*
* cms_get_cal_attr_args - used by CMS_GET_CALENDAR_ATTR
*/
bool_t
xdr_cms_get_cal_attr_args(register XDR *xdrs, cms_get_cal_attr_args *objp)
{
register long *buf;
if (!xdr_string(xdrs, &objp->cal, ~0))
return (FALSE);
if (!xdr_array(xdrs, (char **)&objp->names, (u_int *) &objp->num_names,
~0, sizeof (cms_attr_name), (xdrproc_t) xdr_cms_attr_name))
return (FALSE);
return (TRUE);
}
/*
* cms_set_cal_attr_args - used by CMS_SET_CALENDAR_ATTR
*/
bool_t
xdr_cms_set_cal_attr_args(register XDR *xdrs, cms_set_cal_attr_args *objp)
{
register long *buf;
if (!xdr_string(xdrs, &objp->cal, ~0))
return (FALSE);
if (!xdr_int(xdrs, &objp->pid))
return (FALSE);
if (!xdr_array(xdrs, (char **)&objp->attrs, (u_int *) &objp->num_attrs,
~0, sizeof (cms_attribute), (xdrproc_t) xdr_cms_attribute))
return (FALSE);
return (TRUE);
}
/*
* cms_archive_res - used by CMS_ARCHIVE
*
* If stat is CSA_SUCCESS, data contains the data to be archived
*/
bool_t
xdr_cms_archive_res(register XDR *xdrs, cms_archive_res *objp)
{
register long *buf;
if (!xdr_u_long(xdrs, &objp->stat))
return (FALSE);
if (!xdr_string(xdrs, &objp->data, ~0))
return (FALSE);
return (TRUE);
}
/*
* cms_archive_args - used by CMS_ARCHIVE
*/
bool_t
xdr_cms_archive_args(register XDR *xdrs, cms_archive_args *objp)
{
register long *buf;
if (!xdr_string(xdrs, &objp->cal, ~0))
return (FALSE);
if (!xdr_bool(xdrs, &objp->delete))
return (FALSE);
if (!xdr_string(xdrs, &objp->char_set, ~0))
return (FALSE);
if (!xdr_array(xdrs, (char **)&objp->attrs, (u_int *) &objp->num_attrs,
~0, sizeof (cms_attribute), (xdrproc_t) xdr_cms_attribute))
return (FALSE);
if (!xdr_array(xdrs, (char **)&objp->ops, (u_int *) &objp->num_attrs,
~0, sizeof (CSA_enum), (xdrproc_t) xdr_long))
return (FALSE);
return (TRUE);
}
/*
* cms_restore_args - used by CMS_RESTORE
*/
bool_t
xdr_cms_restore_args(register XDR *xdrs, cms_restore_args *objp)
{
register long *buf;
if (!xdr_string(xdrs, &objp->cal, ~0))
return (FALSE);
if (!xdr_string(xdrs, &objp->data, ~0))
return (FALSE);
if (!xdr_string(xdrs, &objp->char_set, ~0))
return (FALSE);
if (!xdr_array(xdrs, (char **)&objp->attrs, (u_int *) &objp->num_attrs,
~0, sizeof (cms_attribute), (xdrproc_t) xdr_cms_attribute))
return (FALSE);
if (!xdr_array(xdrs, (char **)&objp->ops, (u_int *) &objp->num_attrs,
~0, sizeof (CSA_enum), (xdrproc_t) xdr_long))
return (FALSE);
return (TRUE);
}
/*
* cms_reminder
*/
bool_t
xdr_cms_reminder_ref(register XDR *xdrs, cms_reminder_ref *objp)
{
register long *buf;
if (!xdr_string(xdrs, &objp->reminder_name, ~0))
return (FALSE);
if (!xdr_string(xdrs, &objp->entryid, ~0))
return (FALSE);
if (!xdr_cms_key(xdrs, &objp->key))
return (FALSE);
if (!xdr_time_t(xdrs, &objp->runtime))
return (FALSE);
if (!xdr_pointer(xdrs, (char **)&objp->next, sizeof (cms_reminder_ref),
(xdrproc_t) xdr_cms_reminder_ref))
return (FALSE);
return (TRUE);
}
/*
* cms_reminder_res - used by CMS_LOOKUP_REMINDER
*
* If stat is CSA_SUCCESS, rems contains an array of reminders.
*/
bool_t
xdr_cms_reminder_res(register XDR *xdrs, cms_reminder_res *objp)
{
register long *buf;
if (!xdr_u_long(xdrs, &objp->stat))
return (FALSE);
if (!xdr_pointer(xdrs, (char **)&objp->rems, sizeof (cms_reminder_ref),
(xdrproc_t) xdr_cms_reminder_ref))
return (FALSE);
return (TRUE);
}
/*
* cms_reminder_args - used by CMS_LOOKUP_REMINDER
*/
bool_t
xdr_cms_reminder_args(register XDR *xdrs, cms_reminder_args *objp)
{
register long *buf;
if (!xdr_string(xdrs, &objp->cal, ~0))
return (FALSE);
if (!xdr_time_t(xdrs, &objp->tick))
return (FALSE);
if (!xdr_array(xdrs, (char **)&objp->names, (u_int *) &objp->num_names,
~0, sizeof (cms_attr_name), (xdrproc_t) xdr_cms_attr_name))
return (FALSE);
return (TRUE);
}
/*
* cms_entries_res
*
* If stat is CSA_SUCCESS, entries contains an array of entries.
*/
bool_t
xdr_cms_entries_res(register XDR *xdrs, cms_entries_res *objp)
{
register long *buf;
if (!xdr_u_long(xdrs, &objp->stat))
return (FALSE);
if (!xdr_pointer(xdrs, (char **)&objp->entries, sizeof (cms_entry),
(xdrproc_t) xdr_cms_entry))
return (FALSE);
return (TRUE);
}
/*
* cms_lookup_entries_args - used by CMS_LOOKUP_ENTRIES
*/
bool_t
xdr_cms_lookup_entries_args(register XDR *xdrs, cms_lookup_entries_args *objp)
{
register long *buf;
if (!xdr_string(xdrs, &objp->cal, ~0))
return (FALSE);
if (!xdr_string(xdrs, &objp->char_set, ~0))
return (FALSE);
if (!xdr_array(xdrs, (char **)&objp->attrs, (u_int *) &objp->num_attrs,
~0, sizeof (cms_attribute), (xdrproc_t) xdr_cms_attribute))
return (FALSE);
if (!xdr_array(xdrs, (char **)&objp->ops, (u_int *) &objp->num_attrs,
~0, sizeof (CSA_enum), (xdrproc_t) xdr_long))
return (FALSE);
return (TRUE);
}
/*
* cms_enumerate_args - used by CMS_ENUERATE_SEQUENCE
*/
bool_t
xdr_cms_enumerate_args(register XDR *xdrs, cms_enumerate_args *objp)
{
register long *buf;
if (!xdr_string(xdrs, &objp->cal, ~0))
return (FALSE);
if (!xdr_long(xdrs, &objp->id))
return (FALSE);
if (!xdr_long(xdrs, &objp->start))
return (FALSE);
if (!xdr_long(xdrs, &objp->end))
return (FALSE);
return (TRUE);
}
/*
* If stat is CSA_SUCCESS, attrs contains an array of
* attributes.
*/
bool_t
xdr_cms_get_entry_attr_res_item(
register XDR *xdrs,
cms_get_entry_attr_res_item *objp)
{
register long *buf;
if (!xdr_u_long(xdrs, &objp->stat))
return (FALSE);
if (!xdr_cms_key(xdrs, &objp->key))
return (FALSE);
if (!xdr_array(xdrs, (char **)&objp->attrs, (u_int *) &objp->num_attrs,
~0, sizeof (cms_attribute), (xdrproc_t) xdr_cms_attribute))
return (FALSE);
if (!xdr_pointer(xdrs, (char **)&objp->next,
sizeof (cms_get_entry_attr_res_item),
(xdrproc_t) xdr_cms_get_entry_attr_res_item))
return (FALSE);
return (TRUE);
}
/*
* cms_get_entry_attr_res - used by CMS_GET_ENTRY_ATTR
*
* If stat is CSA_SUCCESS, entries contains an array of
* cms_get_entry_attr_res_item structures.
*/
bool_t
xdr_cms_get_entry_attr_res(register XDR *xdrs, cms_get_entry_attr_res *objp)
{
register long *buf;
if (!xdr_u_long(xdrs, &objp->stat))
return (FALSE);
if (!xdr_pointer(xdrs, (char **)&objp->entries,
sizeof (cms_get_entry_attr_res_item),
(xdrproc_t) xdr_cms_get_entry_attr_res_item))
return (FALSE);
return (TRUE);
}
/*
* cms_get_entry_attr_args - used by CMS_GET_ENTRY_ATTR
*/
bool_t
xdr_cms_get_entry_attr_args(register XDR *xdrs, cms_get_entry_attr_args *objp)
{
register long *buf;
if (!xdr_string(xdrs, &objp->cal, ~0))
return (FALSE);
if (!xdr_array(xdrs, (char **)&objp->keys, (u_int *) &objp->num_keys,
~0, sizeof (cms_key), (xdrproc_t) xdr_cms_key))
return (FALSE);
if (!xdr_array(xdrs, (char **)&objp->names, (u_int *) &objp->num_names,
~0, sizeof (cms_attr_name), (xdrproc_t) xdr_cms_attr_name))
return (FALSE);
return (TRUE);
}
/*
* cms_entry_res
*
* If stat is CSA_SUCCESS, entry points to an entry.
*/
bool_t
xdr_cms_entry_res(register XDR *xdrs, cms_entry_res *objp)
{
register long *buf;
if (!xdr_u_long(xdrs, &objp->stat))
return (FALSE);
if (!xdr_pointer(xdrs, (char **)&objp->entry, sizeof (cms_entry),
(xdrproc_t) xdr_cms_entry))
return (FALSE);
return (TRUE);
}
/*
* cms_insert_args - used by CMS_INSERT_ENTRY
*/
bool_t
xdr_cms_insert_args(register XDR *xdrs, cms_insert_args *objp)
{
register long *buf;
if (!xdr_string(xdrs, &objp->cal, ~0))
return (FALSE);
if (!xdr_int(xdrs, &objp->pid))
return (FALSE);
if (!xdr_array(xdrs, (char **)&objp->attrs, (u_int *) &objp->num_attrs,
~0, sizeof (cms_attribute), (xdrproc_t) xdr_cms_attribute))
return (FALSE);
return (TRUE);
}
/*
* cms_update_args - used by CMS_UPDATE_ENTRY
*/
bool_t
xdr_cms_update_args(register XDR *xdrs, cms_update_args *objp)
{
register long *buf;
if (!xdr_string(xdrs, &objp->cal, ~0))
return (FALSE);
if (!xdr_int(xdrs, &objp->pid))
return (FALSE);
if (!xdr_cms_key(xdrs, &objp->entry))
return (FALSE);
if (!xdr_int(xdrs, &objp->scope))
return (FALSE);
if (!xdr_array(xdrs, (char **)&objp->attrs, (u_int *) &objp->num_attrs,
~0, sizeof (cms_attribute), (xdrproc_t) xdr_cms_attribute))
return (FALSE);
return (TRUE);
}
/*
* cms_delete_args - used by CMS_DELETE_ENTRY
*/
bool_t
xdr_cms_delete_args(register XDR *xdrs, cms_delete_args *objp)
{
register long *buf;
if (!xdr_string(xdrs, &objp->cal, ~0))
return (FALSE);
if (!xdr_int(xdrs, &objp->pid))
return (FALSE);
if (!xdr_cms_key(xdrs, &objp->entry))
return (FALSE);
if (!xdr_int(xdrs, &objp->scope))
return (FALSE);
return (TRUE);
}

43
cde/lib/csa/cmxdr.h Normal file
View File

@@ -0,0 +1,43 @@
/* $XConsortium: cmxdr.h /main/1 1996/04/21 19:22:17 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#ifndef _CMXDR_H
#define _CMXDR_H
#include <EUSCompat.h>
#include "ansi_c.h"
#include "csa.h"
/*
* xdr routines for xapia csa data structures
*/
bool_t xdr_CSA_extension P((XDR *xdrs, CSA_extension *objp));
bool_t xdr_CSA_date_time_entry P((XDR *xdrs, CSA_date_time_entry *objp));
bool_t xdr_CSA_date_time_list P((XDR *xdrs, CSA_date_time_list *objp));
bool_t xdr_CSA_calendar_user P((XDR *xdrs, CSA_calendar_user *objp));
bool_t xdr_CSA_access_rights P((XDR *xdrs, CSA_access_rights *objp));
bool_t xdr_CSA_access_list P((XDR *xdrs, CSA_access_list *objp));
bool_t xdr_CSA_attendee P((XDR *xdrs, CSA_attendee *objp));
bool_t xdr_CSA_attendee_list P((XDR *xdrs, CSA_attendee_list *objp));
bool_t xdr_CSA_opaque_data P((XDR *xdrs, CSA_opaque_data *objp));
bool_t xdr_CSA_reminder P((XDR *xdrs, CSA_reminder *objp));
bool_t xdr_CSA_attribute_value P((XDR *xdrs, CSA_attribute_value *objp));
#endif

908
cde/lib/csa/connection.c Normal file
View File

@@ -0,0 +1,908 @@
/* $TOG: connection.c /main/4 1999/10/14 17:47:12 mgreess $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
/*
* This file manages server connections.
*/
#include <EUSCompat.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <fcntl.h>
#ifdef HPUX
#include <sys/resource.h>
#endif
#include "connection.h"
#include "rtable2.h"
#include "rtable3.h"
#include "rtable4.h"
#include "cm.h"
#include "debug.h"
#include "agent.h"
#include "convert2-4.h"
#include "convert3-4.h"
#include "rpccalls.h"
#ifdef HPUX
#define MAX_COUNT 10
#else
#define MAX_COUNT 40
#endif
static struct timeval timeout_tv;
static struct timeval retry_tv;
static AUTH *unix_credential = NULL;
static tcp_count = 0;
static cl_count = 0;
static _DtCm_Client_Info *client_cache_head = NULL;
static _DtCm_Client_Info *client_cache_tail = NULL;
static char *svcfmt = "Error on server %s\n";
/*****************************************************************************
* forward declaration of static functions.
*****************************************************************************/
static void create_auth(CLIENT *cl);
static void destroy_auth(CLIENT *cl);
static _DtCm_Client_Info * get_client_info(char *host, int version);
static void destroy_target_list(_DtCm_Target_List *tlist);
static void destroy_client_info(_DtCm_Client_Info *ci);
static void insert_client_info(_DtCm_Client_Info *ci);
static void delete_client_info(_DtCm_Client_Info *oldci);
static void cleanup_some_connection(_DtCm_Client_Info *dontclose);
static void check_registration(_DtCm_Connection *conn);
static _DtCm_Client_Info * get_new_client_handle(_DtCm_Connection *conn);
#ifdef __osf__
static CSA_return_code get_client_handle(const char *host, const u_int prognum,
u_long *vers_outp, const u_long vers_low,
const u_long vers_high, char *nettype,
CLIENT **clnt);
#else
static CSA_return_code get_client_handle(const char *host, const u_long prognum,
u_long *vers_outp, const u_long vers_low,
const u_long vers_high, char *nettype,
CLIENT **clnt);
#endif
static CSA_return_code regstat4_to_dtcmstatus(Registration_Status_4 stat4);
extern CSA_return_code
_DtCm_create_udp_client(
char *host,
int version,
int timeout,
_DtCm_Client_Info **clnt)
{
CSA_return_code stat;
_DtCm_Client_Info *ci;
u_long vers_out;
CLIENT *cl=NULL;
if (host == NULL || clnt == NULL)
return (CSA_E_INVALID_PARAMETER);
/* if client info is found, we have at least the udp handle */
if (((*clnt) = get_client_info(host, version)) != NULL) {
return (CSA_SUCCESS);
}
#if defined(SunOS) || defined(USL) || defined(__uxp__)
cl = clnt_create_vers(host, TABLEPROG,
&vers_out, TABLEVERS_2, version, "udp");
if (cl==NULL) {
_DtCm_print_errmsg(clnt_spcreateerror(host));
return (_DtCm_clntstat_to_csastat(rpc_createerr.cf_stat));
}
#else
stat = get_client_handle(host, (u_int)TABLEPROG, &vers_out, TABLEVERS_2,
version, "udp", &cl);
if (stat != CSA_SUCCESS)
return (stat);
#endif
/* if version is lower than requested, check the list again */
if (vers_out < version) {
if ((ci = get_client_info(host, vers_out)) != NULL) {
clnt_destroy(cl);
*clnt = ci;
return (CSA_SUCCESS);
}
}
create_auth(cl);
/* Adjust Timeout */
if (timeout==0) timeout = _DtCM_DEFAULT_TIMEOUT;
timeout_tv.tv_sec = timeout;
timeout_tv.tv_usec = 0;
clnt_control(cl, CLSET_TIMEOUT, (char*)&timeout_tv);
/* UDP only!
time rpc waits for server to reply before retransmission =
'timeout'. since the retry timeout is set to timeout + 10;
this guarantees there won't
be any retransmisssions resulting in duplicate
transactions in the database.
*/
retry_tv.tv_sec = timeout + 10;
retry_tv.tv_usec = 0;
clnt_control(cl, CLSET_RETRY_TIMEOUT, (char*)&retry_tv);
if ((ci = (_DtCm_Client_Info *)calloc(1, sizeof(_DtCm_Client_Info))) == NULL) {
destroy_auth(cl);
clnt_destroy(cl);
return (CSA_E_INSUFFICIENT_MEMORY);
}
if ((ci->host = strdup(host)) == NULL) {
destroy_auth(cl);
clnt_destroy(cl);
free(ci);
return (CSA_E_INSUFFICIENT_MEMORY);
}
ci->udpcl = cl;
ci->vers_out = vers_out;
insert_client_info(ci);
*clnt = ci;
return (CSA_SUCCESS);
}
/*
* Creates tcp client handle. Used for calls that potentially return
* large amount of data. If it fails to create a tcp client handle,
* a udp client handle will be returned.
*/
extern CSA_return_code
_DtCm_create_tcp_client(
char *host,
int version,
int timeout,
_DtCm_Client_Info **clnt)
{
CSA_return_code stat;
_DtCm_Client_Info *ci;
u_long vers_out;
CLIENT *cl=NULL;
if (host == NULL || clnt == NULL)
return (CSA_E_INVALID_PARAMETER);
/* Get a udp client handle. This serves two purposes: */
/* - to get a udp handle for an old server which talks only udp */
/* - to invoke a server through inetd since only udp is registered.*/
if ((stat = _DtCm_create_udp_client(host, version, timeout, &ci))
!= CSA_SUCCESS) {
return (stat);
} else if (ci->tcpcl) {
*clnt = ci;
return (CSA_SUCCESS);
} else {
/* create tcp connection */
#if defined(SunOS) || defined(USL) || defined(__uxp__)
cl = clnt_create_vers(host, TABLEPROG, &vers_out,
TABLEVERS_2, version, "tcp");
#else
stat = get_client_handle(host, (u_int)TABLEPROG, &vers_out,
TABLEVERS_2, version, "tcp", &cl);
#endif
/* if can't create tcp connection, use udp */
if (cl==NULL) {
_DtCm_print_errmsg(clnt_spcreateerror(host));
*clnt = ci;
return (CSA_SUCCESS);
}
create_auth(cl);
/* Adjust Timeout */
if (timeout==0) timeout = _DtCM_DEFAULT_TIMEOUT;
timeout_tv.tv_sec = timeout;
timeout_tv.tv_usec = 0;
clnt_control(cl, CLSET_TIMEOUT, (char*)&timeout_tv);
/* dont need to set vers_out since it should
* be the same as that of the udp transport
*/
ci->tcpcl = cl;
if (++tcp_count > MAX_COUNT)
/* clean up tcp connections */
cleanup_some_connection(ci);
*clnt = ci;
return (CSA_SUCCESS);
}
}
/*
* Used instead of clnt_call by rtableX_clnt.c
*
* Might need locking for the client handle here since
* it might be purged if something's wrong
*/
extern enum clnt_stat
_DtCm_clnt_call(
_DtCm_Connection *conn,
u_long proc,
xdrproc_t inproc,
caddr_t in,
xdrproc_t outproc,
caddr_t out,
struct timeval tout)
{
_DtCm_Client_Info *ci;
_DtCm_Transport_Type ttype;
enum clnt_stat status = RPC_FAILED;
char errbuffer[100];
int retry = conn->retry;
while (B_TRUE) {
if (conn->ci == NULL)
break;
else {
ci = conn->ci;
ci->last_used = time(0);
}
if (conn->use == udp_transport || ci->tcpcl == NULL)
ttype = udp_transport;
else
ttype = tcp_transport;
status = clnt_call((ttype == tcp_transport ? ci->tcpcl :
ci->udpcl), proc, inproc, in,
outproc, out, tout);
if ((ttype == udp_transport && status == RPC_TIMEDOUT) ||
(status == RPC_CANTRECV)) {
if (retry) {
retry--;
/* don't retry when stat is RPC_TIMEDOUT
* and transpart is tcp since if the server
* is down, stat would be something else
* like RPC_CANTRECV
*/
/* get new client handle */
if (get_new_client_handle(conn) == NULL)
break;
} else {
/* purge the client handle */
delete_client_info(conn->ci);
conn->ci = NULL;
break;
}
} else
break;
}
if (status != RPC_SUCCESS && conn->ci != NULL) {
_DtCm_print_errmsg(clnt_sperror((ttype == tcp_transport ? ci->tcpcl :
ci->udpcl), ci->host));
}
conn->stat = status;
return status;
}
extern CSA_return_code
_DtCm_add_registration(
_DtCm_Client_Info *ci,
char *cal,
unsigned long update_type)
{
_DtCm_Target_List *listp, *prev;
_DtCm_Target_List *listitem;
char *host;
int result;
if (ci == NULL || cal == NULL)
return (CSA_E_INVALID_PARAMETER);
for (listp = prev = ci->tlist; listp != NULL;
prev = listp, listp = listp->next) {
if ((result = strcmp(listp->cal, cal)) == 0) {
/* registered already */
return (CSA_SUCCESS);
} else if (result > 0)
break;
}
/* register the first time, insert in list in ascending order */
if ((listitem = (_DtCm_Target_List *)calloc(1, sizeof(_DtCm_Target_List))) == NULL)
return (CSA_E_INSUFFICIENT_MEMORY);
if ((listitem->cal = strdup(cal)) == NULL) {
free(listitem);
return (CSA_E_INSUFFICIENT_MEMORY);
}
listitem->update_type = update_type;
if (prev == NULL || listp == prev)
ci->tlist = listitem;
else
prev->next = listitem;
listitem->next = listp;
ci->nregistered++;
return (CSA_SUCCESS);
}
extern void
_DtCm_remove_registration(_DtCm_Client_Info *ci, char *cal)
{
_DtCm_Target_List *listp, *prev;
_DtCm_Client_Info *c;
int result;
if (cal == NULL) return;
/* if found, just increment the number of registration */
for (listp = prev = ci->tlist; listp != NULL;
prev = listp, listp = listp->next) {
if ((result = strcmp(listp->cal, cal)) == 0) {
if (listp == prev)
ci->tlist = listp->next;
else
prev->next = listp->next;
/* free target item */
free(listp->cal);
free(listp);
/*
* if no calendar is registered, close tcp connection
*/
if (--(ci->nregistered) == 0) {
if (ci->tcpcl) {
destroy_auth(ci->tcpcl);
clnt_destroy(ci->tcpcl);
ci->tcpcl = NULL;
tcp_count--;
}
/* find other tcp connection for the
* same host
*/
for (c = client_cache_head; c != NULL;
c = c->next) {
if ((result = strcmp(c->host,
ci->host)) == 0) {
if (c->nregistered == 0 &&
c->tcpcl) {
destroy_auth(c->tcpcl);
clnt_destroy(c->tcpcl);
c->tcpcl = NULL;
tcp_count--;
}
} else if (result > 0)
break;
}
}
return;
} else if (result > 0)
break;
}
/* not found; impossible */
}
extern CSA_return_code
_DtCm_get_server_rpc_version(char *host, int *version)
{
CSA_return_code stat;
_DtCm_Client_Info *ci;
if (host == NULL) {
return (CSA_E_INVALID_PARAMETER);
}
if ((stat = _DtCm_create_tcp_client(host, TABLEVERS,
_DtCM_INITIAL_TIMEOUT, &ci)) == CSA_SUCCESS)
*version = ci->vers_out;
return (stat);
}
extern CSA_return_code
_DtCm_clntstat_to_csastat(enum clnt_stat clntstat)
{
switch (clntstat) {
#if defined(SunOS) || defined(USL) || defined(__uxp__)
case RPC_N2AXLATEFAILURE:
#endif
case RPC_UNKNOWNHOST:
return (CSA_X_DT_E_INVALID_SERVER_LOCATION);
case RPC_PROGNOTREGISTERED:
return (CSA_X_DT_E_SERVICE_NOT_REGISTERED);
case RPC_TIMEDOUT:
return (CSA_X_DT_E_SERVER_TIMEOUT);
default:
return (CSA_E_SERVICE_UNAVAILABLE);
}
}
/*****************************************************************************
* static functions used within the file
*****************************************************************************/
static void
create_auth(CLIENT *cl)
{
/* Always cache the Unix style credentials. */
if (unix_credential == NULL)
#if defined(SunOS) || defined(USL) || defined(__uxp__)
unix_credential = authsys_create_default ();
#else
unix_credential = authunix_create_default ();
#endif
cl->cl_auth = unix_credential;
}
static void
destroy_auth(CLIENT *cl)
{
/* It is a no-op for unix-authentication because we always cache it.
* But we have to destroy it when secure RPC is used.
*/
}
/*
* Given a host name, find the _DtCm_Client_Info structure which contains
* both udp and tcp handle to the server running in the host.
*/
static _DtCm_Client_Info *
get_client_info(char *host, int version)
{
_DtCm_Client_Info *ci;
int result;
if (host==NULL) return(NULL);
for (ci = client_cache_head; ci != NULL; ci = ci->next) {
if ((result = strcmp(ci->host, host)) == 0) {
if (ci->vers_out <= version)
return(ci);
} else if (result > 0)
break;
}
return(NULL);
}
static void
destroy_target_list(_DtCm_Target_List *tlist)
{
_DtCm_Target_List *listp, *listitem;
for (listp = tlist; listp != NULL; ) {
listitem = listp;
listp = listp->next;
if (listitem->cal)
free(listitem->cal);
free(listitem);
}
}
static void
destroy_client_info(_DtCm_Client_Info *ci)
{
if (ci==NULL) return;
if (ci->host != NULL)
free(ci->host);
if (ci->tcpcl) {
destroy_auth(ci->tcpcl);
clnt_destroy(ci->tcpcl);
tcp_count--;
}
if (ci->udpcl) {
destroy_auth(ci->udpcl);
clnt_destroy(ci->udpcl);
}
destroy_target_list(ci->tlist);
free(ci);
cl_count--;
}
/*
* Dont limit the number of cached connections right now.
* Udp client handle does not use up file descriptor only space.
* Tcp client handle is kept open only when there's at least one
* calendar registered with the host and the user probably won't
* be browsing more than 50 calendar at the same time.
*/
static void
insert_client_info(_DtCm_Client_Info *ci)
{
_DtCm_Client_Info *citem;
if (++cl_count > MAX_COUNT)
cleanup_some_connection(ci);
/* insert new item alphabetically */
for (citem = client_cache_head; citem != NULL; citem = citem->next) {
/* there shouldn't be an entry with the same host name
* if there's, it would be picked up in get_client_info()
*/
if (strcmp(citem->host, ci->host) > 0)
break;
}
if (citem == NULL) {
if (client_cache_head == NULL)
client_cache_head = client_cache_tail = ci;
else {
ci->prev = client_cache_tail;
client_cache_tail->next = ci;
client_cache_tail = ci;
}
} else {
ci->next = citem;
ci->prev = citem->prev;
if (citem == client_cache_head)
client_cache_head = ci;
else
citem->prev->next = ci;
citem->prev = ci;
}
#ifdef CM_DEBUG
fprintf(stderr, "%s: head = %d, tail = %d, newitem = %d\n",
"insert_client_info", client_cache_head,
client_cache_tail, ci);
fprintf(stderr, "tcp_count = %d, cl_count = %d\n", tcp_count, cl_count);
#endif
}
/*
* remove the client info structure from the list
*/
static void
delete_client_info(_DtCm_Client_Info *oldci)
{
if (oldci == NULL) return;
if (oldci == client_cache_head) {
client_cache_head = oldci->next;
if (client_cache_head)
client_cache_head->prev = NULL;
} else if (oldci == client_cache_tail) {
client_cache_tail = oldci->prev;
if (client_cache_tail)
client_cache_tail->next = NULL;
} else {
oldci->prev->next = oldci->next;
oldci->next->prev = oldci->prev;
}
if (oldci == client_cache_tail)
client_cache_tail = NULL;
destroy_client_info(oldci);
#ifdef CM_DEBUG
fprintf(stderr, "%s: head = %d, tail = %d, olditem = %d\n",
"delete_client_info", client_cache_head,
client_cache_tail, oldci);
#endif
}
/*
* Number of open tcp connections reaches the maximum.
* This is very unlikely in the normal case since
* a tcp connection is kept open if at least one calendar
* is registered with the host and a user would not be
* browsing a large number of calendars at one time.
* However, when a calendar is deselected in the calendar
* list on the multi-browser window, a lookup call using
* the tcp connection is made after the calendar is
* deregistered. This keeps the tcp connection open
* even if that's the last calendar registered with the
* host. This routine is used to clean up such tcp connections.
* This is a good time to clean up connections that are not
* used for a long time.
*/
static void
cleanup_some_connection(_DtCm_Client_Info *dontclose)
{
_DtCm_Client_Info *ci, *oldci;
int total = 0, deleted = 0, done = 0;
for (ci = client_cache_head; ci != NULL; )
{
total++;
#ifdef HPUX
/* clean up whole list */
if (ci != dontclose && ci->nregistered == 0) {
#else
if (ci != dontclose && ci->nregistered == 0 &&
(ci->tcpcl || (!done && ci->tcpcl == NULL) ||
(ci->tcpcl==NULL && (time(NULL) - ci->last_used)>DAYSEC)))
{
if (!done) done = 1;
#endif
deleted++;
oldci = ci;
ci = ci->next;
delete_client_info(oldci);
} else
ci = ci->next;
}
#ifdef CM_DEBUG
fprintf(stderr, "%s: total = %d, deleted = %d\n",
"cleanup_tcp_connection", total, deleted);
#endif
}
/*
* check registration
* Deergister the first target:
* if it succeeded, the old server is still running, just re-register it;
* else assume that it's a new server so re-register the whole list again.
*/
static void
check_registration(_DtCm_Connection *conn)
{
_DtCm_Target_List *listp, *prev;
_DtCm_Transport_Type olduse;
CSA_return_code stat;
if (conn->ci->tlist == NULL)
return;
olduse = conn->use;
conn->use = udp_transport;
conn->retry = B_FALSE;
if ((stat = _DtCm_do_unregistration(conn, conn->ci->tlist->cal,
conn->ci->tlist->update_type)) == CSA_SUCCESS) {
if (_DtCm_do_registration(conn, conn->ci->tlist->cal,
conn->ci->tlist->update_type) != CSA_SUCCESS)
{
conn->ci->nregistered--;
listp = conn->ci->tlist;
conn->ci->tlist = listp->next;
free(listp->cal);
free(listp);
}
} else if (stat == CSA_E_CALLBACK_NOT_REGISTERED || stat == CSA_E_FAILURE) {
for (listp = prev = conn->ci->tlist; listp != NULL; ) {
if (_DtCm_do_registration(conn, listp->cal,
listp->update_type) != CSA_SUCCESS)
{
conn->ci->nregistered--;
if (listp == prev)
conn->ci->tlist = prev = listp->next;
else
prev->next = listp->next;
/* free target item */
free(listp->cal);
free(listp);
listp = (prev ? prev->next : NULL);
} else {
prev = listp;
listp = listp->next;
}
}
}
conn->use = olduse;
}
static _DtCm_Client_Info *
get_new_client_handle(_DtCm_Connection *conn)
{
CLIENT *cl;
int oldver;
if (conn == NULL) return(NULL);
oldver = conn->ci->vers_out;
/* always get a udp client handle first */
#if defined(SunOS) || defined(USL) || defined(__uxp__)
cl = clnt_create_vers(conn->ci->host, TABLEPROG, &(conn->ci->vers_out),
TABLEVERS_2, oldver, "udp");
if (cl == NULL) {
_DtCm_print_errmsg(clnt_spcreateerror(conn->ci->host));
}
#else
(void) get_client_handle(conn->ci->host, (u_int)TABLEPROG,
&(conn->ci->vers_out), TABLEVERS_2, oldver,
"udp", &cl);
#endif
if (cl == NULL) {
delete_client_info(conn->ci);
conn->ci = NULL;
return(NULL);
} else {
create_auth(cl);
/* adjust timeout */
timeout_tv.tv_sec = _DtCM_INITIAL_TIMEOUT;
timeout_tv.tv_usec = 0;
clnt_control(cl, CLSET_TIMEOUT, (char *)&timeout_tv);
retry_tv.tv_sec = _DtCM_INITIAL_TIMEOUT + 10;
retry_tv.tv_usec = 0;
clnt_control(cl, CLSET_RETRY_TIMEOUT, (char *)&retry_tv);
destroy_auth(conn->ci->udpcl);
clnt_destroy(conn->ci->udpcl);
conn->ci->udpcl = cl;
}
/* check registration */
/* if there's anything wrong, nregistered could be zero */
check_registration(conn);
/* ci might be set to NULL if an rpc call failed */
if (conn->ci == NULL)
return (NULL);
/* now deal with tcp handle */
/* get rid of old handle first */
if (conn->ci->tcpcl) {
destroy_auth(conn->ci->tcpcl);
clnt_destroy(conn->ci->tcpcl);
tcp_count--;
conn->ci->tcpcl = NULL;
}
if (conn->use == udp_transport) {
return(conn->ci);
} else {
/* get a tcp client handle */
oldver = conn->ci->vers_out;
#if defined(SunOS) || defined(USL) || defined(__uxp__)
cl = clnt_create_vers(conn->ci->host, TABLEPROG,
&(conn->ci->vers_out), TABLEVERS_2, oldver, "tcp");
if (cl == NULL)
_DtCm_print_errmsg(clnt_spcreateerror(conn->ci->host));
#else
(void) get_client_handle(conn->ci->host, (u_int)TABLEPROG,
&(conn->ci->vers_out), TABLEVERS_2, oldver, "tcp",
&cl);
#endif
if (cl == NULL) {
conn->ci->vers_out = oldver;
return(NULL);
} else {
create_auth(cl);
/* adjust timeout */
timeout_tv.tv_sec = _DtCM_INITIAL_TIMEOUT;
timeout_tv.tv_usec = 0;
clnt_control(cl, CLSET_TIMEOUT, (char *)&timeout_tv);
conn->ci->tcpcl = cl;
tcp_count++;
return(conn->ci);
}
}
}
/*
* Get a client handle to a server that supports the highest
* version between the given range.
*/
static CSA_return_code
get_client_handle(
const char *host,
#ifdef __osf__
const u_int prognum,
#else
const u_long prognum,
#endif
u_long *vers_outp,
const u_long vers_low,
const u_long vers_high,
char *nettype,
CLIENT **clnt)
{
CLIENT *cl;
u_int vers;
struct timeval tv;
enum clnt_stat status;
#ifdef HPUX
static int bumped = 0;
struct rlimit rl;
if (bumped == 0) {
bumped = 1;
/* raise the soft limit of number of file descriptor */
getrlimit(RLIMIT_NOFILE, &rl);
rl.rlim_cur = rl.rlim_max;
setrlimit(RLIMIT_NOFILE, &rl);
}
#endif
#ifdef __osf__
/*
* A longer timeout value may be necessay - for example if
* the system is bogged down and/or rpc.cmsd is not running.
*
* The value below is the same value used when a ToolTalk app connects
* to the ToolTalk database server (lib/tt/lib/db/tt_db_client.C).
*/
tv.tv_sec = 4;
#else
tv.tv_sec = 1;
#endif
tv.tv_usec = 0;
*clnt = NULL;
for (vers = vers_high; vers >= vers_low; vers--) {
#if defined(__osf__) || defined(__hpux)
if ((cl = clnt_create((char *)host, prognum, vers, nettype)) != NULL) {
#else
if ((cl = clnt_create(host, prognum, vers, nettype)) != NULL) {
#endif
clnt_control(cl, CLSET_TIMEOUT, (char *)&tv);
status = clnt_call(cl, 0, (xdrproc_t) xdr_void,
(char *)NULL, (xdrproc_t) xdr_void,
(char *)NULL, tv);
if (status == RPC_SUCCESS) {
*vers_outp = vers;
*clnt = cl;
#ifdef __osf__
/*
* Set the timeout back to the original.
*/
tv.tv_sec = 1;
clnt_control(cl, CLSET_TIMEOUT, (char *)&tv);
#endif
return (CSA_SUCCESS);
} else if (status != RPC_PROGVERSMISMATCH) {
return (_DtCm_clntstat_to_csastat(status));
}
} else {
_DtCm_print_errmsg(clnt_spcreateerror((char *) host));
return (_DtCm_clntstat_to_csastat(rpc_createerr.cf_stat));
}
}
/* cannot find a server that supports a version in the given range */
/* Probably will never get here */
return (CSA_E_SERVICE_UNAVAILABLE);
}
static CSA_return_code
regstat4_to_dtcmstatus(Registration_Status_4 stat4)
{
switch (stat4) {
case registered_4:
return (CSA_SUCCESS);
case deregistered_4:
return (CSA_SUCCESS);
case reg_notable_4:
return (CSA_E_CALENDAR_NOT_EXIST);
case failed_4:
case confused_4:
return (CSA_E_FAILURE);
}
}

90
cde/lib/csa/connection.h Normal file
View File

@@ -0,0 +1,90 @@
/* $XConsortium: connection.h /main/1 1996/04/21 19:22:23 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#ifndef _CONNECTION_H
#define _CONNECTION_H
#include <rpc/rpc.h>
#include "ansi_c.h"
#include "csa.h"
#define _DtCM_DEFAULT_TIMEOUT 5
#define _DtCM_INITIAL_TIMEOUT 25
#define _DtCM_LONG_TIMEOUT 60
#define DAYSEC 86400
typedef enum Transport_type
{
tcp_transport,
udp_transport
} _DtCm_Transport_Type;
typedef struct targetlist {
char *cal;
unsigned long update_type;
struct targetlist *next;
} _DtCm_Target_List;
typedef struct cl_info {
char *host;
CLIENT *tcpcl;
CLIENT *udpcl;
u_long vers_out;
long last_used;
int nregistered;
_DtCm_Target_List *tlist;
struct cl_info *next;
struct cl_info *prev;
} _DtCm_Client_Info;
typedef struct conn {
_DtCm_Client_Info *ci;
int retry;
_DtCm_Transport_Type use;
enum clnt_stat stat;
} _DtCm_Connection;
#ifdef SunOS
extern enum clnt_stat _DtCm_clnt_call P((
_DtCm_Connection *conn,
u_long proc,
xdrproc_t inproc,
caddr_t in,
xdrproc_t outproc,
caddr_t out,
struct timeval tout));
#endif
extern CSA_return_code _DtCm_add_registration P((
_DtCm_Client_Info *ci,
char *cal,
unsigned long update_type));
extern void _DtCm_remove_registration P((
_DtCm_Client_Info *ci,
char *cal));
extern CSA_return_code _DtCm_create_udp_client P((
char *host,
int version,
int timeout,
_DtCm_Client_Info **clnt));
extern CSA_return_code _DtCm_create_tcp_client P((
char *host,
int version,
int timeout,
_DtCm_Client_Info **clnt));
extern CSA_return_code _DtCm_get_server_rpc_version P((char *host, int *vers));
extern CSA_return_code _DtCm_clntstat_to_csastat P((enum clnt_stat clntstat));
#endif

629
cde/lib/csa/convert2-4.c Normal file
View File

@@ -0,0 +1,629 @@
/* $XConsortium: convert2-4.c /main/1 1996/04/21 19:22:26 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#include <EUSCompat.h>
#include <malloc.h>
#include <string.h>
#include <stdlib.h>
#include "rtable2.h"
#include "rtable4.h"
#include "convert2-4.h"
/*
* forward declaration of static functions
*/
static Buffer_4 buffer2_to_buffer4(Buffer_2 b);
static void period2_to_period4(Period_2 p2, Period_4 *p4);
static void tag2_to_tag4(Tag_2 t2, Tag_4 *t4);
static Attribute_4 * attr2_to_attr4(Attribute_2 *a2);
static Except_4 * except2_to_except4(Except_2 *e2);
static void id2_to_id4(Id_2 *from, Id_4 *to);
static Uid_4 * uid2_to_uid4(Uid_2 *ui2);
static Appt_4 * appt2_to_appt4(Appt_2 *a2);
static Abb_Appt_4 * abb2_to_abb4(Abb_Appt_2 *a2);
static void apptid2_to_apptid4(Apptid_2 *from, Apptid_4 *to);
static Reminder_4 * reminder2_to_reminder4(Reminder_2 *r2);
static Table_Res_Type_4 tablerestype2_to_tablerestype4(Table_Res_Type_2 t);
static void tablereslist2_to_tablereslist4(Table_Res_List_2 *from,
Table_Res_List_4 *to);
static Access_Entry_4 * acclist2_to_acclist4(Access_Entry_2 *l2);
static Range_4 * range2_to_range4(Range_2 *r2);
static Table_Args_Type_4 argstag2_to_argstag4(Table_Args_Type_2 t);
static void args2_to_args4(Args_2 *from, Args_4 *to);
static Uidopt_4 * uid2_to_uidopt(Uid_2 *uid2, Options_4 opt);
/**************** DATA TYPE (2->4) CONVERSION ROUTINES **************/
extern Access_Status_4
_DtCm_accstat2_to_accstat4(Access_Status_2 s)
{
switch (s) {
case access_ok_2:
return(access_ok_4);
case access_added_2:
return(access_added_4);
case access_removed_2:
return(access_removed_4);
case access_failed_2:
return(access_failed_4);
case access_exists_2:
return(access_exists_4);
case access_partial_2:
return(access_partial_4);
case access_other_2:
default:
return(access_other_4);
}
}
extern Table_Res_4 *
_DtCm_tableres2_to_tableres4(Table_Res_2 *r2)
{
Table_Res_4 *r4;
if (r2==NULL) return((Table_Res_4 *)NULL);
r4 = (Table_Res_4 *)calloc(1, sizeof(Table_Res_4));
r4->status = _DtCm_accstat2_to_accstat4(r2->status);
tablereslist2_to_tablereslist4(&(r2->res), &(r4->res));
return(r4);
}
extern Access_Args_4 *
_DtCm_accargs2_to_accargs4(Access_Args_2 *a2)
{
Access_Args_4 *a4;
if (a2==NULL) return((Access_Args_4 *)NULL);
a4 = (Access_Args_4 *)calloc(1, sizeof(Access_Args_4));
a4->target = buffer2_to_buffer4(a2->target);
a4->access_list = acclist2_to_acclist4(a2->access_list);
return(a4);
}
extern Table_Args_4 *
_DtCm_tableargs2_to_tableargs4(Table_Args_2 *a2)
{
Table_Args_4 *a4;
if (a2==NULL) return((Table_Args_4 *)NULL);
a4 = (Table_Args_4 *)calloc(1, sizeof(Table_Args_4));
a4->target = buffer2_to_buffer4(a2->target);
args2_to_args4(&(a2->args), &(a4->args));
a4->pid = VOIDPID;
return(a4);
}
extern Table_Args_4 *
_DtCm_tabledelargs2_to_tabledelargs4(Table_Args_2 *a2, Options_4 opt)
{
Table_Args_4 *a4;
if (a2 == NULL)
return((Table_Args_4 *)NULL);
a4 = (Table_Args_4 *)calloc(1, sizeof(Table_Args_4));
a4->target = buffer2_to_buffer4(a2->target);
a4->pid = VOIDPID;
a4->args.tag = UIDOPT_4;
a4->args.Args_4_u.uidopt = uid2_to_uidopt(a2->args.Args_2_u.key, opt);
return(a4);
}
extern Registration_Status_4
_DtCm_regstat2_to_regstat4(Registration_Status_2 s)
{
switch(s) {
case registered_2:
return(registered_4);
case failed_2:
return(failed_4);
case deregistered_2:
return(deregistered_4);
case confused_2:
return(confused_4);
default:
return(failed_4);
}
}
extern Registration_4 *
_DtCm_reg2_to_reg4(Registration_2 *r2)
{
Registration_4 *r4, *head, *prev;
prev = head = NULL;
while (r2 != NULL) {
r4 = (Registration_4 *)calloc(1, sizeof(Registration_4));
r4->target = buffer2_to_buffer4(r2->target);
r4->prognum = r2->prognum;
r4->versnum = r2->versnum;
r4->procnum = r2->procnum;
r4->next = NULL;
r4->pid = VOIDPID;
if (head == NULL)
head = r4;
else
prev->next = r4;
prev = r4;
r2 = r2->next;
}
return(head);
}
extern Table_Status_4
_DtCm_tablestat2_to_tablestat4(Table_Status_2 s)
{
switch(s) {
case ok_2:
return(ok_4);
case duplicate_2:
return(duplicate_4);
case badtable_2:
return(badtable_4);
case notable_2:
return(notable_4);
case denied_2:
return(denied_4);
case other_2:
default:
return(other_4);
}
}
static Buffer_4
buffer2_to_buffer4(Buffer_2 b)
{
Buffer_4 copy;
if (b!=NULL)
copy = strdup(b);
else
copy = calloc(1,1);
return(copy);
}
static void
period2_to_period4(Period_2 p2, Period_4 *p4)
{
if (p4==NULL) return;
switch (p2) {
case single_2:
p4->period = single_4;
p4->nth = 0;
break;
case daily_2:
p4->period = daily_4;
p4->nth = 0;
break;
case weekly_2:
p4->period = weekly_4;
p4->nth = 0;
break;
case biweekly_2:
p4->period = biweekly_4;
p4->nth = 0;
break;
case monthly_2:
p4->period = monthly_4;
p4->nth = 0;
break;
case yearly_2:
p4->period = yearly_4;
p4->nth = 0;
break;
case nthWeekday_2:
p4->period = nthWeekday_4;
p4->nth = 0;
break;
case everyNthDay_2:
p4->period = everyNthDay_4;
p4->nth = 0;
break;
case everyNthWeek_2:
p4->period = everyNthWeek_4;
p4->nth = 0;
break;
case everyNthMonth_2:
p4->period = everyNthMonth_4;
p4->nth = 0;
break;
case otherPeriod_2:
p4->period = otherPeriod_4;
p4->nth = 0;
break;
default:
p4->period = single_4;
p4->nth = 0;
break;
}
}
static void
tag2_to_tag4(Tag_2 t2, Tag_4 *t4)
{
if (t4==NULL) return;
switch(t2) {
case appointment_2:
t4->tag = appointment_4;
t4->showtime = B_TRUE;
t4->next = NULL;
break;
case reminder_2:
t4->tag = reminder_4;
t4->showtime = B_FALSE;
t4->next = NULL;
break;
case otherTag_2:
t4->tag = otherTag_4;
t4->showtime = B_FALSE;
t4->next = NULL;
break;
default:
t4->tag = appointment_4;
t4->showtime = B_TRUE;
t4->next = NULL;
break;
}
}
static Attribute_4 *
attr2_to_attr4(Attribute_2 *a2)
{
Attribute_4 *a4, *head, *prev;
prev = head = NULL;
while (a2 != NULL) {
a4 = (Attribute_4 *)calloc(1, sizeof(Attribute_4));
a4->next = NULL;
a4->attr = strdup(a2->attr);
a4->value = strdup(a2->value);
a4->clientdata = NULL;
if (head == NULL)
head = a4;
else
prev->next = a4;
prev = a4;
a2 = a2->next;
}
return(head);
}
static Except_4 *
except2_to_except4(Except_2 *e2)
{
Except_4 *e4, *head, *prev;
prev = head = NULL;
while (e2 != NULL) {
e4 = (Except_4 *)calloc(1, sizeof(Except_4));
e4->ordinal = e2->ordinal;
e4->next=NULL;
if (head == NULL)
head = e4;
else
prev->next = e4;
prev = e4;
e2 = e2->next;
}
return(head);
}
static void
id2_to_id4(Id_2 *from, Id_4 *to)
{
if ((from==NULL) || (to==NULL)) return;
to->tick = from->tick;
to->key = from->key;
}
static Uid_4 *
uid2_to_uid4(Uid_2 *ui2)
{
Uid_4 *ui4, *head, *prev;
prev = head = NULL;
while (ui2 != NULL) {
ui4 = (Uid_4 *)calloc(1, sizeof(Uid_4));
id2_to_id4(&(ui2->appt_id), &(ui4->appt_id));
ui4->next = NULL;
if (head == NULL)
head = ui4;
else
prev->next = ui4;
prev = ui4;
ui2 = ui2->next;
}
return(head);
}
static Appt_4 *
appt2_to_appt4(Appt_2 *a2)
{
Appt_4 *a4, *head, *prev;
prev = head = NULL;
while (a2 != NULL) {
a4 = (Appt_4 *)calloc(1, sizeof(Appt_4));
a4->tag = (Tag_4 *)calloc(1, sizeof(Tag_4));
id2_to_id4(&(a2->appt_id), &(a4->appt_id));
tag2_to_tag4(a2->tag, a4->tag);
a4->duration = a2->duration;
a4->ntimes = a2->ntimes;
a4->what = buffer2_to_buffer4(a2->what);
period2_to_period4(a2->period, &(a4->period));
a4->author = buffer2_to_buffer4(a2->author);
a4->client_data = buffer2_to_buffer4(a2->client_data);
a4->attr = attr2_to_attr4(a2->attr);
/* mailto is being removed from the appt struct proper,
and held instead as client data on the "ml" attribute */
if (a2->mailto != NULL) {
struct Attribute_4 *item = a4->attr;
while(item!=NULL) {
if(strcmp(item->attr, "ml")==0) {
item->clientdata=buffer2_to_buffer4(a2->mailto);
break;
}
item=item->next;
}
}
a4->exception = except2_to_except4(a2->exception);
a4->appt_status = active_4;
a4->privacy = public_4;
a4->next = NULL;
if (head == NULL)
head = a4;
else
prev->next = a4;
prev = a4;
a2 = a2->next;
}
return(head);
}
static Abb_Appt_4 *
abb2_to_abb4(Abb_Appt_2 *a2)
{
Abb_Appt_4 *a4, *head, *prev;
prev = head = NULL;
while (a2 != NULL) {
a4 = (Abb_Appt_4 *)calloc(1, sizeof(Abb_Appt_4));
a4->tag = (Tag_4 *)calloc(1, sizeof(Tag_4));
id2_to_id4(&(a2->appt_id), &(a4->appt_id));
a4->tag->tag = appointment_4;
a4->tag->showtime = B_TRUE;
a4->tag->next = NULL;
a4->what = buffer2_to_buffer4(a2->what);
a4->duration = a2->duration;
period2_to_period4(a2->period, &(a4->period));
a4->appt_status = active_4;
a4->privacy = public_4;
a4->next = NULL;
if (head == NULL)
head = a4;
else
prev->next = a4;
prev = a4;
a2 = a2->next;
}
return(head);
}
static void
apptid2_to_apptid4(Apptid_2 *from, Apptid_4 *to)
{
if (from==NULL || to==NULL) return;
id2_to_id4(from->oid, to->oid);
to->new_appt = appt2_to_appt4(from->new_appt);
/* do_all is the default, the caller needs to
* modify it to the appropriate value
*/
to->option = do_all_4;
}
static Reminder_4 *
reminder2_to_reminder4(Reminder_2 *r2)
{
Reminder_4 *r4, *head, *prev;
Attribute_4 *attr4;
prev = head = NULL;
while (r2 != NULL) {
r4 = (Reminder_4 *)calloc(1, sizeof(Reminder_4));
id2_to_id4(&(r2->appt_id), &(r4->appt_id));
r4->tick = r2->tick;
attr4 = attr2_to_attr4(&(r2->attr));
r4->attr = *attr4;
free(attr4);
r4->next = NULL;
if (head == NULL)
head = r4;
else
prev->next = r4;
prev = r4;
r2 = r2->next;
}
return(head);
}
static Table_Res_Type_4
tablerestype2_to_tablerestype4(Table_Res_Type_2 t)
{
switch(t) {
case AP_2:
return(AP_4);
case RM_2:
return(RM_4);
case AB_2:
return(AB_4);
case ID_2:
return(ID_4);
default:
return(AP_4);
}
}
static void
tablereslist2_to_tablereslist4(Table_Res_List_2 *from, Table_Res_List_4 *to)
{
if (from==NULL || to==NULL) return;
to->tag = tablerestype2_to_tablerestype4(from->tag);
switch (from->tag) {
case AP_2:
to->Table_Res_List_4_u.a = appt2_to_appt4(
from->Table_Res_List_2_u.a);
break;
case RM_2:
to->Table_Res_List_4_u.r = reminder2_to_reminder4(
from->Table_Res_List_2_u.r);
break;
case AB_2:
to->Table_Res_List_4_u.b = abb2_to_abb4(
from->Table_Res_List_2_u.b);
break;
case ID_2:
to->Table_Res_List_4_u.i = uid2_to_uid4(
from->Table_Res_List_2_u.i);
break;
default:
return;
}
}
static Access_Entry_4 *
acclist2_to_acclist4(Access_Entry_2 *l2)
{
Access_Entry_4 *l4, *head, *prev;
prev = head = NULL;
while (l2 != NULL) {
l4 = (Access_Entry_4 *)calloc(1, sizeof(Access_Entry_4));
l4->who = buffer2_to_buffer4(l2->who);
l4->access_type = l2->access_type;
l4->next = NULL;
if (head == NULL)
head = l4;
else
prev->next = l4;
prev = l4;
l2 = l2->next;
}
return(head);
}
static Range_4 *
range2_to_range4(Range_2 *r2)
{
Range_4 *r4, *head, *prev;
prev = head = NULL;
while (r2 != NULL) {
r4 = (Range_4 *)calloc(1, sizeof(Range_4));
r4->key1 = r2->key1;
r4->key2 = r2->key2;
r4->next = NULL;
if (head == NULL)
head = r4;
else
prev->next = r4;
prev = r4;
r2 = r2->next;
}
return(head);
}
static Table_Args_Type_4
argstag2_to_argstag4(Table_Args_Type_2 t)
{
switch(t) {
case TICK_2:
return(TICK_4);
case APPTID_2:
return(APPTID_4);
case UID_2:
return(UID_4);
case APPT_2:
return(APPT_4);
case RANGE_2:
return(RANGE_4);
default:
return(TICK_4);
}
}
static void
args2_to_args4(Args_2 *from, Args_4 *to)
{
if (from==NULL || to==NULL) return;
to->tag = argstag2_to_argstag4(from->tag);
switch(from->tag) {
case TICK_2:
to->Args_4_u.tick = from->Args_2_u.tick;
break;
case APPTID_2:
to->Args_4_u.apptid.oid = (Id_4 *)calloc(1, sizeof(Id_4));
apptid2_to_apptid4(
&(from->Args_2_u.apptid),
&(to->Args_4_u.apptid));
break;
case UID_2:
to->Args_4_u.key = uid2_to_uid4(from->Args_2_u.key);
break;
case APPT_2:
to->Args_4_u.appt = appt2_to_appt4(from->Args_2_u.appt);
break;
case RANGE_2:
to->Args_4_u.range = range2_to_range4(from->Args_2_u.range);
break;
default:
break;
}
}
static Uidopt_4 *
uid2_to_uidopt(Uid_2 *uid2, Options_4 opt)
{
Uidopt_4 *uidopt, *head, *prev;
prev = head = NULL;
while (uid2 != NULL) {
uidopt = (Uidopt_4 *)calloc(1, sizeof(Uidopt_4));
id2_to_id4(&(uid2->appt_id), &(uidopt->appt_id));
uidopt->option = opt;
uidopt->next = NULL;
if (head == NULL)
head = uidopt;
else
prev->next = uidopt;
prev = uidopt;
uid2 = uid2->next;
}
return(head);
}

27
cde/lib/csa/convert2-4.h Normal file
View File

@@ -0,0 +1,27 @@
/* $XConsortium: convert2-4.h /main/1 1996/04/21 19:22:29 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#ifndef _CONVERT2_4_H
#define _CONVERT2_4_H
#include "ansi_c.h"
/* convert2-4.h: conversion routines for rpc.cmsd version 2 to
rpc.cmsd version 4 data types
*/
extern Table_Args_4 *_DtCm_tableargs2_to_tableargs4 P((Table_Args_2*));
extern Table_Args_4 *_DtCm_tabledelargs2_to_tabledelargs4 P((Table_Args_2*, Options_4));
extern Registration_4 *_DtCm_reg2_to_reg4 P((Registration_2*));
extern Access_Args_4 *_DtCm_accargs2_to_accargs4 P((Access_Args_2*));
extern Table_Res_4 *_DtCm_tableres2_to_tableres4 P((Table_Res_2*));
extern Table_Status_4 _DtCm_tablestat2_to_tablestat4 P((Table_Status_2));
extern Access_Status_4 _DtCm_accstat2_to_accstat4 P((Access_Status_2));
extern Registration_Status_4 _DtCm_regstat2_to_regstat4 P((Registration_Status_2));
#endif

696
cde/lib/csa/convert3-4.c Normal file
View File

@@ -0,0 +1,696 @@
/* $XConsortium: convert3-4.c /main/1 1996/04/21 19:22:31 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#include <EUSCompat.h>
#include <malloc.h>
#include <string.h>
#include <stdlib.h>
#include "rtable3.h"
#include "rtable4.h"
#include "convert3-4.h"
/*
* forward declaration of static functions
*/
static void assign_period3to4(Period_3 *p3, Period_4 *p4);
static void assign_tag3to4(Tag_3 *t3, Tag_4 *t4);
static void assign_privacy3to4(Privacy_Level_3 *p3, Privacy_Level_4 *p4);
static void assign_status3to4(Appt_Status_3 *s3, Appt_Status_4 *s4);
static Buffer_4 buffer3_to_buffer4(Buffer_3 b);
static void period3_to_period4(Period_3 *p3, Period_4 *p4);
static Tag_4 * tag3_to_tag4(Tag_3 *t3);
static Attribute_4 * attr3_to_attr4(Attribute_3 *a3);
static Except_4 * except3_to_except4(Except_3 *e3);
static void id3_to_id4(Id_3 *from, Id_4 *to);
static Uid_4 * uid3_to_uid4(Uid_3 *ui3);
static Appt_4 * appt3_to_appt4(Appt_3 *a3);
static Abb_Appt_4 * abb3_to_abb4(Abb_Appt_3 *a3);
static void apptid3_to_apptid4(Apptid_3 *from, Apptid_4 *to);
static Reminder_4 * reminder3_to_reminder4(Reminder_3 *r3);
static Table_Res_Type_4 tablerestype3_to_tablerestype4(Table_Res_Type_3 t);
static void tablereslist3_to_tablereslist4(Table_Res_List_3 *from,
Table_Res_List_4 *to);
static Access_Entry_4 * acclist3_to_acclist4(Access_Entry_3 *l3);
static Range_4 * range3_to_range4(Range_3 *r3);
static Keyrange_4 * keyrange3_to_keyrange4(Keyrange_3 *r3);
static Table_Args_Type_4 argstag3_to_argstag4(Table_Args_Type_3 t);
static void args3_to_args4(Args_3 *from, Args_4 *to);
static Uidopt_4 * uid3_to_uidopt(Uid_3 *uid3, Options_4 opt);
/**************** DATA TYPE (3->4) CONVERSION ROUTINES **************/
extern Access_Status_4
_DtCm_accstat3_to_accstat4(Access_Status_3 s)
{
switch (s) {
case access_ok_3:
return(access_ok_4);
case access_added_3:
return(access_added_4);
case access_removed_3:
return(access_removed_4);
case access_failed_3:
return(access_failed_4);
case access_exists_3:
return(access_exists_4);
case access_partial_3:
return(access_partial_4);
case access_other_3:
default:
return(access_other_4);
}
}
extern Table_Res_4 *
_DtCm_tableres3_to_tableres4(Table_Res_3 *r3)
{
Table_Res_4 *r4;
if (r3==NULL) return((Table_Res_4 *)NULL);
r4 = (Table_Res_4 *)calloc(1, sizeof(Table_Res_4));
r4->status = _DtCm_accstat3_to_accstat4(r3->status);
tablereslist3_to_tablereslist4(&(r3->res), &(r4->res));
return(r4);
}
extern Access_Args_4 *
_DtCm_accargs3_to_accargs4(Access_Args_3 *a3)
{
Access_Args_4 *a4;
if (a3==NULL) return((Access_Args_4 *)NULL);
a4 = (Access_Args_4 *)calloc(1, sizeof(Access_Args_4));
a4->target = buffer3_to_buffer4(a3->target);
a4->access_list = acclist3_to_acclist4(a3->access_list);
return(a4);
}
extern Table_Args_4 *
_DtCm_tableargs3_to_tableargs4(Table_Args_3 *a3)
{
Table_Args_4 *a4;
if (a3==NULL) return((Table_Args_4 *)NULL);
a4 = (Table_Args_4 *)calloc(1, sizeof(Table_Args_4));
a4->target = buffer3_to_buffer4(a3->target);
args3_to_args4(&(a3->args), &(a4->args));
a4->pid = a3->pid;
return(a4);
}
extern Table_Args_4 *
_DtCm_tabledelargs3_to_tabledelargs4(Table_Args_3 *a3, Options_4 opt)
{
Table_Args_4 *a4;
if (a3 == NULL)
return((Table_Args_4 *)NULL);
a4 = (Table_Args_4 *)calloc(1, sizeof(Table_Args_4));
a4->target = buffer3_to_buffer4(a3->target);
a4->pid = a3->pid;
a4->args.tag = UIDOPT_4;
a4->args.Args_4_u.uidopt = uid3_to_uidopt(a3->args.Args_3_u.key, opt);
return(a4);
}
extern Registration_Status_4
_DtCm_regstat3_to_regstat4(Registration_Status_3 s)
{
switch(s) {
case registered_3:
return(registered_4);
case failed_3:
return(failed_4);
case deregistered_3:
return(deregistered_4);
case confused_3:
return(confused_4);
default:
return(failed_4);
}
}
extern Registration_4 *
_DtCm_reg3_to_reg4(Registration_3 *r3)
{
Registration_4 *r4, *head, *prev;
prev = head = NULL;
while (r3 != NULL) {
r4 = (Registration_4 *)calloc(1, sizeof(Registration_4));
r4->target = buffer3_to_buffer4(r3->target);
r4->prognum = r3->prognum;
r4->versnum = r3->versnum;
r4->procnum = r3->procnum;
r4->next = NULL;
r4->pid = r3->pid;
if (head == NULL)
head = r4;
else
prev->next = r4;
prev = r4;
r3 = r3->next;
}
return(head);
}
extern Table_Status_4
_DtCm_tablestat3_to_tablestat4(Table_Status_3 s)
{
switch(s) {
case ok_3:
return(ok_4);
case duplicate_3:
return(duplicate_4);
case badtable_3:
return(badtable_4);
case notable_3:
return(notable_4);
case denied_3:
return(denied_4);
case other_3:
default:
return(other_4);
}
}
static void
assign_period3to4(Period_3 *p3, Period_4 *p4)
{
switch (p3->period) {
case single_3: p4->period = single_4;
break;
case daily_3: p4->period = daily_4;
break;
case weekly_3: p4->period = weekly_4;
break;
case biweekly_3: p4->period = biweekly_4;
break;
case monthly_3: p4->period = monthly_4;
break;
case yearly_3: p4->period = yearly_4;
break;
case nthWeekday_3: p4->period = nthWeekday_4;
break;
case everyNthDay_3: p4->period = everyNthDay_4;
break;
case everyNthWeek_3: p4->period = everyNthWeek_4;
break;
case everyNthMonth_3: p4->period = everyNthMonth_4;
break;
case otherPeriod_3: p4->period = otherPeriod_4;
break;
}
}
static void
assign_tag3to4(Tag_3 *t3, Tag_4 *t4)
{
switch (t3->tag) {
case appointment_3: t4->tag = appointment_4;
break;
case reminder_3: t4->tag = reminder_4;
break;
case otherTag_3: t4->tag = otherTag_4;
break;
case holiday_3: t4->tag = holiday_4;
break;
case toDo_3: t4->tag = toDo_4;
break;
}
}
static void
assign_privacy3to4(Privacy_Level_3 *p3, Privacy_Level_4 *p4)
{
switch (*p3) {
case public_3: *p4 = public_4;
break;
case private_3: *p4 = private_4;
break;
case semiprivate_3: *p4 = semiprivate_4;
break;
}
}
static void
assign_status3to4(Appt_Status_3 *s3, Appt_Status_4 *s4)
{
switch (*s3) {
case active_3: *s4 = active_4;
break;
case pendingAdd_3: *s4 = pendingAdd_4;
break;
case pendingDelete_3: *s4 = pendingDelete_4;
break;
case committed_3: *s4 = committed_4;
break;
case cancelled_3: *s4 = cancelled_4;
break;
case completed_3: *s4 = completed_4;
break;
}
}
static Buffer_4
buffer3_to_buffer4(Buffer_3 b)
{
Buffer_4 copy;
if (b!=NULL)
copy = strdup(b);
else
copy = calloc(1, 1);
return(copy);
}
static void
period3_to_period4(Period_3 *p3, Period_4 *p4)
{
if (p3 == NULL || p4==NULL) return;
assign_period3to4(p3, p4);
p4->nth = p3->nth;
}
static Tag_4 *
tag3_to_tag4(Tag_3 *t3)
{
Tag_4 *t4, *head, *prev;
prev = head = NULL;
while (t3 != NULL) {
t4 = (Tag_4 *)calloc(1, sizeof(Tag_4));
assign_tag3to4(t3, t4);
t4->showtime = t3->showtime;
t4->next = NULL;
if (head == NULL)
head = t4;
else
prev->next = t4;
prev = t4;
t3 = t3->next;
}
return(head);
}
static Attribute_4 *
attr3_to_attr4(Attribute_3 *a3)
{
Attribute_4 *a4, *head, *prev;
prev = head = NULL;
while (a3 != NULL) {
a4 = (Attribute_4 *)calloc(1, sizeof(Attribute_4));
a4->next = NULL;
a4->attr = buffer3_to_buffer4(a3->attr);
a4->value = buffer3_to_buffer4(a3->value);
a4->clientdata = buffer3_to_buffer4(a3->clientdata);
if (head == NULL)
head = a4;
else
prev->next = a4;
prev = a4;
a3 = a3->next;
}
return(head);
}
static Except_4 *
except3_to_except4(Except_3 *e3)
{
Except_4 *e4, *head, *prev;
prev = head = NULL;
while (e3 != NULL) {
e4 = (Except_4 *)calloc(1, sizeof(Except_4));
e4->ordinal = e3->ordinal;
e4->next=NULL;
if (head == NULL)
head = e4;
else
prev->next = e4;
prev = e4;
e3 = e3->next;
}
return(head);
}
static void
id3_to_id4(Id_3 *from, Id_4 *to)
{
if ((from==NULL) || (to==NULL)) return;
to->tick = from->tick;
to->key = from->key;
}
static Uid_4 *
uid3_to_uid4(Uid_3 *ui3)
{
Uid_4 *ui4, *head, *prev;
prev = head = NULL;
while (ui3 != NULL) {
ui4 = (Uid_4 *)calloc(1, sizeof(Uid_4));
id3_to_id4(&(ui3->appt_id), &(ui4->appt_id));
ui4->next = NULL;
if (head == NULL)
head = ui4;
else
prev->next = ui4;
prev = ui4;
ui3 = ui3->next;
}
return(head);
}
static Appt_4 *
appt3_to_appt4(Appt_3 *a3)
{
Appt_4 *a4, *head, *prev;
prev = head = NULL;
while (a3 != NULL) {
a4 = (Appt_4 *)calloc(1, sizeof(Appt_4));
id3_to_id4(&(a3->appt_id), &(a4->appt_id));
a4->tag = tag3_to_tag4(a3->tag);
a4->duration = a3->duration;
a4->ntimes = a3->ntimes;
a4->what = buffer3_to_buffer4(a3->what);
period3_to_period4(&(a3->period), &(a4->period));
a4->author = buffer3_to_buffer4(a3->author);
a4->client_data = buffer3_to_buffer4(a3->client_data);
a4->exception = except3_to_except4(a3->exception);
a4->attr = attr3_to_attr4(a3->attr);
assign_status3to4(&a3->appt_status, &a4->appt_status);
assign_privacy3to4(&a3->privacy, &a4->privacy);
a4->next = NULL;
if (head == NULL)
head = a4;
else
prev->next = a4;
prev = a4;
a3 = a3->next;
}
return(head);
}
static Abb_Appt_4 *
abb3_to_abb4(Abb_Appt_3 *a3)
{
Abb_Appt_4 *a4, *head, *prev;
prev = head = NULL;
while (a3 != NULL) {
a4 = (Abb_Appt_4 *)calloc(1, sizeof(Abb_Appt_4));
id3_to_id4(&(a3->appt_id), &(a4->appt_id));
a4->tag = tag3_to_tag4(a3->tag);
a4->what = buffer3_to_buffer4(a3->what);
a4->duration = a3->duration;
period3_to_period4(&(a3->period), &(a4->period));
assign_status3to4(&a3->appt_status, &a4->appt_status);
assign_privacy3to4(&a3->privacy, &a4->privacy);
a4->next = NULL;
if (head == NULL)
head = a4;
else
prev->next = a4;
prev = a4;
a3 = a3->next;
}
return(head);
}
static void
apptid3_to_apptid4(Apptid_3 *from, Apptid_4 *to)
{
if (from==NULL || to==NULL) return;
id3_to_id4(from->oid, to->oid);
to->new_appt = appt3_to_appt4(from->new_appt);
/* do_all is the default, the caller needs to
* modify it to the appropriate value
*/
to->option = do_all_4;
}
static Reminder_4 *
reminder3_to_reminder4(Reminder_3 *r3)
{
Reminder_4 *r4, *head, *prev;
Attribute_4 *attr4;
prev = head = NULL;
while (r3 != NULL) {
r4 = (Reminder_4 *)calloc(1, sizeof(Reminder_4));
id3_to_id4(&(r3->appt_id), &(r4->appt_id));
r4->tick = r3->tick;
attr4 = attr3_to_attr4(&(r3->attr));
r4->attr = *attr4;
free(attr4);
r4->next = NULL;
if (head == NULL)
head = r4;
else
prev->next = r4;
prev = r4;
r3 = r3->next;
}
return(head);
}
static Table_Res_Type_4
tablerestype3_to_tablerestype4(Table_Res_Type_3 t)
{
switch(t) {
case AP_3:
return(AP_4);
case RM_3:
return(RM_4);
case AB_3:
return(AB_4);
case ID_3:
return(ID_4);
default:
return(AP_4);
}
}
static void
tablereslist3_to_tablereslist4(Table_Res_List_3 *from, Table_Res_List_4 *to)
{
if (from==NULL || to==NULL) return;
to->tag = tablerestype3_to_tablerestype4(from->tag);
switch (from->tag) {
case AP_3:
to->Table_Res_List_4_u.a = appt3_to_appt4(
from->Table_Res_List_3_u.a);
break;
case RM_3:
to->Table_Res_List_4_u.r = reminder3_to_reminder4(
from->Table_Res_List_3_u.r);
break;
case AB_3:
to->Table_Res_List_4_u.b = abb3_to_abb4(
from->Table_Res_List_3_u.b);
break;
case ID_3:
to->Table_Res_List_4_u.i = uid3_to_uid4(
from->Table_Res_List_3_u.i);
break;
default:
return;
}
}
static Access_Entry_4 *
acclist3_to_acclist4(Access_Entry_3 *l3)
{
Access_Entry_4 *l4, *head, *prev;
prev = head = NULL;
while (l3 != NULL) {
l4 = (Access_Entry_4 *)calloc(1, sizeof(Access_Entry_4));
l4->who = buffer3_to_buffer4(l3->who);
l4->access_type = l3->access_type;
l4->next = NULL;
if (head == NULL)
head = l4;
else
prev->next = l4;
prev = l4;
l3 = l3->next;
}
return(head);
}
static Range_4 *
range3_to_range4(Range_3 *r3)
{
Range_4 *r4, *head, *prev;
prev = head = NULL;
while (r3 != NULL) {
r4 = (Range_4 *)calloc(1, sizeof(Range_4));
r4->key1 = r3->key1;
r4->key2 = r3->key2;
r4->next = NULL;
if (head == NULL)
head = r4;
else
prev->next = r4;
prev = r4;
r3 = r3->next;
}
return(head);
}
static Keyrange_4 *
keyrange3_to_keyrange4(Keyrange_3 *r3)
{
Keyrange_4 *r4, *head, *prev;
prev = head = NULL;
while (r3 != NULL) {
r4 = (Keyrange_4 *)calloc(1, sizeof(Keyrange_4));
r4->key = r3->key;
r4->tick1 = r3->tick1;
r4->tick2 = r3->tick2;
r4->next = NULL;
if (head == NULL)
head = r4;
else
prev->next = r4;
prev = r4;
r3 = r3->next;
}
return(head);
}
static Table_Args_Type_4
argstag3_to_argstag4(Table_Args_Type_3 t)
{
switch(t) {
case TICK_3:
return(TICK_4);
case APPTID_3:
return(APPTID_4);
case UID_3:
return(UID_4);
case APPT_3:
return(APPT_4);
case RANGE_3:
return(RANGE_4);
case KEYRANGE_3:
return(KEYRANGE_4);
default:
return(TICK_4);
}
}
static void
args3_to_args4(Args_3 *from, Args_4 *to)
{
if (from==NULL || to==NULL) return;
to->tag = argstag3_to_argstag4(from->tag);
switch(from->tag) {
case TICK_3:
to->Args_4_u.tick = from->Args_3_u.tick;
break;
case APPTID_3:
to->Args_4_u.apptid.oid = (Id_4 *)calloc(1, sizeof(Id_4));
apptid3_to_apptid4(
&(from->Args_3_u.apptid),
&(to->Args_4_u.apptid));
break;
case UID_3:
to->Args_4_u.key = uid3_to_uid4(from->Args_3_u.key);
break;
case APPT_3:
to->Args_4_u.appt = appt3_to_appt4(from->Args_3_u.appt);
break;
case RANGE_3:
to->Args_4_u.range = range3_to_range4(from->Args_3_u.range);
break;
case KEYRANGE_3:
to->Args_4_u.keyrange = keyrange3_to_keyrange4(
from->Args_3_u.keyrange);
default:
break;
}
}
static Uidopt_4 *
uid3_to_uidopt(Uid_3 *uid3, Options_4 opt)
{
Uidopt_4 *uidopt, *head, *prev;
prev = head = NULL;
while (uid3 != NULL) {
uidopt = (Uidopt_4 *)calloc(1, sizeof(Uidopt_4));
id3_to_id4(&(uid3->appt_id), &(uidopt->appt_id));
uidopt->option = opt;
uidopt->next = NULL;
if (head == NULL)
head = uidopt;
else
prev->next = uidopt;
prev = uidopt;
uid3 = uid3->next;
}
return(head);
}

27
cde/lib/csa/convert3-4.h Normal file
View File

@@ -0,0 +1,27 @@
/* $XConsortium: convert3-4.h /main/1 1996/04/21 19:22:34 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#ifndef _CONVERT3_4_H
#define _CONVERT3_4_H
#include "ansi_c.h"
/* convert3-4.h: conversion routines for rpc.cmsd version 3 to
rpc.cmsd version 4 data types
*/
extern Table_Args_4 *_DtCm_tableargs3_to_tableargs4 P((Table_Args_3*));
extern Table_Args_4 *_DtCm_tabledelargs3_to_tabledelargs4 P((Table_Args_3*, Options_4));
extern Registration_4 *_DtCm_reg3_to_reg4 P((Registration_3*));
extern Access_Args_4 *_DtCm_accargs3_to_accargs4 P((Access_Args_3*));
extern Table_Res_4 *_DtCm_tableres3_to_tableres4 P((Table_Res_3*));
extern Table_Status_4 _DtCm_tablestat3_to_tablestat4 P((Table_Status_3));
extern Access_Status_4 _DtCm_accstat3_to_accstat4 P((Access_Status_3));
extern Registration_Status_4 _DtCm_regstat3_to_regstat4 P((Registration_Status_3));
#endif

620
cde/lib/csa/convert4-2.c Normal file
View File

@@ -0,0 +1,620 @@
/* $XConsortium: convert4-2.c /main/1 1996/04/21 19:22:37 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#include <EUSCompat.h>
#include <malloc.h>
#include <string.h>
#include <stdlib.h>
#include "rtable2.h"
#include "rtable4.h"
#include "convert4-2.h"
/*
* forward declaration of static functions
*/
static void free_excpt2(Except_2 *e);
static Buffer_2 buffer4_to_buffer2(Buffer_4 b);
static Period_2 period4_to_period2(Period_4 *p);
static Tag_2 tag4_to_tag2(Tag_4 *t);
static Attribute_2 * attr4_to_attr2(Attribute_4 *a4);
static Except_2 * except4_to_except2(Except_4 *e4);
static Abb_Appt_2 * abb4_to_abb2(Abb_Appt_4 *a4);
static Reminder_2 * reminder4_to_reminder2(Reminder_4 *r4);
static Table_Res_Type_2 tablerestype4_to_tablerestype2(Table_Res_Type_4 t);
static void tablereslist4_to_tablereslist2(Table_Res_List_4 *from,
Table_Res_List_2 *to);
static Table_Args_Type_2 argstag4_to_argstag2(Table_Args_Type_4 t);
static void args4_to_args2(Args_4 *from, Args_2 *to);
static Table_Args_2 * tableargs4_to_tableargs2(Table_Args_4 *a4);
static Registration_2 * reg4_to_reg2(Registration_4 *r4);
/**************** DATA TYPE (4->2) CONVERSION ROUTINES **************/
extern void
_DtCm_id4_to_id2(Id_4 *from, Id_2 *to)
{
if ((from==NULL) || (to==NULL)) return;
to->tick = from->tick;
to->key = from->key;
}
extern Uid_2 *
_DtCm_uid4_to_uid2(Uid_4 *ui4)
{
Uid_2 *ui2, *head, *prev;
prev = head = NULL;
while (ui4 != NULL) {
ui2 = (Uid_2 *)calloc(1, sizeof(Uid_2));
_DtCm_id4_to_id2(&(ui4->appt_id), &(ui2->appt_id));
ui2->next = NULL;
if (head == NULL)
head = ui2;
else
prev->next = ui2;
prev = ui2;
ui4 = ui4->next;
}
return(head);
}
extern Appt_2 *
_DtCm_appt4_to_appt2(Appt_4 *a4)
{
Appt_2 *a2, *head, *prev;
struct Attribute_4 *item;
prev = head = NULL;
while (a4 != NULL) {
a2 = (Appt_2 *)calloc(1, sizeof(Appt_2));
_DtCm_id4_to_id2(&(a4->appt_id), &(a2->appt_id));
a2->tag = tag4_to_tag2(a4->tag);
a2->duration = a4->duration;
a2->ntimes = a4->ntimes;
a2->what = buffer4_to_buffer2(a4->what);
a2->script = "";
a2->period = period4_to_period2(&(a4->period));
a2->author = buffer4_to_buffer2(a4->author);
a2->client_data = buffer4_to_buffer2(a4->client_data);
a2->attr = attr4_to_attr2(a4->attr);
/* Pick the mailto field out of the attribute list
client data field; put it back into the appt struct
proper.
*/
item = a4->attr;
while(item!=NULL) {
if (strcmp(item->attr, "ml")==0) {
a2->mailto=buffer4_to_buffer2(item->clientdata);
break;
}
item=item->next;
}
a2->exception = except4_to_except2(a4->exception);
a2->next = NULL;
if (head == NULL)
head = a2;
else
prev->next = a2;
prev = a2;
a4 = a4->next;
}
return(head);
}
extern Access_Status_2
_DtCm_accstat4_to_accstat2(Access_Status_4 s)
{
switch(s) {
case access_ok_4:
return(access_ok_2);
case access_added_4:
return(access_added_2);
case access_removed_4:
return(access_removed_2);
case access_failed_4:
return(access_failed_2);
case access_exists_4:
return(access_exists_2);
case access_partial_4:
return(access_partial_2);
case access_other_4:
default:
return(access_other_2);
}
}
extern Table_Res_2 *
_DtCm_tableres4_to_tableres2(Table_Res_4 *r4)
{
Table_Res_2 *r2;
if (r4==NULL) return((Table_Res_2 *)NULL);
r2 = (Table_Res_2 *)calloc(1, sizeof(Table_Res_2));
r2->status = _DtCm_accstat4_to_accstat2(r4->status);
tablereslist4_to_tablereslist2(&(r4->res), &(r2->res));
return(r2);
}
extern Access_Entry_2 *
_DtCm_acclist4_to_acclist2(Access_Entry_4 *l4)
{
Access_Entry_2 *l2, *head, *prev;
prev = head = NULL;
while (l4 != NULL) {
l2 = (Access_Entry_2 *)calloc(1, sizeof(Access_Entry_2));
l2->who = buffer4_to_buffer2(l4->who);
l2->access_type = l4->access_type;
l2->next = NULL;
if (head == NULL)
head = l2;
else
prev->next = l2;
prev = l2;
l4 = l4->next;
}
return(head);
}
extern Access_Args_2 *
_DtCm_accargs4_to_accargs2(Access_Args_4 *a4)
{
Access_Args_2 *a2;
if (a4==NULL) return((Access_Args_2 *)NULL);
a2 = (Access_Args_2 *)calloc(1, sizeof(Access_Args_2));
a2->target = buffer4_to_buffer2(a4->target);
a2->access_list = _DtCm_acclist4_to_acclist2(a4->access_list);
return(a2);
}
extern Range_2 *
_DtCm_range4_to_range2(Range_4 *r4)
{
Range_2 *r2, *head, *prev;
prev = head = NULL;
while (r4 != NULL) {
r2 = (Range_2 *)calloc(1, sizeof(Range_2));
r2->key1 = r4->key1;
r2->key2 = r4->key2;
r2->next = NULL;
if (head == NULL)
head = r2;
else
prev->next = r2;
prev = r2;
r4 = r4->next;
}
return(head);
}
extern Registration_Status_2
_DtCm_regstat4_to_regstat2(Registration_Status_4 s)
{
switch (s) {
case registered_4:
return(registered_2);
case failed_4:
return(failed_2);
case deregistered_4:
return(deregistered_2);
case confused_4:
return(confused_2);
case reg_notable_4:
default:
return(failed_2);
}
}
extern Table_Status_2
_DtCm_tablestat4_to_tablestat2(Table_Status_4 s)
{
switch(s) {
case ok_4:
return(ok_2);
case duplicate_4:
return(duplicate_2);
case badtable_4:
return(badtable_2);
case notable_4:
return(notable_2);
case denied_4:
return(denied_2);
case other_4:
default:
return(other_2);
}
}
extern Uid_2 *
_DtCm_uidopt4_to_uid2(Uidopt_4 *uidopt)
{
Uid_2 *uid2, *head, *prev;
prev = head = NULL;
while (uidopt != NULL) {
uid2 = (Uid_2 *)calloc(1, sizeof(Uid_2));
_DtCm_id4_to_id2(&(uidopt->appt_id), &(uid2->appt_id));
uid2->next = NULL;
if (head == NULL)
head = uid2;
else
prev->next = uid2;
prev = uid2;
uidopt = uidopt->next;
}
return(head);
}
extern void
_DtCm_free_attr2(Attribute_2 *a)
{
Attribute_2 *ptr;
while (a != NULL) {
ptr = a->next;
if (a->attr != NULL)
free(a->attr);
if (a->value != NULL)
free(a->value);
free(a);
a = ptr;
}
}
extern void
_DtCm_free_appt2(Appt_2 *a)
{
Appt_2 *ptr;
while (a != NULL) {
ptr = a->next;
if (a->what != NULL)
free(a->what);
if (a->mailto != NULL)
free(a->mailto);
if (a->script != NULL)
free(a->script);
if (a->author != NULL)
free(a->author);
if (a->client_data != NULL)
free(a->client_data);
if (a->attr != NULL)
_DtCm_free_attr2(a->attr);
if (a->exception != NULL)
free_excpt2(a->exception);
free(a);
a = ptr;
}
}
static void
free_excpt2(Except_2 *e)
{
Except_2 *ptr;
while (e != NULL) {
ptr = e->next;
free(e);
e = ptr;
}
}
static Buffer_2
buffer4_to_buffer2(Buffer_4 b)
{
Buffer_2 copy;
if (b!=NULL)
copy = strdup(b);
else
copy = calloc(1, 1);
return(copy);
}
/*
* Repeating event types beyond "yearly" are mapped to "single"
* because the old front end does not recognize any other types
* Worse yet it uses Period_2 to index into an array which
* contains strings up to "yearly", any period types beyond that
* would index beyond the array and cause the front end to dump core.
*/
static Period_2
period4_to_period2(Period_4 *p)
{
if (p==NULL) return(otherPeriod_2);
switch (p->period) {
case single_4:
return(single_2);
case daily_4:
return(daily_2);
case weekly_4:
return(weekly_2);
case biweekly_4:
return(biweekly_2);
case monthly_4:
return(monthly_2);
case yearly_4:
return(yearly_2);
default:
return(single_2);
}
}
static Tag_2
tag4_to_tag2(Tag_4 *t)
{
if (t==NULL) return(otherTag_2);
switch(t->tag) {
case appointment_4:
return(appointment_2);
case reminder_4:
return(reminder_2);
case otherTag_4:
case holiday_4:
case toDo_4:
default:
return(otherTag_2);
}
}
static Attribute_2 *
attr4_to_attr2(Attribute_4 *a4)
{
Attribute_2 *a2, *head, *prev;
prev = head = NULL;
while (a4 != NULL) {
a2 = (Attribute_2 *)calloc(1, sizeof(Attribute_2));
a2->next = NULL;
a2->attr = strdup(a4->attr);
a2->value = strdup(a4->value);
if (head == NULL)
head = a2;
else
prev->next = a2;
prev = a2;
a4 = a4->next;
}
return(head);
}
static Except_2 *
except4_to_except2(Except_4 *e4)
{
Except_2 *e2, *head, *prev;
prev = head = NULL;
while (e4 != NULL) {
e2 = (Except_2 *)calloc(1, sizeof(Except_2));
e2->ordinal = e4->ordinal;
e2->next=NULL;
if (head == NULL)
head = e2;
else
prev->next = e2;
prev = e2;
e4 = e4->next;
}
return(head);
}
static Abb_Appt_2 *
abb4_to_abb2(Abb_Appt_4 *a4)
{
Abb_Appt_2 *a2, *head, *prev;
prev = head = NULL;
while (a4 != NULL) {
a2 = (Abb_Appt_2 *)calloc(1, sizeof(Abb_Appt_2));
_DtCm_id4_to_id2(&(a4->appt_id), &(a2->appt_id));
a2->what = buffer4_to_buffer2(a4->what);
a2->duration = a4->duration;
a2->period = period4_to_period2(&(a4->period));
a2->next = NULL;
if (head == NULL)
head = a2;
else
prev->next = a2;
prev = a2;
a4 = a4->next;
}
return(head);
}
static void
apptid4_to_apptid2(Apptid_4 *from, Apptid_2 *to)
{
if (from==NULL || to==NULL) return;
_DtCm_id4_to_id2(from->oid, to->oid);
to->new_appt = _DtCm_appt4_to_appt2(from->new_appt);
}
static Reminder_2 *
reminder4_to_reminder2(Reminder_4 *r4)
{
Reminder_2 *r2, *head, *prev;
Attribute_2 *attr2;
prev = head = NULL;
while (r4 != NULL) {
r2 = (Reminder_2 *)calloc(1, sizeof(Reminder_2));
_DtCm_id4_to_id2(&(r4->appt_id), &(r2->appt_id));
r2->tick = r4->tick;
attr2 = attr4_to_attr2(&(r4->attr));
r2->attr = *attr2;
free(attr2);
r2->next = NULL;
if (head == NULL)
head = r2;
else
prev->next = r2;
prev = r2;
r4 = r4->next;
}
return(head);
}
static Table_Res_Type_2
tablerestype4_to_tablerestype2(Table_Res_Type_4 t)
{
switch(t) {
case AP_4:
return(AP_2);
case RM_4:
return(RM_2);
case AB_4:
return(AB_2);
case ID_4:
return(ID_2);
default:
return(AP_2);
}
}
static void
tablereslist4_to_tablereslist2(Table_Res_List_4 *from, Table_Res_List_2 *to)
{
if (from==NULL || to==NULL) return;
to->tag = tablerestype4_to_tablerestype2(from->tag);
switch (from->tag) {
case AP_4:
to->Table_Res_List_2_u.a = _DtCm_appt4_to_appt2(
from->Table_Res_List_4_u.a);
break;
case RM_4:
to->Table_Res_List_2_u.r = reminder4_to_reminder2(
from->Table_Res_List_4_u.r);
break;
case AB_4:
to->Table_Res_List_2_u.b = abb4_to_abb2(
from->Table_Res_List_4_u.b);
break;
case ID_4:
to->Table_Res_List_2_u.i = _DtCm_uid4_to_uid2(
from->Table_Res_List_4_u.i);
default:
return;
}
}
static Table_Args_Type_2
argstag4_to_argstag2(Table_Args_Type_4 t)
{
switch(t) {
case TICK_4:
return(TICK_2);
case APPTID_4:
return(APPTID_2);
case UID_4:
return(UID_2);
case APPT_4:
return(APPT_2);
case RANGE_4:
return(RANGE_2);
default:
return(TICK_2);
}
}
static void
args4_to_args2(Args_4 *from, Args_2 *to)
{
if (from==NULL || to==NULL) return;
to->tag = argstag4_to_argstag2(from->tag);
switch(from->tag) {
case TICK_4:
to->Args_2_u.tick = from->Args_4_u.tick;
break;
case APPTID_4:
to->Args_2_u.apptid.oid = (Id_2 *)calloc(1, sizeof(Id_2));
apptid4_to_apptid2(
&(from->Args_4_u.apptid),
&(to->Args_2_u.apptid));
break;
case UID_4:
to->Args_2_u.key = _DtCm_uid4_to_uid2(from->Args_4_u.key);
break;
case APPT_4:
to->Args_2_u.appt = _DtCm_appt4_to_appt2(from->Args_4_u.appt);
break;
case RANGE_4:
to->Args_2_u.range = _DtCm_range4_to_range2(from->Args_4_u.range);
break;
default:
break;
}
}
static Table_Args_2 *
tableargs4_to_tableargs2(Table_Args_4 *a4)
{
Table_Args_2 *a2;
if (a4==NULL) return((Table_Args_2 *)NULL);
a2 = (Table_Args_2 *)calloc(1, sizeof(Table_Args_2));
a2->target = buffer4_to_buffer2(a4->target);
args4_to_args2(&(a4->args), &(a2->args));
return(a2);
}
static Registration_2 *
reg4_to_reg2(Registration_4 *r4)
{
Registration_2 *r2, *head, *prev;
prev = head = NULL;
while (r4 != NULL) {
r2 = (Registration_2 *)calloc(1, sizeof(Registration_2));
r2->target = buffer4_to_buffer2(r4->target);
r2->prognum = r4->prognum;
r2->versnum = r4->versnum;
r2->procnum = r4->procnum;
r2->next = NULL;
if (head == NULL)
head = r2;
else
prev->next = r2;
prev = r2;
r4 = r4->next;
}
return(head);
}

32
cde/lib/csa/convert4-2.h Normal file
View File

@@ -0,0 +1,32 @@
/* $XConsortium: convert4-2.h /main/1 1996/04/21 19:22:41 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#ifndef _CONVERT4_2_H
#define _CONVERT4_2_H
#include "ansi_c.h"
/* convert4-2.h: conversion routines for rpc.cmsd version 4 to
rpc.cmsd version 2 data types
*/
extern Table_Res_2 *_DtCm_tableres4_to_tableres2 P((Table_Res_4 *));
extern Table_Status_2 _DtCm_tablestat4_to_tablestat2 P((Table_Status_4));
extern Registration_Status_2 _DtCm_regstat4_to_regstat2 P((Registration_Status_4));
extern Access_Status_2 _DtCm_accstat4_to_accstat2 P((Access_Status_4));
extern Access_Args_2 *_DtCm_accargs4_to_accargs2 P((Access_Args_4*));
extern Uid_2 *_DtCm_uid4_to_uid2 P((Uid_4*));
extern Range_2 *_DtCm_range4_to_range2 P((Range_4*));
extern Appt_2 *_DtCm_appt4_to_appt2 P((Appt_4*));
extern void _DtCm_id4_to_id2 P((Id_4*, Id_2*));
extern Access_Entry_2 *_DtCm_acclist4_to_acclist2 P((Access_Entry_4*));
extern Uid_2 *_DtCm_uidopt4_to_uid2 P((Uidopt_4*));
extern void _DtCm_free_attr2 P((Attribute_2 *a));
extern void _DtCm_free_appt2 P((Appt_2 *a));
#endif

747
cde/lib/csa/convert4-3.c Normal file
View File

@@ -0,0 +1,747 @@
/* $XConsortium: convert4-3.c /main/1 1996/04/21 19:22:43 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#include <EUSCompat.h>
#include <malloc.h>
#include <string.h>
#include <stdlib.h>
#include "rtable3.h"
#include "rtable4.h"
#include "convert4-3.h"
/*
* forward declaration of static functions
*/
static void free_excpt3(Except_3 *e);
static Abb_Appt_3 * abb4_to_abb3(Abb_Appt_4 *a4);
static void apptid4_to_apptid3(Apptid_4 *from, Apptid_3 *to);
static Reminder_3 * reminder4_to_reminder3(Reminder_4 *r4);
static Table_Res_Type_3 tablerestype4_to_tablerestype3(Table_Res_Type_4 t);
static void tablereslist4_to_tablereslist3(Table_Res_List_4 *from,
Table_Res_List_3 *to);
static void period4_to_period3(Period_4 *p4, Period_3 *p3);
static void assign_tag4to3(Tag_4 *t4, Tag_3 *t3);
static void assign_status4to3(Appt_Status_4 *s4, Appt_Status_3 *s3);
static void assign_privacy4to3(Privacy_Level_4 *p4, Privacy_Level_3 *p3);
static Buffer_3 buffer4_to_buffer3(Buffer_4 b);
static Tag_3 * tag4_to_tag3(Tag_4 *t4);
static Attribute_3 * attr4_to_attr3(Attribute_4 *a4);
static Except_3 * except4_to_except3(Except_4 *e4);
static Table_Args_Type_3 argstag4_to_argstag3(Table_Args_Type_4 t);
static void args4_to_args3(Args_4 *from, Args_3 *to);
static Table_Args_3 * tableargs4_to_tableargs3(Table_Args_4 *a4);
static Registration_3 * reg4_to_reg3(Registration_4 *r4);
static void free_tag3(Tag_3 *t);
/**************** DATA TYPE (4->3) CONVERSION ROUTINES **************/
extern void
_DtCm_id4_to_id3(Id_4 *from, Id_3 *to)
{
if ((from==NULL) || (to==NULL)) return;
to->tick = from->tick;
to->key = from->key;
}
extern Uid_3 *
_DtCm_uid4_to_uid3(Uid_4 *ui4)
{
Uid_3 *ui3, *head, *prev;
prev = head = NULL;
while (ui4 != NULL) {
ui3 = (Uid_3 *)calloc(1, sizeof(Uid_3));
_DtCm_id4_to_id3(&(ui4->appt_id), &(ui3->appt_id));
ui3->next = NULL;
if (head == NULL)
head = ui3;
else
prev->next = ui3;
prev = ui3;
ui4 = ui4->next;
}
return(head);
}
extern Appt_3 *
_DtCm_appt4_to_appt3(Appt_4 *a4)
{
Appt_3 *a3, *head, *prev;
prev = head = NULL;
while (a4 != NULL) {
a3 = (Appt_3 *)calloc(1, sizeof(Appt_3));
_DtCm_id4_to_id3(&(a4->appt_id), &(a3->appt_id));
a3->tag = tag4_to_tag3(a4->tag);
a3->duration = a4->duration;
a3->ntimes = a4->ntimes;
a3->what = buffer4_to_buffer3(a4->what);
period4_to_period3(&(a4->period), &(a3->period));
a3->author = buffer4_to_buffer3(a4->author);
a3->client_data = buffer4_to_buffer3(a4->client_data);
a3->exception = except4_to_except3(a4->exception);
a3->attr = attr4_to_attr3(a4->attr);
assign_status4to3(&a4->appt_status, &a3->appt_status);
assign_privacy4to3(&a4->privacy, &a3->privacy);
a3->next = NULL;
if (head == NULL)
head = a3;
else
prev->next = a3;
prev = a3;
a4 = a4->next;
}
return(head);
}
extern void
_DtCm_free_appt3(Appt_3 *a)
{
Appt_3 *ptr;
while (a != NULL) {
ptr = a->next;
if (a->tag != NULL)
free_tag3(a->tag);
if (a->what != NULL)
free(a->what);
if (a->author != NULL)
free(a->author);
if (a->client_data != NULL)
free(a->client_data);
if (a->attr != NULL)
_DtCm_free_attr3(a->attr);
if (a->exception != NULL)
free_excpt3(a->exception);
free(a);
a = ptr;
}
}
extern void
_DtCm_free_attr3(Attribute_3 *a)
{
Attribute_3 *ptr;
while (a != NULL) {
ptr = a->next;
if (a->attr != NULL)
free(a->attr);
if (a->value != NULL)
free(a->value);
if (a->clientdata != NULL)
free(a->clientdata);
free(a);
a = ptr;
}
}
static void
free_excpt3(Except_3 *e)
{
Except_3 *ptr;
while (e != NULL) {
ptr = e->next;
free(e);
e = ptr;
}
}
static Abb_Appt_3 *
abb4_to_abb3(Abb_Appt_4 *a4)
{
Abb_Appt_3 *a3, *head, *prev;
prev = head = NULL;
while (a4 != NULL) {
a3 = (Abb_Appt_3 *)calloc(1, sizeof(Abb_Appt_3));
_DtCm_id4_to_id3(&(a4->appt_id), &(a3->appt_id));
a3->tag = tag4_to_tag3(a4->tag);
a3->what = buffer4_to_buffer3(a4->what);
a3->duration = a4->duration;
period4_to_period3(&(a4->period), &(a3->period));
assign_status4to3(&a4->appt_status, &a3->appt_status);
assign_privacy4to3(&a4->privacy, &a3->privacy);
a3->next = NULL;
if (head == NULL)
head = a3;
else
prev->next = a3;
prev = a3;
a4 = a4->next;
}
return(head);
}
static void
apptid4_to_apptid3(Apptid_4 *from, Apptid_3 *to)
{
if (from==NULL || to==NULL) return;
_DtCm_id4_to_id3(from->oid, to->oid);
to->new_appt = _DtCm_appt4_to_appt3(from->new_appt);
}
static Reminder_3 *
reminder4_to_reminder3(Reminder_4 *r4)
{
Reminder_3 *r3, *head, *prev;
Attribute_3 *attr3;
prev = head = NULL;
while (r4 != NULL) {
r3 = (Reminder_3 *)calloc(1, sizeof(Reminder_3));
_DtCm_id4_to_id3(&(r4->appt_id), &(r3->appt_id));
r3->tick = r4->tick;
attr3 = attr4_to_attr3(&(r4->attr));
r3->attr = *attr3;
free(attr3);
r3->next = NULL;
if (head == NULL)
head = r3;
else
prev->next = r3;
prev = r3;
r4 = r4->next;
}
return(head);
}
static Table_Res_Type_3
tablerestype4_to_tablerestype3(Table_Res_Type_4 t)
{
switch(t) {
case AP_4:
return(AP_3);
case RM_4:
return(RM_3);
case AB_4:
return(AB_3);
case ID_4:
return(ID_3);
default:
return(AP_3);
}
}
static void
tablereslist4_to_tablereslist3(Table_Res_List_4 *from, Table_Res_List_3 *to)
{
if (from==NULL || to==NULL) return;
to->tag = tablerestype4_to_tablerestype3(from->tag);
switch (from->tag) {
case AP_4:
to->Table_Res_List_3_u.a = _DtCm_appt4_to_appt3(
from->Table_Res_List_4_u.a);
break;
case RM_4:
to->Table_Res_List_3_u.r = reminder4_to_reminder3(
from->Table_Res_List_4_u.r);
break;
case AB_4:
to->Table_Res_List_3_u.b = abb4_to_abb3(
from->Table_Res_List_4_u.b);
break;
case ID_4:
to->Table_Res_List_3_u.i = _DtCm_uid4_to_uid3(
from->Table_Res_List_4_u.i);
default:
return;
}
}
extern Access_Status_3
_DtCm_accstat4_to_accstat3(Access_Status_4 s)
{
switch(s) {
case access_ok_4:
return(access_ok_3);
case access_added_4:
return(access_added_3);
case access_removed_4:
return(access_removed_3);
case access_failed_4:
return(access_failed_3);
case access_exists_4:
return(access_exists_3);
case access_partial_4:
return(access_partial_3);
case access_other_4:
default:
return(access_other_3);
}
}
extern Table_Res_3 *
_DtCm_tableres4_to_tableres3(Table_Res_4 *r4)
{
Table_Res_3 *r3;
if (r4==NULL) return((Table_Res_3 *)NULL);
r3 = (Table_Res_3 *)calloc(1, sizeof(Table_Res_3));
r3->status = _DtCm_accstat4_to_accstat3(r4->status);
tablereslist4_to_tablereslist3(&(r4->res), &(r3->res));
return(r3);
}
extern Access_Entry_3 *
_DtCm_acclist4_to_acclist3(Access_Entry_4 *l4)
{
Access_Entry_3 *l3, *head, *prev;
prev = head = NULL;
while (l4 != NULL) {
l3 = (Access_Entry_3 *)calloc(1, sizeof(Access_Entry_3));
l3->who = buffer4_to_buffer3(l4->who);
l3->access_type = l4->access_type;
l3->next = NULL;
if (head == NULL)
head = l3;
else
prev->next = l3;
prev = l3;
l4 = l4->next;
}
return(head);
}
extern Access_Args_3 *
_DtCm_accargs4_to_accargs3(Access_Args_4 *a4)
{
Access_Args_3 *a3;
if (a4==NULL) return((Access_Args_3 *)NULL);
a3 = (Access_Args_3 *)calloc(1, sizeof(Access_Args_3));
a3->target = buffer4_to_buffer3(a4->target);
a3->access_list = _DtCm_acclist4_to_acclist3(a4->access_list);
return(a3);
}
extern Range_3 *
_DtCm_range4_to_range3(Range_4 *r4)
{
Range_3 *r3, *head, *prev;
prev = head = NULL;
while (r4 != NULL) {
r3 = (Range_3 *)calloc(1, sizeof(Range_3));
r3->key1 = r4->key1;
r3->key2 = r4->key2;
r3->next = NULL;
if (head == NULL)
head = r3;
else
prev->next = r3;
prev = r3;
r4 = r4->next;
}
return(head);
}
extern Keyrange_3 *
_DtCm_keyrange4_to_keyrange3(Keyrange_4 *r4)
{
Keyrange_3 *r3, *head, *prev;
prev = head = NULL;
while (r4 != NULL) {
r3 = (Keyrange_3 *)calloc(1, sizeof(Keyrange_3));
r3->key = r4->key;
r3->tick1 = r4->tick1;
r3->tick2 = r4->tick2;
r3->next = NULL;
if (head == NULL)
head = r3;
else
prev->next = r3;
prev = r3;
r4 = r4->next;
}
return(head);
}
extern Registration_Status_3
_DtCm_regstat4_to_regstat3(Registration_Status_4 s)
{
switch (s) {
case registered_4:
return(registered_3);
case failed_4:
return(failed_3);
case deregistered_4:
return(deregistered_3);
case confused_4:
return(confused_3);
case reg_notable_4:
default:
return(failed_3);
}
}
extern Table_Status_3
_DtCm_tablestat4_to_tablestat3(Table_Status_4 s)
{
switch(s) {
case ok_4:
return(ok_3);
case duplicate_4:
return(duplicate_3);
case badtable_4:
return(badtable_3);
case notable_4:
return(notable_3);
case denied_4:
return(denied_3);
case other_4:
default:
return(other_3);
}
}
extern Uid_3 *
_DtCm_uidopt4_to_uid3(Uidopt_4 *uidopt)
{
Uid_3 *uid3, *head, *prev;
prev = head = NULL;
while (uidopt != NULL) {
uid3 = (Uid_3 *)calloc(1, sizeof(Uid_3));
_DtCm_id4_to_id3(&(uidopt->appt_id), &(uid3->appt_id));
uid3->next = NULL;
if (head == NULL)
head = uid3;
else
prev->next = uid3;
prev = uid3;
uidopt = uidopt->next;
}
return(head);
}
/*
* Repeating event types beyond "yearly" are mapped to "single"
* because the old front end does not recognize any other types
* Worse yet it uses Interval to index into an array which
* contains strings up to "yearly", any period types beyond that
* would index beyond the array and cause the front end to dump core.
*/
static void
period4_to_period3(Period_4 *p4, Period_3 *p3)
{
if (p3 == NULL || p4 == NULL) return;
switch (p4->period) {
case single_4: p3->period = single_3;
p3->nth = p4->nth;
break;
case daily_4: p3->period = daily_3;
p3->nth = p4->nth;
break;
case weekly_4: p3->period = weekly_3;
p3->nth = p4->nth;
break;
case biweekly_4: p3->period = biweekly_3;
p3->nth = p4->nth;
break;
case monthly_4: p3->period = monthly_3;
p3->nth = p4->nth;
break;
case yearly_4: p3->period = yearly_3;
p3->nth = p4->nth;
break;
default: p3->period = single_3;
p3->nth = 0;
break;
}
}
static void
assign_tag4to3(Tag_4 *t4, Tag_3 *t3)
{
switch (t4->tag) {
case appointment_4: t3->tag = appointment_3;
break;
case reminder_4: t3->tag = reminder_3;
break;
case otherTag_4: t3->tag = otherTag_3;
break;
case holiday_4: t3->tag = holiday_3;
break;
case toDo_4: t3->tag = toDo_3;
break;
}
}
static void
assign_status4to3(Appt_Status_4 *s4, Appt_Status_3 *s3)
{
switch (*s4) {
case active_4: *s3 = active_3;
break;
case pendingAdd_4: *s3 = pendingAdd_3;
break;
case pendingDelete_4: *s3 = pendingDelete_3;
break;
case committed_4: *s3 = committed_3;
break;
case cancelled_4: *s3 = cancelled_3;
break;
case completed_4: *s3 = completed_3;
break;
}
}
static void
assign_privacy4to3(Privacy_Level_4 *p4, Privacy_Level_3 *p3)
{
switch (*p4) {
case public_4: *p3 = public_3;
break;
case private_4: *p3 = private_3;
break;
case semiprivate_4: *p3 = semiprivate_3;
break;
}
}
static Buffer_3
buffer4_to_buffer3(Buffer_4 b)
{
Buffer_3 copy;
if (b!=NULL)
copy = strdup(b);
else
copy = calloc(1, 1);
return(copy);
}
static Tag_3 *
tag4_to_tag3(Tag_4 *t4)
{
Tag_3 *t3, *head, *prev;
prev = head = NULL;
while (t4 != NULL) {
t3 = (Tag_3 *)calloc(1, sizeof(Tag_3));
assign_tag4to3(t4, t3);
t3->showtime = t4->showtime;
t3->next = NULL;
if (head == NULL)
head = t3;
else
prev->next = t3;
prev = t3;
t4 = t4->next;
}
return(head);
}
static Attribute_3 *
attr4_to_attr3(Attribute_4 *a4)
{
Attribute_3 *a3, *head, *prev;
prev = head = NULL;
while (a4 != NULL) {
a3 = (Attribute_3 *)calloc(1, sizeof(Attribute_3));
a3->next = NULL;
a3->attr = buffer4_to_buffer3(a4->attr);
a3->value = buffer4_to_buffer3(a4->value);
a3->clientdata = buffer4_to_buffer3(a4->clientdata);
if (head == NULL)
head = a3;
else
prev->next = a3;
prev = a3;
a4 = a4->next;
}
return(head);
}
static Except_3 *
except4_to_except3(Except_4 *e4)
{
Except_3 *e3, *head, *prev;
prev = head = NULL;
while (e4 != NULL) {
e3 = (Except_3 *)calloc(1, sizeof(Except_3));
e3->ordinal = e4->ordinal;
e3->next=NULL;
if (head == NULL)
head = e3;
else
prev->next = e3;
prev = e3;
e4 = e4->next;
}
return(head);
}
static Table_Args_Type_3
argstag4_to_argstag3(Table_Args_Type_4 t)
{
switch(t) {
case TICK_4:
return(TICK_3);
case APPTID_4:
return(APPTID_3);
case UID_4:
return(UID_3);
case APPT_4:
return(APPT_3);
case RANGE_4:
return(RANGE_3);
case KEYRANGE_4:
return(KEYRANGE_3);
default:
return(TICK_3);
}
}
static void
args4_to_args3(Args_4 *from, Args_3 *to)
{
if (from==NULL || to==NULL) return;
to->tag = argstag4_to_argstag3(from->tag);
switch(from->tag) {
case TICK_4:
to->Args_3_u.tick = from->Args_4_u.tick;
break;
case APPTID_4:
to->Args_3_u.apptid.oid = (Id_3 *)calloc(1, sizeof(Id_3));
apptid4_to_apptid3(
&(from->Args_4_u.apptid),
&(to->Args_3_u.apptid));
break;
case UID_4:
to->Args_3_u.key = _DtCm_uid4_to_uid3(from->Args_4_u.key);
break;
case APPT_4:
to->Args_3_u.appt = _DtCm_appt4_to_appt3(from->Args_4_u.appt);
break;
case RANGE_4:
to->Args_3_u.range = _DtCm_range4_to_range3(from->Args_4_u.range);
break;
case KEYRANGE_4:
to->Args_3_u.keyrange = _DtCm_keyrange4_to_keyrange3(
from->Args_4_u.keyrange);
default:
break;
}
}
static Table_Args_3 *
tableargs4_to_tableargs3(Table_Args_4 *a4)
{
Table_Args_3 *a3;
if (a4==NULL) return((Table_Args_3 *)NULL);
a3 = (Table_Args_3 *)calloc(1, sizeof(Table_Args_3));
a3->target = buffer4_to_buffer3(a4->target);
args4_to_args3(&(a4->args), &(a3->args));
a3->pid = a4->pid;
return(a3);
}
static Registration_3 *
reg4_to_reg3(Registration_4 *r4)
{
Registration_3 *r3, *head, *prev;
prev = head = NULL;
while (r4 != NULL) {
r3 = (Registration_3 *)calloc(1, sizeof(Registration_3));
r3->target = buffer4_to_buffer3(r4->target);
r3->prognum = r4->prognum;
r3->versnum = r4->versnum;
r3->procnum = r4->procnum;
r3->next = NULL;
r3->pid = r4->pid;
if (head == NULL)
head = r3;
else
prev->next = r3;
prev = r3;
r4 = r4->next;
}
return(head);
}
static void
free_tag3(Tag_3 *t)
{
Tag_3 *ptr;
while (t != NULL) {
ptr = t->next;
free(t);
t = ptr;
}
}

33
cde/lib/csa/convert4-3.h Normal file
View File

@@ -0,0 +1,33 @@
/* $XConsortium: convert4-3.h /main/1 1996/04/21 19:22:46 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#ifndef _CONVERT4_3_H
#define _CONVERT4_3_H
#include "ansi_c.h"
/* convert4-3.h: conversion routines for rpc.cmsd version 4 to
rpc.cmsd version 3 data types
*/
extern Table_Res_3 *_DtCm_tableres4_to_tableres3 P((Table_Res_4*));
extern Table_Status_3 _DtCm_tablestat4_to_tablestat3 P((Table_Status_4));
extern Registration_Status_3 _DtCm_regstat4_to_regstat3 P((Registration_Status_4));
extern Access_Status_3 _DtCm_accstat4_to_accstat3 P((Access_Status_4));
extern Access_Args_3 *_DtCm_accargs4_to_accargs3 P((Access_Args_4*));
extern Uid_3 *_DtCm_uid4_to_uid3 P((Uid_4*));
extern Range_3 *_DtCm_range4_to_range3 P((Range_4*));
extern Appt_3 *_DtCm_appt4_to_appt3 P((Appt_4*));
extern void _DtCm_id4_to_id3 P((Id_4*, Id_3*));
extern Access_Entry_3 *_DtCm_acclist4_to_acclist3 P((Access_Entry_4*));
extern Keyrange_3 *_DtCm_keyrange4_to_keyrange3 P((Keyrange_4*));
extern Uid_3 *_DtCm_uidopt4_to_uid3 P((Uidopt_4*));
extern void _DtCm_free_attr3 P((Attribute_3 *a));
extern void _DtCm_free_appt3 P((Appt_3 *appts));
#endif

486
cde/lib/csa/convert4-5.c Normal file
View File

@@ -0,0 +1,486 @@
/* $XConsortium: convert4-5.c /main/1 1996/04/21 19:22:49 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
/*
* Routines to convert data types used in version 4 to version 5.
*/
#include <EUSCompat.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "csa.h"
#include "attr.h"
#include "cmsdata.h"
#include "convert4-5.h"
#include "free.h"
#include "iso8601.h"
#include "lutil.h"
#define V4_ATTR_NUM 13
/*
* forward declaration of static functions
*/
static unsigned int accesstype4_to_accessright(int access);
static CSA_return_code eventtype4_to_attrs(Event_Type_4 tag, uint num_attrs,
cms_attribute *attrs);
static CSA_return_code _RepeatInfoToRule(Appt_4 *a4,
cms_attribute_value **attrval);
/*****************************************************************************
* extern functions
*****************************************************************************/
extern CSA_return_code
_DtCm_accessentry4_to_cmsaccesslist(
Access_Entry_4 *a4,
cms_access_entry **alist)
{
CSA_return_code stat = CSA_SUCCESS;
cms_access_entry *to, *head, *prev;
head = prev = NULL;
while (a4 != NULL) {
if ((to = (cms_access_entry *)calloc(1,
sizeof(cms_access_entry))) == NULL) {
stat = CSA_E_INSUFFICIENT_MEMORY;
break;
}
if (a4->who && (to->user = strdup(a4->who)) == NULL) {
free(to);
stat = CSA_E_INSUFFICIENT_MEMORY;
break;
}
to->rights = accesstype4_to_accessright(a4->access_type);
to->next = NULL;
if (head == NULL)
head = to;
else
prev->next = to;
prev = to;
a4 = a4->next;
}
if (stat != CSA_SUCCESS) {
_DtCm_free_cms_access_entry(head);
head = NULL;
}
*alist = head;
return (stat);
}
extern CSA_return_code
_DtCm_appt4_to_attrs(
char *calname,
Appt_4 *a4,
uint num_attrs,
cms_attribute *attrs,
boolean_t rerule)
{
CSA_return_code stat = CSA_SUCCESS;
Attribute_4 *reminders = a4->attr;
char buf[BUFSIZ];
CSA_opaque_data opq;
int index, ntimes;
char *ptr1, *ptr2;
if (a4 == NULL || num_attrs < _DtCM_DEFINED_ENTRY_ATTR_SIZE)
return (CSA_E_INVALID_PARAMETER);
/* exception info is not converted since it's not used
* and we don't have an attribute for it yet
*/
while (stat == CSA_SUCCESS && reminders != NULL) {
if ((index =
_DtCm_old_reminder_name_to_index(reminders->attr)) >= 0) {
if ((stat = _DtCmAttr4ToReminderValue(reminders,
&attrs[index].value)) != CSA_SUCCESS) {
break;
}
}
reminders = reminders->next;
}
/* only contains the id now, need to
* add calendar name and location info
*/
if (a4->appt_id.key > 0) {
ptr1 = strchr(calname, '@');
ptr2 = (ptr1 ? strchr(ptr1, '.') : NULL);
if (ptr1) {
sprintf(buf, "%d:%s%s%s", a4->appt_id.key, calname,
(ptr2 == NULL ? "." : ""),
(ptr2 == NULL ? _DtCmGetLocalDomain(ptr1+1) :
""));
} else {
sprintf(buf, "%d:%s@%s", a4->appt_id.key, calname,
_DtCmGetHostAtDomain());
}
opq.size = strlen(buf);
opq.data = (unsigned char *)buf;
}
if (a4->period.period != single_4 &&
a4->ntimes == _DtCM_OLD_REPEAT_FOREVER)
ntimes = CSA_X_DT_DT_REPEAT_FOREVER;
else
ntimes = a4->ntimes;
/* convert tick to iso8601 */
if (stat != CSA_SUCCESS || (a4->appt_id.key > 0 &&
(stat = _DtCm_set_opaque_attrval(&opq,
&attrs[CSA_ENTRY_ATTR_REFERENCE_IDENTIFIER_I].value))))
;
else if ((stat = _csa_tick_to_iso8601(a4->appt_id.tick, buf) ?
CSA_E_INVALID_DATE_TIME : CSA_SUCCESS) ||
(stat = _DtCm_set_string_attrval(buf,
&attrs[CSA_ENTRY_ATTR_START_DATE_I].value,CSA_VALUE_DATE_TIME)))
;
else if (stat = eventtype4_to_attrs(a4->tag->tag, num_attrs, attrs))
;
else if (stat = _DtCm_set_sint32_attrval(a4->tag->showtime,
&attrs[CSA_X_DT_ENTRY_ATTR_SHOWTIME_I].value))
;
else if ((stat = _csa_tick_to_iso8601(a4->appt_id.tick + a4->duration,
buf) ? CSA_E_INVALID_DATE_TIME : CSA_SUCCESS) ||
(stat = _DtCm_set_string_attrval(buf,
&attrs[CSA_ENTRY_ATTR_END_DATE_I].value, CSA_VALUE_DATE_TIME)))
;
else if (stat = _DtCm_set_string_attrval(a4->what,
&attrs[CSA_ENTRY_ATTR_SUMMARY_I].value, CSA_VALUE_STRING))
;
else if (stat = _DtCm_set_user_attrval(a4->author,
&attrs[CSA_ENTRY_ATTR_ORGANIZER_I].value))
;
else if (stat = _DtCm_set_uint32_attrval(_DtCm_apptstatus4_to_status(
a4->appt_status), &attrs[CSA_ENTRY_ATTR_STATUS_I].value))
;
else if (stat = _DtCm_set_uint32_attrval(
_DtCm_privacy4_to_classification(a4->privacy),
&attrs[CSA_ENTRY_ATTR_CLASSIFICATION_I].value))
;
else if (rerule && (stat = _RepeatInfoToRule(a4,
&attrs[CSA_ENTRY_ATTR_RECURRENCE_RULE_I].value)))
;
else if (!rerule &&
((stat = _DtCm_set_uint32_attrval(ntimes,
&attrs[CSA_X_DT_ENTRY_ATTR_REPEAT_TIMES_I].value)) ||
(stat = _DtCm_set_sint32_attrval(_DtCm_interval4_to_rtype(
a4->period.period),
&attrs[CSA_X_DT_ENTRY_ATTR_REPEAT_TYPE_I].value)) ||
(a4->period.period == nthWeekday_4 &&
(stat = _DtCm_set_sint32_attrval(a4->period.nth, &attrs\
[CSA_X_DT_ENTRY_ATTR_REPEAT_OCCURRENCE_NUM_I].value))) ||
(a4->period.period >= everyNthDay_4 &&
a4->period.period <= everyNthMonth_4 &&
(stat = _DtCm_set_uint32_attrval(a4->period.nth, &attrs\
[CSA_X_DT_ENTRY_ATTR_REPEAT_INTERVAL_I].value))) ||
(a4->period.enddate != 0 &&
((stat = _csa_tick_to_iso8601(a4->period.enddate, buf) ?
CSA_E_INVALID_DATE_TIME : CSA_SUCCESS) ||
(stat = _DtCm_set_string_attrval(buf, &attrs\
[CSA_X_DT_ENTRY_ATTR_SEQUENCE_END_DATE_I].value,
CSA_VALUE_DATE_TIME))))))
;
else {
return (CSA_SUCCESS);
}
/* something wrong, need cleanup */
/* free up all attribute values set so far */
return (stat);
}
extern int
_DtCm_eventtype4_to_type(Event_Type_4 tag)
{
switch (tag) {
case appointment_4:
case holiday_4:
return (CSA_TYPE_EVENT);
case toDo_4:
return (CSA_TYPE_TODO);
case reminder_4:
case otherTag_4:
default:
return (CSA_X_DT_TYPE_OTHER);
}
}
extern char *
_DtCm_eventtype4_to_subtype(Event_Type_4 tag)
{
switch (tag) {
case appointment_4:
return (CSA_SUBTYPE_APPOINTMENT);
case holiday_4:
return (CSA_SUBTYPE_HOLIDAY);
case toDo_4:
case reminder_4:
case otherTag_4:
default:
return ("");
}
}
extern CSA_sint32
_DtCm_interval4_to_rtype(Interval_4 val)
{
switch (val) {
case single_4:
return (CSA_X_DT_REPEAT_ONETIME);
case weekly_4:
return (CSA_X_DT_REPEAT_WEEKLY);
case daily_4:
return (CSA_X_DT_REPEAT_DAILY);
case biweekly_4:
return (CSA_X_DT_REPEAT_BIWEEKLY);
case monthly_4:
return (CSA_X_DT_REPEAT_MONTHLY_BY_DATE);
case yearly_4:
return (CSA_X_DT_REPEAT_YEARLY);
case nthWeekday_4:
return (CSA_X_DT_REPEAT_MONTHLY_BY_WEEKDAY);
case everyNthDay_4:
return (CSA_X_DT_REPEAT_EVERY_NDAY);
case everyNthWeek_4:
return (CSA_X_DT_REPEAT_EVERY_NWEEK);
case everyNthMonth_4:
return (CSA_X_DT_REPEAT_EVERY_NMONTH);
case monThruFri_4:
return (CSA_X_DT_REPEAT_MON_TO_FRI);
case monWedFri_4:
return (CSA_X_DT_REPEAT_MONWEDFRI);
case tueThur_4:
return (CSA_X_DT_REPEAT_TUETHUR);
case daysOfWeek_4:
return (CSA_X_DT_REPEAT_WEEKDAYCOMBO);
case otherPeriod_4:
default:
return (CSA_X_DT_REPEAT_OTHER);
}
}
extern CSA_sint32
_DtCm_apptstatus4_to_status(Appt_Status_4 stat)
{
switch (stat) {
case active_4:
return (CSA_X_DT_STATUS_ACTIVE);
case completed_4:
return (CSA_STATUS_COMPLETED);
case pendingAdd_4:
return (CSA_X_DT_STATUS_ADD_PENDING);
case pendingDelete_4:
return (CSA_X_DT_STATUS_DELETE_PENDING);
case committed_4:
return (CSA_X_DT_STATUS_COMMITTED);
case cancelled_4:
return (CSA_X_DT_STATUS_CANCELLED);
default:
return (CSA_X_DT_STATUS_ACTIVE);
}
}
extern CSA_sint32
_DtCm_privacy4_to_classification(Privacy_Level_4 p)
{
switch (p) {
case public_4:
return (CSA_CLASS_PUBLIC);
case semiprivate_4:
return (CSA_CLASS_CONFIDENTIAL);
case private_4:
return (CSA_CLASS_PRIVATE);
default:
return (CSA_CLASS_PUBLIC);
}
}
/******************************************************************************
* static functions used within the file
******************************************************************************/
/*
* Static functions used within the file.
*/
/*
* DtCM_PERMIT_ACCESS is added for backward compatibility
*/
static unsigned int
accesstype4_to_accessright(int access)
{
unsigned int newaccess = 0;
if (access & access_read_4)
newaccess |= CSA_X_DT_BROWSE_ACCESS;
if (access & access_write_4)
newaccess |= CSA_X_DT_INSERT_ACCESS;
if (access & access_delete_4)
newaccess |= CSA_X_DT_DELETE_ACCESS;
return (newaccess);
}
extern CSA_return_code
_DtCmAttr4ToReminderValue(
Attribute_4 *remval,
cms_attribute_value **attrval)
{
CSA_reminder rval;
char timestr[BUFSIZ];
/*
* rval is just a place holder, values will be
* copied in _DtCm_set_reminder_attrval
*/
_csa_duration_to_iso8601(atoi(remval->value), timestr);
rval.lead_time = timestr;
if (remval->clientdata && *remval->clientdata != NULL) {
rval.reminder_data.size = strlen(remval->clientdata);
rval.reminder_data.data = (unsigned char *)remval->clientdata;
} else {
rval.reminder_data.size = 0;
rval.reminder_data.data = NULL;
}
rval.snooze_time = NULL;
rval.repeat_count = 0;
return (_DtCm_set_reminder_attrval(&rval, attrval));
}
static CSA_return_code
eventtype4_to_attrs(Event_Type_4 tag, uint num_attrs, cms_attribute *attrs)
{
CSA_return_code stat;
switch (tag) {
case appointment_4:
if ((stat = _DtCm_set_uint32_attrval(CSA_TYPE_EVENT,
&attrs[CSA_ENTRY_ATTR_TYPE_I].value)) != CSA_SUCCESS)
return (stat);
return (_DtCm_set_string_attrval(CSA_SUBTYPE_APPOINTMENT,
&attrs[CSA_ENTRY_ATTR_SUBTYPE_I].value,
CSA_VALUE_STRING));
case toDo_4:
return (_DtCm_set_uint32_attrval(CSA_TYPE_TODO,
&attrs[CSA_ENTRY_ATTR_TYPE_I].value));
case holiday_4:
if ((stat = _DtCm_set_uint32_attrval(CSA_TYPE_EVENT,
&attrs[CSA_ENTRY_ATTR_TYPE_I].value)) != CSA_SUCCESS)
return (stat);
return (_DtCm_set_string_attrval(CSA_SUBTYPE_HOLIDAY,
&attrs[CSA_ENTRY_ATTR_SUBTYPE_I].value,
CSA_VALUE_STRING));
case reminder_4:
case otherTag_4:
default:
return (_DtCm_set_uint32_attrval(CSA_X_DT_TYPE_OTHER,
&attrs[CSA_ENTRY_ATTR_TYPE_I].value));
}
}
static CSA_return_code
_RepeatInfoToRule(Appt_4 *a4, cms_attribute_value **attrval)
{
char buf[BUFSIZ], datestr[25];
uint duration;
if (a4->period.period == single_4 || a4->period.period == otherPeriod_4) {
*attrval = NULL;
return (CSA_SUCCESS);
}
if (a4->ntimes == _DtCM_OLD_REPEAT_FOREVER) {
duration = 0;
} else if (a4->period.period >= everyNthDay_4 &&
a4->period.period <= everyNthMonth_4) {
duration = ((a4->ntimes % a4->period.nth) ? 1 : 0) +
a4->ntimes/a4->period.nth;
} else
duration = a4->ntimes;
switch (a4->period.period) {
case daily_4:
sprintf(buf, "D1 #%d ", duration);
break;
case weekly_4:
sprintf(buf, "W1 #%d ", duration);
break;
case biweekly_4:
sprintf(buf, "W2 #%d ", duration);
break;
case monthly_4:
sprintf(buf, "MD1 #%d ", duration);
break;
case yearly_4:
sprintf(buf, "YM1 #%d ", duration);
break;
case nthWeekday_4:
sprintf(buf, "MP1 #%d ", duration);
break;
case everyNthDay_4:
sprintf(buf, "D%d #%d ", a4->period.nth, duration);
break;
case everyNthWeek_4:
sprintf(buf, "W%d #%d ", a4->period.nth, duration);
break;
case everyNthMonth_4:
sprintf(buf, "MD%d #%d ", a4->period.nth, duration);
break;
case monThruFri_4:
sprintf(buf, "W1 MO TU WE TH FR #%d ", duration);
break;
case monWedFri_4:
sprintf(buf, "W1 MO WE FR #%d ", duration);
break;
case tueThur_4:
sprintf(buf, "W1 TU TH #%d ", duration);
break;
case daysOfWeek_4:
sprintf(buf, "W1 #%d ", duration);
if (a4->period.nth & 0x1) strcat(buf, "SU ");
if (a4->period.nth & 0x2) strcat(buf, "MO ");
if (a4->period.nth & 0x4) strcat(buf, "TU ");
if (a4->period.nth & 0x8) strcat(buf, "WE ");
if (a4->period.nth & 0x10) strcat(buf, "TH ");
if (a4->period.nth & 0x20) strcat(buf, "FR ");
if (a4->period.nth & 0x40) strcat(buf, "SA ");
break;
}
if (a4->period.enddate) {
if (_csa_tick_to_iso8601(a4->period.enddate, datestr))
return (CSA_E_INVALID_DATE_TIME);
strcat(buf, datestr);
}
return (_DtCm_set_string_attrval(buf, attrval, CSA_VALUE_STRING));
}

45
cde/lib/csa/convert4-5.h Normal file
View File

@@ -0,0 +1,45 @@
/* $XConsortium: convert4-5.h /main/1 1996/04/21 19:22:52 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#ifndef _CONVERT4_5_H
#define _CONVERT4_5_H
#include <EUSCompat.h>
#include "ansi_c.h"
#include "cm.h"
#include "rtable4.h"
/*
* functions to convert v4 data structures
*/
extern CSA_return_code _DtCm_accessentry4_to_cmsaccesslist P((
Access_Entry_4 *a4,
cms_access_entry **alist));
extern CSA_return_code _DtCm_appt4_to_attrs P((
char *calname,
Appt_4 *a4,
uint num_attrs,
cms_attribute *attrs,
boolean_t rerule));
extern int _DtCm_eventtype4_to_type P((Event_Type_4 tag));
extern char *_DtCm_eventtype4_to_subtype P((Event_Type_4 tag));
extern CSA_sint32 _DtCm_interval4_to_rtype P((Interval_4 val));
extern CSA_sint32 _DtCm_apptstatus4_to_status P((Appt_Status_4 stat));
extern CSA_sint32 _DtCm_privacy4_to_classification P((Privacy_Level_4 p));
extern CSA_return_code _DtCmAttr4ToReminderValue P((
Attribute_4 *remval,
cms_attribute_value **attrval));
#endif

851
cde/lib/csa/convert5-4.c Normal file
View File

@@ -0,0 +1,851 @@
/* $XConsortium: convert5-4.c /main/2 1996/10/07 15:57:11 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#include <EUSCompat.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "convert4-5.h"
#include "convert5-4.h"
#include "attr.h"
#include "appt4.h"
#include "iso8601.h"
/*
* Routines to convert data types used in version 5 to version 4.
*/
/*****************************************************************************
* extern functions
*****************************************************************************/
/*
* attributes are checked before calling this routine
* so all attributes should be supported in v4
*/
extern CSA_return_code
_DtCm_cmsattrs_to_apptdata(uint size, cms_attribute *attrs, Appt_4 *appt)
{
CSA_return_code stat = CSA_SUCCESS;
char *string, *ptr;
time_t endtick;
cms_attribute *aptr;
char buf[BUFSIZ];
/*
* this routine is called to convert valid v2 to v4 attributes
* so no checking of CSA_E_INVALID_ATTRIBUTE and
* CSA_E_UNSUPPORTED_ATTRIBUTE is necessary
*/
/* assuming all appt data is available */
/* start time */
if (_csa_iso8601_to_tick(
attrs[CSA_ENTRY_ATTR_START_DATE_I].value->item.date_time_value,
&appt->appt_id.tick))
return (CSA_E_INVALID_DATE_TIME);
/* duration */
aptr = &attrs[CSA_ENTRY_ATTR_END_DATE_I];
if (aptr->value && aptr->value->item.date_time_value &&
*(aptr->value->item.date_time_value))
{
if (_csa_iso8601_to_tick(aptr->value->item.date_time_value,
&endtick))
return (CSA_E_INVALID_DATE_TIME);
else
appt->duration = endtick - appt->appt_id.tick;
}
/* id */
aptr = &attrs[CSA_ENTRY_ATTR_REFERENCE_IDENTIFIER_I];
if (aptr->value && aptr->value->item.opaque_data_value &&
aptr->value->item.opaque_data_value->size > 0)
{
strncpy(buf, (char *)aptr->value->item.opaque_data_value->data,
aptr->value->item.opaque_data_value->size);
buf[aptr->value->item.opaque_data_value->size] = NULL;
ptr = strchr(buf, ':');
if (ptr != NULL)
*ptr = NULL;
appt->appt_id.key = atol(buf);
} else
return (CSA_E_INVALID_ATTRIBUTE_VALUE);
/* _DtCm_old_attr_type */
if ((stat = _DtCm_attrs_to_eventtype4(
attrs[CSA_ENTRY_ATTR_TYPE_I].value,
attrs[CSA_ENTRY_ATTR_SUBTYPE_I].value, appt->tag)) != CSA_SUCCESS)
return (stat);
/* _DtCm_old_attr_what */
aptr = &attrs[CSA_ENTRY_ATTR_SUMMARY_I];
if (aptr->value->item.string_value) {
if ((string = strdup(aptr->value->item.string_value)) == NULL)
return (CSA_E_INSUFFICIENT_MEMORY);
else {
if (appt->what)
free(appt->what);
appt->what = string;
}
}
/* _DtCm_old_attr_author */
aptr = &attrs[CSA_ENTRY_ATTR_ORGANIZER_I];
if (aptr->value && aptr->value->item.calendar_user_value) {
if ((string = strdup(aptr->value->item.calendar_user_value))
== NULL)
return (CSA_E_INSUFFICIENT_MEMORY);
else {
if (appt->author)
free(appt->author);
appt->author = string;
}
}
/* _DtCm_old_attr_beep_reminder */
aptr = &attrs[CSA_ENTRY_ATTR_AUDIO_REMINDER_I];
if (aptr->value && aptr->value->item.reminder_value) {
if ((stat = _DtCm_add_reminder(_DtCM_OLD_ATTR_BEEP_REMINDER,
aptr->value->item.reminder_value, appt)) != CSA_SUCCESS)
return (stat);
}
/* _DtCm_old_attr_flash_reminder */
aptr = &attrs[CSA_ENTRY_ATTR_FLASHING_REMINDER_I];
if (aptr->value && aptr->value->item.reminder_value) {
if ((stat = _DtCm_add_reminder(_DtCM_OLD_ATTR_FLASH_REMINDER,
aptr->value->item.reminder_value, appt)) != CSA_SUCCESS)
return (stat);
}
/* _DtCm_old_attr_mail_reminder */
aptr = &attrs[CSA_ENTRY_ATTR_MAIL_REMINDER_I];
if (aptr->value && aptr->value->item.reminder_value) {
if ((stat = _DtCm_add_reminder(_DtCM_OLD_ATTR_MAIL_REMINDER,
aptr->value->item.reminder_value, appt)) != CSA_SUCCESS)
return (stat);
}
/* _DtCm_old_attr_popup_reminder */
aptr = &attrs[CSA_ENTRY_ATTR_POPUP_REMINDER_I];
if (aptr->value && aptr->value->item.reminder_value) {
if ((stat = _DtCm_add_reminder(_DtCM_OLD_ATTR_POPUP_REMINDER,
aptr->value->item.reminder_value, appt)) != CSA_SUCCESS)
return (stat);
}
/* _DtCm_old_attr_repeat_type */
if (_DtCm_rtype_to_interval4(
attrs[CSA_X_DT_ENTRY_ATTR_REPEAT_TYPE_I].value->item.sint32_value,
&appt->period.period))
return (CSA_E_INVALID_ATTRIBUTE_VALUE);
/* _DtCm_old_attr_repeat_times */
aptr = &attrs[CSA_X_DT_ENTRY_ATTR_REPEAT_TIMES_I];
if (aptr->value)
appt->ntimes = aptr->value->item.uint32_value;
if (appt->period.period != single_4 &&
appt->ntimes == CSA_X_DT_DT_REPEAT_FOREVER) {
appt->ntimes = _DtCM_OLD_REPEAT_FOREVER;
}
/* _DtCm_old_attr_showtime */
aptr = &attrs[CSA_X_DT_ENTRY_ATTR_SHOWTIME_I];
if (aptr->value)
appt->tag->showtime = aptr->value->item.sint32_value;
/* _DtCm_old_attr_status */
if (_DtCm_status_to_apptstatus4(
attrs[CSA_ENTRY_ATTR_STATUS_I].value->item.uint32_value,
&appt->appt_status))
return (CSA_E_INVALID_ATTRIBUTE_VALUE);
/* _DtCm_old_attr_privacy */
if (_DtCm_classification_to_privacy4(
attrs[CSA_ENTRY_ATTR_CLASSIFICATION_I].value->item.uint32_value,
&appt->privacy))
return (CSA_E_INVALID_ATTRIBUTE_VALUE);
/* _DtCm_old_attr_end_date */
aptr = &attrs[CSA_X_DT_ENTRY_ATTR_SEQUENCE_END_DATE_I];
if (aptr->value && aptr->value->item.date_time_value &&
*(aptr->value->item.date_time_value))
{
if (_csa_iso8601_to_tick(aptr->value->item.date_time_value,
&appt->period.enddate))
return (CSA_E_INVALID_DATE_TIME);
}
switch (appt->period.period) {
case nthWeekday_4:
/* _DtCm_old_attr_repeat_nth_weeknum */
aptr = &attrs[CSA_X_DT_ENTRY_ATTR_REPEAT_OCCURRENCE_NUM_I];
if (aptr->value)
appt->period.nth = aptr->value->item.sint32_value;
break;
case everyNthDay_4:
case everyNthWeek_4:
case everyNthMonth_4:
/* _DtCm_old_attr_repeat_nth_interval */
aptr = &attrs[CSA_X_DT_ENTRY_ATTR_REPEAT_INTERVAL_I];
if (aptr->value)
appt->period.nth = aptr->value->item.uint32_value;
break;
default:
appt->period.nth = 0;
}
return (stat);
}
/*
* ** need to check whether value is valid
*/
extern CSA_return_code
_DtCm_attrs_to_apptdata(uint size, CSA_attribute *attrs, Appt_4 *appt)
{
CSA_return_code stat = CSA_SUCCESS;
_DtCm_old_attrs oldattr;
char *string, *ptr;
int interval = 0, week_num = 0, i;
boolean_t set_interval = B_FALSE, set_weeknum = B_FALSE;
time_t endtick = -1;
int tindex = 0, stindex = 0;
CSA_attribute_value otype;
for (i = 0; i < size && stat == CSA_SUCCESS; i++) {
if (attrs[i].name == NULL)
continue;
if ((stat = _DtCm_get_old_attr_by_name(attrs[i].name, &oldattr))
!= CSA_SUCCESS)
break;
switch (oldattr) {
case _DtCm_old_attr_id:
stat = CSA_E_READONLY;
break;
case _DtCm_old_attr_time:
if (attrs[i].value == NULL ||
attrs[i].value->item.date_time_value == NULL ||
_csa_iso8601_to_tick(
attrs[i].value->item.date_time_value,
&appt->appt_id.tick))
stat = CSA_E_INVALID_DATE_TIME;
break;
case _DtCm_old_attr_type:
if (attrs[i].value == NULL)
stat = CSA_E_INVALID_ATTRIBUTE_VALUE;
else
tindex = i;
break;
case _DtCm_old_attr_type2:
stindex = i;
break;
case _DtCm_old_attr_duration:
if (attrs[i].value == NULL)
appt->duration = 0;
else if (attrs[i].value->item.date_time_value
== NULL || _csa_iso8601_to_tick(
attrs[i].value->item.date_time_value,
&endtick))
stat = CSA_E_INVALID_DATE_TIME;
break;
case _DtCm_old_attr_what:
if (attrs[i].value && attrs[i].value->item.string_value)
{
if ((string = strdup(
attrs[i].value->item.string_value))
== NULL)
stat = CSA_E_INSUFFICIENT_MEMORY;
else {
if (appt->what)
free(appt->what);
appt->what = string;
}
}
break;
case _DtCm_old_attr_author:
stat = CSA_E_READONLY;
break;
case _DtCm_old_attr_beep_reminder:
if (attrs[i].value == NULL)
stat = _DtCm_remove_reminder(
_DtCM_OLD_ATTR_BEEP_REMINDER, appt);
else if (attrs[i].value->item.reminder_value == NULL)
stat = CSA_E_INVALID_ATTRIBUTE_VALUE;
else
stat = _DtCm_add_reminder(
_DtCM_OLD_ATTR_BEEP_REMINDER,
attrs[i].value->item.reminder_value,
appt);
break;
case _DtCm_old_attr_flash_reminder:
if (attrs[i].value == NULL)
stat = _DtCm_remove_reminder(
_DtCM_OLD_ATTR_FLASH_REMINDER, appt);
else if (attrs[i].value->item.reminder_value == NULL)
stat = CSA_E_INVALID_ATTRIBUTE_VALUE;
else
stat = _DtCm_add_reminder(
_DtCM_OLD_ATTR_FLASH_REMINDER,
attrs[i].value->item.reminder_value,
appt);
break;
case _DtCm_old_attr_mail_reminder:
if (attrs[i].value == NULL)
stat = _DtCm_remove_reminder(
_DtCM_OLD_ATTR_MAIL_REMINDER, appt);
else if (attrs[i].value->item.reminder_value == NULL)
stat = CSA_E_INVALID_ATTRIBUTE_VALUE;
else
stat = _DtCm_add_reminder(
_DtCM_OLD_ATTR_MAIL_REMINDER,
attrs[i].value->item.reminder_value,
appt);
break;
case _DtCm_old_attr_popup_reminder:
if (attrs[i].value == NULL)
stat = _DtCm_remove_reminder(
_DtCM_OLD_ATTR_POPUP_REMINDER, appt);
else if (attrs[i].value->item.reminder_value == NULL)
stat = CSA_E_INVALID_ATTRIBUTE_VALUE;
else
stat = _DtCm_add_reminder(
_DtCM_OLD_ATTR_POPUP_REMINDER,
attrs[i].value->item.reminder_value,
appt);
break;
case _DtCm_old_attr_repeat_type:
if (attrs[i].value == NULL)
appt->period.period = single_4;
else if (_DtCm_rtype_to_interval4(
attrs[i].value->item.sint32_value,
&appt->period.period))
stat = CSA_E_INVALID_ATTRIBUTE_VALUE;
break;
case _DtCm_old_attr_repeat_times:
if (attrs[i].value == NULL)
appt->ntimes = 1;
else
appt->ntimes =
attrs[i].value->item.uint32_value;
break;
case _DtCm_old_attr_showtime:
if (attrs[i].value == NULL)
stat = CSA_E_INVALID_ATTRIBUTE_VALUE;
else
appt->tag->showtime =
attrs[i].value->item.sint32_value;
break;
case _DtCm_old_attr_status:
if (attrs[i].value == NULL)
stat = CSA_E_INVALID_ATTRIBUTE_VALUE;
else if (_DtCm_status_to_apptstatus4(
attrs[i].value->item.sint32_value,
&appt->appt_status))
stat = CSA_E_INVALID_ATTRIBUTE_VALUE;
break;
case _DtCm_old_attr_privacy:
if (attrs[i].value == NULL)
stat = CSA_E_INVALID_ATTRIBUTE_VALUE;
else if (_DtCm_classification_to_privacy4(
attrs[i].value->item.sint32_value,
&appt->privacy))
stat = CSA_E_INVALID_ATTRIBUTE_VALUE;
break;
case _DtCm_old_attr_repeat_nth_interval:
if (attrs[i].value != NULL) {
set_interval = B_TRUE;
interval = attrs[i].value->item.uint32_value;
}
break;
case _DtCm_old_attr_repeat_nth_weeknum:
if (attrs[i].value != NULL) {
set_weeknum = B_TRUE;
week_num = attrs[i].value->item.sint32_value;
}
break;
case _DtCm_old_attr_end_date:
if (attrs[i].value == NULL)
appt->period.enddate = 0;
else if (attrs[i].value->item.date_time_value == NULL ||
_csa_iso8601_to_tick(
attrs[i].value->item.date_time_value,
&appt->period.enddate))
stat = CSA_E_INVALID_DATE_TIME;
break;
default:
stat = CSA_E_INVALID_PARAMETER;
}
}
if (stat == CSA_SUCCESS) {
if (tindex || stindex) {
if (tindex == 0) {
otype.type = CSA_VALUE_SINT32;
switch (appt->tag->tag) {
case appointment_4:
case holiday_4:
otype.item.sint32_value =
CSA_TYPE_EVENT;
break;
case toDo_4:
otype.item.sint32_value = CSA_TYPE_TODO;
break;
case reminder_4:
case otherTag_4:
otype.item.sint32_value =
CSA_X_DT_TYPE_OTHER;
}
}
stat = _DtCm_attrs_to_eventtype4(
(cms_attribute_value *)
(tindex ? attrs[tindex].value : &otype),
(cms_attribute_value *)
(stindex ? attrs[stindex].value : NULL),
appt->tag);
}
if (stat == CSA_SUCCESS) {
if (endtick >= 0) {
appt->duration = endtick - appt->appt_id.tick;
/* make sure duration is positive */
if (appt->duration < 0)
stat = CSA_E_INVALID_ATTRIBUTE_VALUE;
}
if (appt->period.period != single_4 &&
appt->ntimes == CSA_X_DT_DT_REPEAT_FOREVER) {
appt->ntimes = _DtCM_OLD_REPEAT_FOREVER;
}
switch (appt->period.period) {
case nthWeekday_4:
if (set_weeknum == B_TRUE)
appt->period.nth = week_num;
break;
case everyNthDay_4:
case everyNthWeek_4:
case everyNthMonth_4:
if (set_interval == B_TRUE)
appt->period.nth = interval;
break;
default:
appt->period.nth = 0;
}
}
}
return (stat);
}
extern CSA_return_code
_DtCm_cms_entry_to_appt4(cms_entry *entry, Appt_4 **appt4_r)
{
CSA_return_code stat;
Appt_4 *appt;
if (entry == NULL || appt4_r == NULL)
return (CSA_E_INVALID_PARAMETER);
if ((appt = _DtCm_make_appt4(B_TRUE)) == NULL)
return (CSA_E_INSUFFICIENT_MEMORY);
if ((stat = _DtCm_cmsattrs_to_apptdata(entry->num_attrs, entry->attrs,
appt)) != CSA_SUCCESS) {
_DtCm_free_appt4(appt);
return (stat);
} else {
*appt4_r = appt;
return (CSA_SUCCESS);
}
}
extern CSA_return_code
_DtCm_attrs_to_appt4(uint num_attrs, CSA_attribute *attrs, Appt_4 **appt4_r)
{
CSA_return_code stat;
Appt_4 *appt;
if (appt4_r == NULL)
return (CSA_E_INVALID_PARAMETER);
if ((appt = _DtCm_make_appt4(B_TRUE)) == NULL)
return (CSA_E_INSUFFICIENT_MEMORY);
if ((stat = _DtCm_attrs_to_apptdata(num_attrs, attrs, appt)) != CSA_SUCCESS) {
_DtCm_free_appt4(appt);
return (stat);
} else {
*appt4_r = appt;
return (CSA_SUCCESS);
}
}
extern CSA_return_code
_DtCm_scope_to_options4(CSA_enum scope, Options_4 *opt)
{
if (opt == NULL)
return (CSA_E_INVALID_PARAMETER);
switch (scope) {
case CSA_SCOPE_ONE:
*opt = do_one_4;
break;
case CSA_SCOPE_ALL:
*opt = do_all_4;
break;
case CSA_SCOPE_FORWARD:
*opt = do_forward_4;
break;
default:
return (CSA_E_INVALID_ENUM);
}
return (CSA_SUCCESS);
}
extern CSA_return_code
_DtCm_csaaccesslist_toaccessentry4(CSA_access_list alist, Access_Entry_4 **a4)
{
CSA_return_code stat = CSA_SUCCESS;
Access_Entry_4 *to, *prev, *head;
head = prev = NULL;
while (alist != NULL) {
if ((to = (Access_Entry_4 *)calloc(1, sizeof(Access_Entry_4)))
== NULL) {
stat = CSA_E_INSUFFICIENT_MEMORY;
break;
}
if ((to->access_type = _DtCmAccessRightToV4AccessType(
alist->rights)) < 0) {
stat = CSA_E_INVALID_FLAG;
break;
}
if (alist->user == NULL || alist->user->user_name == NULL) {
stat = CSA_E_INVALID_ATTRIBUTE_VALUE;
break;
}
if ((to->who = strdup(alist->user->user_name)) == NULL) {
free(to);
stat = CSA_E_INSUFFICIENT_MEMORY;
break;
}
if (head == NULL)
head = to;
else
prev->next = to;
prev = to;
alist = alist->next;
}
if (stat != CSA_SUCCESS) {
_DtCm_free_access_list4(head);
head = NULL;
}
*a4 = head;
return (stat);
}
extern int
_DtCm_rtype_to_interval4(int val, Interval_4 *period)
{
switch (val) {
case CSA_X_DT_REPEAT_ONETIME:
*period = single_4;
break;
case CSA_X_DT_REPEAT_WEEKLY:
*period = weekly_4;
break;
case CSA_X_DT_REPEAT_DAILY:
*period = daily_4;
break;
case CSA_X_DT_REPEAT_BIWEEKLY:
*period = biweekly_4;
break;
case CSA_X_DT_REPEAT_MONTHLY_BY_DATE:
*period = monthly_4;
break;
case CSA_X_DT_REPEAT_YEARLY:
*period = yearly_4;
break;
case CSA_X_DT_REPEAT_MONTHLY_BY_WEEKDAY:
*period = nthWeekday_4;
break;
case CSA_X_DT_REPEAT_EVERY_NDAY:
*period = everyNthDay_4;
break;
case CSA_X_DT_REPEAT_EVERY_NWEEK:
*period = everyNthWeek_4;
break;
case CSA_X_DT_REPEAT_EVERY_NMONTH:
*period = everyNthMonth_4;
break;
case CSA_X_DT_REPEAT_MON_TO_FRI:
*period = monThruFri_4;
break;
case CSA_X_DT_REPEAT_MONWEDFRI:
*period = monWedFri_4;
break;
case CSA_X_DT_REPEAT_TUETHUR:
*period = tueThur_4;
break;
case CSA_X_DT_REPEAT_WEEKDAYCOMBO:
*period = daysOfWeek_4;
break;
case CSA_X_DT_REPEAT_OTHER:
*period = otherPeriod_4;
break;
default:
return (-1);
}
return (0);
}
extern int
_DtCm_status_to_apptstatus4(int val, Appt_Status_4 *astat)
{
switch (val) {
case CSA_X_DT_STATUS_ACTIVE:
*astat = active_4;
break;
case CSA_STATUS_COMPLETED:
*astat = completed_4;
break;
case CSA_X_DT_STATUS_CANCELLED:
*astat = cancelled_4;
break;
case CSA_X_DT_STATUS_COMMITTED:
*astat = committed_4;
break;
case CSA_X_DT_STATUS_ADD_PENDING:
*astat = pendingAdd_4;
break;
case CSA_X_DT_STATUS_DELETE_PENDING:
*astat = pendingDelete_4;
break;
default:
return (-1);
}
return (0);
}
extern int
_DtCm_classification_to_privacy4(int val, Privacy_Level_4 *privacy)
{
switch (val) {
case CSA_CLASS_PUBLIC:
*privacy = public_4;
break;
case CSA_CLASS_CONFIDENTIAL:
*privacy = semiprivate_4;
break;
case CSA_CLASS_PRIVATE:
*privacy = private_4;
break;
default:
return (-1);
}
return (0);
}
extern CSA_return_code
_DtCm_attrs_to_eventtype4(
cms_attribute_value *type,
cms_attribute_value *stype,
Tag_4 *tag)
{
CSA_return_code stat = CSA_SUCCESS;
if (type) {
switch (type->item.uint32_value) {
case CSA_TYPE_EVENT:
if (stype && stype->item.string_value) {
if (strcmp(stype->item.string_value,
CSA_SUBTYPE_APPOINTMENT) == 0)
tag->tag = appointment_4;
else if (strcmp(stype->item.string_value,
CSA_SUBTYPE_HOLIDAY) == 0)
tag->tag = holiday_4;
else
stat = CSA_E_INVALID_ATTRIBUTE_VALUE;
} else
stat = CSA_E_INVALID_ATTRIBUTE_VALUE;
break;
case CSA_TYPE_TODO:
if (stype)
stat = CSA_E_INVALID_ATTRIBUTE_VALUE;
else
tag->tag = toDo_4;
break;
case CSA_X_DT_TYPE_OTHER:
if (stype)
stat = CSA_E_INVALID_ATTRIBUTE_VALUE;
else
tag->tag = otherTag_4;
break;
default:
stat = CSA_E_INVALID_ATTRIBUTE_VALUE;
}
} else
stat = CSA_E_INVALID_ATTRIBUTE_VALUE;
return (stat);
}
/*
* Get rid of the given reminder in the appt.
*/
extern CSA_return_code
_DtCm_remove_reminder(char *rem, Appt_4 *appt)
{
Attribute_4 *attr, *prev;
for (attr = prev = appt->attr; attr != NULL; attr = attr->next) {
if (strcmp(attr->attr, rem) == 0) {
if (prev == attr)
appt->attr = attr->next;
else
prev->next = attr->next;
attr->next = NULL;
_DtCm_free_attr4(attr);
} else
prev = attr;
}
return (CSA_SUCCESS);
}
/*
* If the corresponding attribute exists already, replace it.
*/
extern CSA_return_code
_DtCm_add_reminder(char *rem, CSA_reminder * val, Appt_4 *appt)
{
Attribute_4 *newattr, *attrs, *prev = NULL;
char adv[80];
char *str;
time_t ltime = 0;
/*
if ((val->snooze_time && val->snooze_time[0] != NULL)
|| val->repeat_count > 1)
return (CSA_E_INVALID_ATTRIBUTE_VALUE);
*/
if ((newattr = calloc(1, sizeof(Attribute_4))) == NULL)
return (CSA_E_INSUFFICIENT_MEMORY);
if ((newattr->attr = strdup(rem)) == NULL) {
free(newattr);
return (CSA_E_INSUFFICIENT_MEMORY);
}
/* convert lead_time to advance value */
if (val->lead_time)
_csa_iso8601_to_duration(val->lead_time, &ltime);
sprintf(adv, "%d", ltime);
if ((newattr->value = strdup(adv)) == NULL) {
_DtCm_free_attr4(newattr);
return (CSA_E_INSUFFICIENT_MEMORY);
}
if (val->reminder_data.size > 0) {
if ((newattr->clientdata = malloc(val->reminder_data.size + 1))
== NULL) {
_DtCm_free_attr4(newattr);
return (CSA_E_INSUFFICIENT_MEMORY);
}
memcpy(newattr->clientdata, val->reminder_data.data,
val->reminder_data.size);
newattr->clientdata[val->reminder_data.size] = NULL;
} else if ((newattr->clientdata = calloc(1,1)) == NULL) {
_DtCm_free_attr4(newattr);
return (CSA_E_INSUFFICIENT_MEMORY);
}
for (attrs = appt->attr; attrs != NULL; attrs = attrs->next) {
if (strcmp(attrs->attr, rem) == 0) {
newattr->next = attrs->next;
if (prev == NULL)
appt->attr = newattr;
else
prev->next = newattr;
attrs->next = NULL;
_DtCm_free_attr4(attrs);
break;
} else
prev = attrs;
}
if (attrs == NULL) {
newattr->next = appt->attr;
appt->attr = newattr;
}
return (CSA_SUCCESS);
}
extern int
_DtCmAccessRightToV4AccessType(unsigned int access)
{
int newaccess = access_none_4;
if (access < 0 ||
access & ~(CSA_X_DT_BROWSE_ACCESS | CSA_X_DT_INSERT_ACCESS |
CSA_X_DT_DELETE_ACCESS))
return (-1);
if (access & CSA_X_DT_BROWSE_ACCESS)
newaccess |= access_read_4;
if (access & CSA_X_DT_INSERT_ACCESS)
newaccess |= access_write_4;
if (access & CSA_X_DT_DELETE_ACCESS)
newaccess |= access_delete_4;
return (newaccess);
}

77
cde/lib/csa/convert5-4.h Normal file
View File

@@ -0,0 +1,77 @@
/* $XConsortium: convert5-4.h /main/1 1996/04/21 19:22:58 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#ifndef _CONVERT5_4_H
#define _CONVERT5_4_H
#include <EUSCompat.h>
#include "ansi_c.h"
#include "cm.h"
#include "rtable4.h"
/*
* conversion routines for rpc.cmsd version 5 to rpc.cmsd version 4 data types
*/
extern CSA_return_code _DtCm_cmsattrs_to_apptdata P((
uint num_attrs,
cms_attribute *attrs,
Appt_4 *appt4));
extern CSA_return_code _DtCm_attrs_to_apptdata P((
uint size,
CSA_attribute *attrs,
Appt_4 *appt));
extern CSA_return_code _DtCm_cms_entry_to_appt4 P((
cms_entry *entry,
Appt_4 **appt4));
extern CSA_return_code _DtCm_attrs_to_appt4 P((
uint num_attrs,
CSA_attribute *attrs,
Appt_4 **appt4_r));
extern CSA_return_code _DtCm_scope_to_options4 P((
CSA_enum scope,
Options_4 *opt));
extern CSA_return_code _DtCm_csaaccesslist_toaccessentry4 P((
CSA_access_list alist,
Access_Entry_4 **a4));
extern int _DtCm_string_to_eventtype4 P((
char *val,
Event_Type_4 *tag));
extern int _DtCm_rtype_to_interval4 P((
int val,
Interval_4 *period));
extern int _DtCm_status_to_apptstatus4 P((
int val,
Appt_Status_4 *astat));
extern int _DtCm_classification_to_privacy4 P((
int val,
Privacy_Level_4 *privacy));
extern CSA_return_code _DtCm_attrs_to_eventtype4 P((
cms_attribute_value *type,
cms_attribute_value *stype,
Tag_4 *tag));
extern CSA_return_code _DtCm_remove_reminder P((char *rem, Appt_4 *appt));
extern CSA_return_code _DtCm_add_reminder P((
char *rem,
CSA_reminder * val,
Appt_4 *appt));
extern int _DtCmAccessRightToV4AccessType P((unsigned int access));
#endif

1125
cde/lib/csa/csa.h Normal file

File diff suppressed because it is too large Load Diff

44
cde/lib/csa/debug.c Normal file
View File

@@ -0,0 +1,44 @@
/* $XConsortium: debug.c /main/3 1996/11/21 20:00:19 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#include <stdio.h>
#define X_INCLUDE_TIME_H
#define XOS_USE_NO_LOCKING
#include <X11/Xos_r.h>
#include <syslog.h>
static int inited = 0;
extern void
_DtCm_print_tick(time_t t)
{
char *a;
_Xctimeparams ctime_buf;
a = _XCtime(&t, ctime_buf);
(void) fprintf (stderr, "%d %s\n", t, a);
}
extern void
_DtCm_print_errmsg(const char *msg)
{
if (inited == 0) {
openlog("libcsa", 0, 0);
inited = 1;
}
#ifdef CM_DEBUG
fprintf(stderr, "libcsa: %s\n", msg);
#else
syslog(LOG_ERR, "%s\n", msg);
#endif
}

24
cde/lib/csa/debug.h Normal file
View File

@@ -0,0 +1,24 @@
/* $XConsortium: debug.h /main/1 1996/04/21 19:23:07 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#ifndef _DEBUG_H
#define _DEBUG_H
#include "ansi_c.h"
#ifdef CM_DEBUG
#define DP(a) { printf a ; }
#else
#define DP(a)
#endif /* CM_DEBUG */
extern void _DtCm_print_tick P((long));
extern void _DtCm_print_errmsg P((const char *));
#endif /* _DEBUG_H */

702
cde/lib/csa/entry.c Normal file
View File

@@ -0,0 +1,702 @@
/* $XConsortium: entry.c /main/1 1996/04/21 19:23:10 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
/*
* Functions that manage the entry data structures.
*/
#include <EUSCompat.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "appt4.h"
#include "attr.h"
#include "calendar.h"
#include "cmsdata.h"
#include "convert4-5.h"
#include "convert5-4.h"
#include "debug.h"
#include "entry.h"
#include "free.h"
#include "nametbl.h"
#include "rpccalls.h"
#include "iso8601.h"
#include "updateattrs.h"
/******************************************************************************
* forward declaration of static functions used within the file
******************************************************************************/
static CSA_return_code _CmsentryToLibentry(_DtCmNameTable **tbl, cms_entry *e,
_DtCm_libentry **entry_r);
/*****************************************************************************
* extern functions used in the library
*****************************************************************************/
/*
* Given the entry handle, return the internal entry data structure.
*/
extern _DtCm_libentry *
_DtCm_get_libentry(CSA_entry_handle entryhandle)
{
_DtCm_libentry *entry = (_DtCm_libentry *)entryhandle;
if (entry == NULL || entry->handle != (void *)entry)
return (NULL);
else
return(entry);
}
extern CSA_return_code
_DtCm_make_libentry(cms_entry *e, _DtCm_libentry **entry_r)
{
_DtCm_libentry *ptr;
CSA_return_code stat = CSA_SUCCESS;
if (entry_r == NULL)
return (CSA_E_INVALID_PARAMETER);
if ((ptr = (_DtCm_libentry *)calloc(1, sizeof(_DtCm_libentry)))
== NULL)
return (CSA_E_INSUFFICIENT_MEMORY);
if (e == NULL) {
if ((ptr->e = _DtCm_make_cms_entry(_DtCm_entry_name_tbl))
== NULL)
stat = CSA_E_INSUFFICIENT_MEMORY;
} else
stat = _DtCm_copy_cms_entry(e, &ptr->e);
if (stat == CSA_SUCCESS) {
ptr->handle = (void *)ptr;
*entry_r = ptr;
} else
free(ptr);
return (stat);
}
/*
* Get entry data from the server.
*/
extern CSA_return_code
_DtCm_get_entry_detail(_DtCm_libentry *entry)
{
CSA_return_code stat = CSA_SUCCESS;
if (entry->filled == B_FALSE)
return (_DtCm_rpc_lookup_entry_by_id(entry->cal, entry));
else
return (stat);
}
/*
* return attribute names of all attributes.
* ** how to deal with
* - predefined attributes with null values
* - custom attributes
*/
extern CSA_return_code
_DtCm_get_entry_attr_names(
_DtCm_libentry *entry,
CSA_uint32 *num_names_r,
char **names_r[])
{
char **names;
int i, j;
*names_r = NULL;
*num_names_r = 0;
if ((names = _DtCm_alloc_character_pointers(entry->e->num_attrs))
== NULL)
return (CSA_E_INSUFFICIENT_MEMORY);
/* first element in attr array is not used */
for (i = 1, j = 0; i <= entry->e->num_attrs; i++) {
/* there should not be any NULL names in the attr array */
if (entry->e->attrs[i].value != NULL) {
if ((names[j] = strdup(entry->e->attrs[i].name.name))
== NULL) {
_DtCm_free(names);
return (CSA_E_INSUFFICIENT_MEMORY);
} else
j++;
}
}
*names_r = names;
*num_names_r = j;
return (CSA_SUCCESS);
}
extern CSA_return_code
_DtCm_get_all_entry_attrs(
_DtCm_libentry *entry,
CSA_uint32 *num_attrs,
CSA_attribute **attrs)
{
int i, j;
CSA_return_code stat = CSA_SUCCESS;
CSA_attribute *attrs_r;
if (num_attrs == NULL || attrs == NULL)
return (CSA_E_INVALID_PARAMETER);
if ((attrs_r = _DtCm_alloc_attributes(entry->e->num_attrs)) == NULL)
return (CSA_E_INSUFFICIENT_MEMORY);
/* first element in attr array is not used */
for (i = 1, j = 0; i <= entry->e->num_attrs; i++) {
if (entry->e->attrs[i].value != NULL) {
if ((stat = _DtCm_cms2csa_attribute(entry->e->attrs[i],
&attrs_r[j])) != CSA_SUCCESS) {
_DtCm_free(attrs_r);
return (stat);
} else
j++;
}
}
*num_attrs = j;
*attrs = attrs_r;
return (CSA_SUCCESS);
}
/*
* Search the attribute list for the given attribute names.
* If it's not found, the attribute value
* is set to NULL.
*/
extern CSA_return_code
_DtCm_get_entry_attrs_by_name(
_DtCm_libentry *entry,
CSA_uint32 num_names,
CSA_attribute_reference *names,
CSA_uint32 *num_attrs,
CSA_attribute **attrs)
{
int i, j, index;
CSA_return_code stat = CSA_SUCCESS;
CSA_attribute *attrs_r;
if (num_attrs == NULL || attrs == NULL)
return (CSA_E_INVALID_PARAMETER);
if ((attrs_r = _DtCm_alloc_attributes(num_names)) == NULL)
return (CSA_E_INSUFFICIENT_MEMORY);
/* get attributes */
for (i = 0, j = 0; i < num_names; i++) {
if (names[i] != NULL) {
index = _DtCm_get_index_from_table(
entry->cal->entry_tbl, names[i]);
if (index >= 0 && entry->e->attrs[index].value) {
if (attrs_r[j].name =
strdup(entry->e->attrs[index].name.name))
{
stat = _DtCm_cms2csa_attrval(
entry->e->attrs[index].value,
&attrs_r[j].value);
} else
stat = CSA_E_INSUFFICIENT_MEMORY;
if (stat != CSA_SUCCESS) {
_DtCm_free(attrs_r);
return (stat);
} else
j++;
}
}
}
*num_attrs = j;
*attrs = attrs_r;
return (CSA_SUCCESS);
}
/*
* convert the linked list of entry structures to
* an array of entry handles.
*/
extern CSA_return_code
_DtCm_libentry_to_entryh(
_DtCm_libentry *elist,
CSA_uint32 *size,
CSA_entry_handle **entries_r)
{
CSA_return_code stat = CSA_SUCCESS;
CSA_entry_handle *eh;
_DtCm_libentry *ptr;
int i, j;
if (elist == NULL || size == NULL || entries_r == NULL)
return (CSA_E_INVALID_PARAMETER);
for (i = 0, ptr = elist; ptr != NULL; ptr = ptr->next)
i++;
if ((eh = _DtCm_alloc_entry_handles(i)) == NULL)
return (CSA_E_INSUFFICIENT_MEMORY);
for (j = 0; j < i; j++, elist = elist->next)
eh[j] = (CSA_entry_handle)elist;
*size = i;
*entries_r = eh;
return (CSA_SUCCESS);
}
extern CSA_return_code
_DtCmCmsentriesToLibentries(
_DtCmNameTable **tbl,
cms_entry *entries,
_DtCm_libentry **libentries)
{
CSA_return_code stat = CSA_SUCCESS;
_DtCm_libentry *entry, *head, *prev;
if (libentries == NULL)
return(CSA_E_INVALID_PARAMETER);
prev = head = NULL;
while (entries != NULL) {
if ((stat = _CmsentryToLibentry(tbl, entries, &entry))
!= CSA_SUCCESS)
break;
if (head == NULL)
head = entry;
else {
prev->next = entry;
entry->prev = prev;
}
prev = entry;
entries = entries->next;
}
if (stat != CSA_SUCCESS) {
_DtCm_free_libentries(head);
head = NULL;
}
*libentries = head;
return(stat);
}
extern CSA_return_code
_DtCm_appt4_to_libentries(
char *calname,
Appt_4 *appt4,
_DtCm_libentry **libentries)
{
CSA_return_code stat = CSA_SUCCESS;
_DtCm_libentry *entry, *head, *prev;
if (libentries == NULL)
return(CSA_E_INVALID_PARAMETER);
prev = head = NULL;
while (appt4 != NULL) {
if ((stat = _DtCm_make_libentry(NULL, &entry)) != CSA_SUCCESS)
break;
if ((stat = _DtCm_appt4_to_attrs(calname, appt4,
entry->e->num_attrs, entry->e->attrs, B_FALSE))
!= CSA_SUCCESS)
break;
entry->e->key.time = appt4->appt_id.tick;
entry->e->key.id = appt4->appt_id.key;
entry->filled = B_TRUE;
if (head == NULL)
head = entry;
else {
prev->next = entry;
entry->prev = prev;
}
prev = entry;
appt4 = appt4->next;
}
if (stat != CSA_SUCCESS) {
_DtCm_free_libentries(head);
head = NULL;
}
*libentries = head;
return(stat);
}
extern CSA_return_code
_DtCm_libentries_to_appt4(_DtCm_libentry *entries, Appt_4 **appt4)
{
CSA_return_code stat = CSA_SUCCESS;
Appt_4 *a4, *head, *prev;
if (appt4 == NULL)
return(CSA_E_INVALID_PARAMETER);
prev = head = NULL;
while (entries != NULL) {
if ((stat = _DtCm_cms_entry_to_appt4(entries->e, &a4)) != CSA_SUCCESS)
break;
if (head == NULL)
head = a4;
else {
prev->next = a4;
}
prev = a4;
entries = entries->next;
}
if (stat != CSA_SUCCESS) {
_DtCm_free_appt4(head);
head = NULL;
}
*appt4 = head;
return(stat);
}
extern CSA_return_code
_DtCm_reminder4_to_csareminder(
Reminder_4 *r4,
CSA_uint32 *num_rems,
CSA_reminder_reference **rems)
{
CSA_return_code stat = CSA_SUCCESS;
_DtCm_libentry *entry;
CSA_reminder_reference *rem_r;
int i, count;
Reminder_4 *rptr = r4;
char isotime[BUFSIZ];
if (num_rems == NULL || rems == NULL)
return(CSA_E_INVALID_PARAMETER);
if (r4 == NULL) {
*num_rems = 0;
*rems = NULL;
return (CSA_SUCCESS);
}
for (count = 0, rptr = r4; rptr != NULL; count++, rptr = rptr->next)
;
if ((rem_r = _DtCm_alloc_reminder_references(count)) == NULL) {
return (CSA_E_INSUFFICIENT_MEMORY);
}
i = 0;
while (r4 != NULL && r4->attr.attr != NULL) {
(void)_csa_tick_to_iso8601(r4->tick, isotime);
if ((rem_r[i].run_time = strdup(isotime)) == NULL) {
stat = CSA_E_INSUFFICIENT_MEMORY;
break;
}
if ((rem_r[i].attribute_name = strdup(
_DtCm_old_reminder_name_to_name(r4->attr.attr))) == NULL) {
stat = CSA_E_INSUFFICIENT_MEMORY;
break;
}
if ((stat = _DtCm_make_libentry(NULL, &entry)) == CSA_SUCCESS) {
entry->e->key.id = r4->appt_id.key;
entry->e->key.time = r4->appt_id.tick;
rem_r[i].entry = (CSA_entry_handle)entry;
} else
break;
r4 = r4->next;
i++;
}
if (stat == CSA_SUCCESS) {
*num_rems = i;
*rems = rem_r;
} else {
_DtCm_free(rem_r);
}
return(stat);
}
extern CSA_return_code
_DtCm_cms2csa_reminder_ref(
cms_reminder_ref *cmsrems,
CSA_uint32 *num_rems,
CSA_reminder_reference **csarems)
{
CSA_return_code stat = CSA_SUCCESS;
_DtCm_libentry *entry;
CSA_reminder_reference *rem_r;
cms_reminder_ref *rptr;
int i, count;
char isotime[BUFSIZ];
char *ptr;
CSA_opaque_data opq;
if (num_rems == NULL || csarems == NULL)
return(CSA_E_INVALID_PARAMETER);
if (cmsrems == NULL) {
*num_rems = 0;
*csarems = NULL;
return (CSA_SUCCESS);
}
for (count = 0, rptr = cmsrems; rptr != NULL; rptr = rptr->next)
count++;
if ((rem_r = _DtCm_alloc_reminder_references(count)) == NULL) {
return (CSA_E_INSUFFICIENT_MEMORY);
}
i = 0;
while (cmsrems != NULL && stat == CSA_SUCCESS) {
(void)_csa_tick_to_iso8601(cmsrems->runtime, isotime);
if ((rem_r[i].run_time = strdup(isotime)) == NULL) {
stat = CSA_E_INSUFFICIENT_MEMORY;
break;
}
if ((rem_r[i].attribute_name = strdup(cmsrems->reminder_name))
== NULL) {
stat = CSA_E_INSUFFICIENT_MEMORY;
break;
}
if ((stat = _DtCm_make_libentry(NULL, &entry)) == CSA_SUCCESS) {
opq.size = strlen(cmsrems->entryid);
opq.data = (unsigned char *)cmsrems->entryid;
/* put reference id in entry */
stat = _DtCm_set_opaque_attrval(&opq,
&entry->e->attrs\
[CSA_ENTRY_ATTR_REFERENCE_IDENTIFIER_I].value);
entry->e->key.id = cmsrems->key.id;
entry->e->key.time = cmsrems->key.time;
rem_r[i].entry = (CSA_entry_handle)entry;
} else
break;
cmsrems = cmsrems->next;
i++;
}
if (stat == CSA_SUCCESS) {
*num_rems = i;
*csarems = rem_r;
} else {
_DtCm_free(rem_r);
}
return(stat);
}
/*
* This routine convert the entry to an entry structure with
* a header so that it can be freed with csa_free
* Memory occupied by the orginal entry will be destroyed.
*/
extern _DtCm_libentry *
_DtCm_convert_entry_wheader(_DtCm_libentry *entry)
{
_DtCm_libentry *pentry;
if ((pentry = (_DtCm_libentry *)_DtCm_alloc_entry(
sizeof(_DtCm_libentry))) == NULL) {
_DtCm_free_libentries(entry);
return (NULL);
}
pentry->handle = (void *)pentry;
pentry->filled = entry->filled;
pentry->e = entry->e;
free(entry);
return(pentry);
}
/*
* this is invoked from csa_free indirectly
* to free one entry.
*/
extern void
_DtCm_free_entry_content(uint dummy, _DtCm_libentry *entry)
{
_DtCm_remove_from_entry_list(entry->cal, (caddr_t)entry, (caddr_t)entry);
if (entry->e) _DtCm_free_cms_entry(entry->e);
memset((void *)entry, NULL, sizeof(_DtCm_libentry));
}
/*
* free a linked list of entries
* It is first removed from the list and then freed.
*/
extern void
_DtCm_free_libentries_from_list(_DtCm_libentry *head, _DtCm_libentry *tail)
{
if (head == NULL || tail == NULL)
return;
_DtCm_remove_from_entry_list(head->cal, (caddr_t)head, (caddr_t)tail);
_DtCm_free_libentries(head);
}
/*
* free a linked list of appointments
* All the memory pointed to by the entry are freed,
* except for the attribute array.
* The entry structures are returned to the free list.
*/
extern void
_DtCm_free_libentries(_DtCm_libentry *entry)
{
_DtCm_libentry *nptr;
while (entry != NULL) {
nptr = entry->next;
if (entry->e) _DtCm_free_cms_entry(entry->e);
memset((void *)entry, NULL, sizeof(_DtCm_libentry));
free(entry);
entry = nptr;
}
}
/*
* Free the reminder linked list.
* The entry objects pointed to by the list are freed as well.
*/
extern void
_DtCm_free_reminder_references(uint num_rems, CSA_reminder_reference *rems)
{
CSA_reminder_reference *nptr;
_DtCm_libentry *entry, *head, *cptr;
int i;
head = cptr = NULL;
for (i = 0; i < num_rems; i++) {
entry = (_DtCm_libentry *)rems[i].entry;
if (entry && entry->handle == (void *)entry) {
if (head == NULL) {
head = cptr = entry;
} else if (cptr->next == entry) {
cptr = cptr->next;
} else {
_DtCm_free_libentries_from_list(head, cptr);
head = cptr = entry;
}
}
if (rems[i].run_time)
free(rems[i].run_time);
if (rems[i].snooze_time)
free(rems[i].snooze_time);
if (rems[i].attribute_name)
free(rems[i].attribute_name);
}
_DtCm_free_libentries_from_list(head, cptr);
}
extern void
_DtCm_free_entry_handles(uint num_entries, CSA_entry_handle *entries)
{
int i;
_DtCm_libentry *entry, *head, *cptr;
DP(("api.c: _DtCm_free_entry_handles\n"));
head = cptr = NULL;
for (i = 0, head = cptr = NULL; i < num_entries; i++) {
/* in case it is a bad appointment handle */
if ((entry = _DtCm_get_libentry(entries[i])) != NULL) {
/*
* rather than freeing one appointment at a time,
* check to see if the appointments are linked to
* each other and free each consecutive chunk together
*/
if (head == NULL) {
head = cptr = entry;
} else if (cptr->next == entry) {
cptr = cptr->next;
} else {
_DtCm_free_libentries_from_list(head, cptr);
head = cptr = entry;
}
}
}
_DtCm_free_libentries_from_list(head, cptr);
}
/******************************************************************************
* static functions used within in the file
******************************************************************************/
static CSA_return_code
_CmsentryToLibentry(
_DtCmNameTable **tbl,
cms_entry *e,
_DtCm_libentry **entry_r)
{
_DtCm_libentry *entry;
CSA_return_code stat;
if ((stat = _DtCm_make_libentry(NULL, &entry)) != CSA_SUCCESS)
return (stat);
if ((stat = _DtCmUpdateAttributes(e->num_attrs, e->attrs,
&entry->e->num_attrs, &entry->e->attrs, tbl, B_FALSE,
NULL, B_FALSE)) != CSA_SUCCESS) {
_DtCm_free_libentries(entry);
} else {
entry->e->key = e->key;
entry->filled = B_TRUE;
*entry_r = entry;
}
return (stat);
}

105
cde/lib/csa/entry.h Normal file
View File

@@ -0,0 +1,105 @@
/* $XConsortium: entry.h /main/1 1996/04/21 19:23:13 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#ifndef _ENTRY_H
#define _ENTRY_H
/*
* This file contains the internal data structure of entries.
*/
#include <EUSCompat.h>
#include "ansi_c.h"
#include "cm.h"
#include "calendar.h"
#include "rtable4.h"
typedef struct _libentry {
void *handle; /* for sanity check */
Calendar *cal; /* associated calendar */
cms_entry *e;
boolean_t filled;
struct _libentry *next;
struct _libentry *prev;
} _DtCm_libentry;
/* function prototypes */
extern _DtCm_libentry *_DtCm_get_libentry P((CSA_entry_handle entryh));
extern CSA_return_code _DtCm_make_libentry P((
cms_entry *cmsentry,
_DtCm_libentry **entry_r));
extern CSA_return_code _DtCm_get_entry_detail P((_DtCm_libentry *entry));
extern CSA_return_code _DtCm_get_entry_attr_names P((
_DtCm_libentry *entry,
CSA_uint32 *num_names_r,
char **names_r[]));
extern CSA_return_code _DtCm_get_entry_attrs_by_name P((
_DtCm_libentry *entry,
CSA_uint32 num_names,
CSA_attribute_reference *names,
CSA_uint32 *num_attrs,
CSA_attribute **attrs));
extern CSA_return_code _DtCm_get_all_entry_attrs P((
_DtCm_libentry *entry,
CSA_uint32 *num_attrs,
CSA_attribute **attrs));
extern CSA_return_code _DtCm_libentry_to_entryh P((
_DtCm_libentry *elist,
CSA_uint32 *size,
CSA_entry_handle **entries_r));
extern CSA_return_code _DtCmCmsentriesToLibentries P((
_DtCmNameTable **tbl,
cms_entry *entries,
_DtCm_libentry **libentries));
extern CSA_return_code _DtCm_appt4_to_libentries P((
char *calname,
Appt_4 *appt4,
_DtCm_libentry **libentries));
extern CSA_return_code _DtCm_libentries_to_appt4 P((
_DtCm_libentry *libentries,
Appt_4 **appt4));
extern CSA_return_code _DtCm_reminder4_to_csareminder P((
Reminder_4 *r4,
CSA_uint32 *num_rems,
CSA_reminder_reference **rems));
extern _DtCm_libentry *_DtCm_convert_entry_wheader P((_DtCm_libentry *entry));
extern void _DtCm_free_libentries_from_list P((
_DtCm_libentry *head,
_DtCm_libentry *tail));
extern void _DtCm_free_libentries P((_DtCm_libentry *entries));
extern void _DtCm_free_entry_handles P((
uint num_entries,
CSA_entry_handle *entries));
extern void _DtCm_free_reminder_references P((
uint num_rems,
CSA_reminder_reference *rems));
extern void _DtCm_free_entry_content P((uint dummy, _DtCm_libentry *entry));
extern CSA_return_code _DtCm_cms2csa_reminder_ref P((
cms_reminder_ref *cmsrems,
CSA_uint32 *num_rems,
CSA_reminder_reference **csarems));
#endif

197
cde/lib/csa/free.c Normal file
View File

@@ -0,0 +1,197 @@
/* $XConsortium: free.c /main/1 1996/04/21 19:23:16 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#include <EUSCompat.h>
#include <stdlib.h>
#include "csa.h"
#include "free.h"
#define _DtCM_OUR_MEMORY 0x55555555
typedef void (*_DtCmFreeProc)(uint num_elem, void *ptr);
typedef struct {
int mark;
uint num_elem;
_DtCmFreeProc fproc;
} _DtCmMemHeader;
/******************************************************************************
* forward declaration of static functions used within the file
******************************************************************************/
static void _DtCm_free_calendar_users(uint num_elem, void *vptr);
/*****************************************************************************
* extern functions used in the library
*****************************************************************************/
extern CSA_calendar_user *
_DtCm_alloc_calendar_users(uint num_elem)
{
char *ptr;
_DtCmMemHeader *hptr;
if ((ptr = calloc(1, sizeof(_DtCmMemHeader) +
sizeof(CSA_calendar_user) * num_elem)) == NULL)
return (NULL);
else {
hptr = (_DtCmMemHeader *)ptr;
hptr->mark = _DtCM_OUR_MEMORY;
hptr->num_elem = num_elem;
hptr->fproc = _DtCm_free_calendar_users;
return ((CSA_calendar_user *)(ptr + sizeof(_DtCmMemHeader)));
}
}
extern char **
_DtCm_alloc_character_pointers(uint num_elem)
{
char *ptr;
_DtCmMemHeader *hptr;
if ((ptr = calloc(1, sizeof(_DtCmMemHeader) +
sizeof(char *) * num_elem)) == NULL)
return (NULL);
else {
hptr = (_DtCmMemHeader *)ptr;
hptr->mark = _DtCM_OUR_MEMORY;
hptr->num_elem = num_elem;
hptr->fproc = _DtCm_free_character_pointers;
return ((char **)(ptr + sizeof(_DtCmMemHeader)));
}
}
extern CSA_attribute *
_DtCm_alloc_attributes(uint num_elem)
{
char *ptr;
_DtCmMemHeader *hptr;
extern void _DtCm_free_attributes(uint size, void *attrs);
if ((ptr = calloc(1, sizeof(_DtCmMemHeader) +
sizeof(CSA_attribute) * num_elem)) == NULL)
return (NULL);
else {
hptr = (_DtCmMemHeader *)ptr;
hptr->mark = _DtCM_OUR_MEMORY;
hptr->num_elem = num_elem;
hptr->fproc = _DtCm_free_attributes;
return ((CSA_attribute *)(ptr + sizeof(_DtCmMemHeader)));
}
}
extern CSA_entry_handle *
_DtCm_alloc_entry_handles(uint num_elem)
{
char *ptr;
_DtCmMemHeader *hptr;
extern void _DtCm_free_entry_handles(uint num_entries, void *entries);
if ((ptr = calloc(1, sizeof(_DtCmMemHeader) +
sizeof(CSA_entry_handle) * num_elem)) == NULL)
return (NULL);
else {
hptr = (_DtCmMemHeader *)ptr;
hptr->mark = _DtCM_OUR_MEMORY;
hptr->num_elem = num_elem;
hptr->fproc = _DtCm_free_entry_handles;
return ((CSA_entry_handle *)(ptr + sizeof(_DtCmMemHeader)));
}
}
extern void *
_DtCm_alloc_entry(uint size)
{
char *ptr;
_DtCmMemHeader *hptr;
extern void _DtCm_free_entry_content(uint dummy, void *entry);
if ((ptr = calloc(1, sizeof(_DtCmMemHeader) + size)) == NULL)
return (NULL);
else {
hptr = (_DtCmMemHeader *)ptr;
hptr->mark = _DtCM_OUR_MEMORY;
hptr->num_elem = 1;
hptr->fproc = _DtCm_free_entry_content;
return ((void *)(ptr + sizeof(_DtCmMemHeader)));
}
}
extern CSA_reminder_reference *
_DtCm_alloc_reminder_references(uint num_elem)
{
char *ptr;
_DtCmMemHeader *hptr;
extern void _DtCm_free_reminder_references(uint num_rems, void *rems);
if ((ptr = calloc(1, sizeof(_DtCmMemHeader) +
sizeof(CSA_reminder_reference) * num_elem)) == NULL)
return (NULL);
else {
hptr = (_DtCmMemHeader *)ptr;
hptr->mark = _DtCM_OUR_MEMORY;
hptr->num_elem = num_elem;
hptr->fproc = _DtCm_free_reminder_references;
return ((CSA_reminder_reference *)(ptr +
sizeof(_DtCmMemHeader)));
}
}
extern CSA_return_code
_DtCm_free(void *ptr)
{
_DtCmMemHeader *hptr;
if (ptr == NULL)
return (CSA_E_INVALID_MEMORY);
hptr = (_DtCmMemHeader *)(((char *)ptr) - sizeof(_DtCmMemHeader));
if (hptr->mark != _DtCM_OUR_MEMORY)
return (CSA_E_INVALID_MEMORY);
else {
hptr->mark = 0;
hptr->fproc(hptr->num_elem, ptr);
free(hptr);
return (CSA_SUCCESS);
}
}
extern void
_DtCm_free_character_pointers(uint num_elem, void *vptr)
{
char **ptr = (char **)vptr;
int i;
for (i = 0; i < num_elem; i++) {
if (ptr[i])
free(ptr[i]);
else
break;
}
}
/******************************************************************************
* static functions used within in the file
******************************************************************************/
static void
_DtCm_free_calendar_users(uint num_elem, void *vptr)
{
CSA_calendar_user *ptr = (CSA_calendar_user *)vptr;
int i;
for (i = 0; i < num_elem; i++) {
if (ptr[i].user_name)
free(ptr[i].user_name);
if (ptr[i].calendar_address)
free(ptr[i].calendar_address);
}
}

32
cde/lib/csa/free.h Normal file
View File

@@ -0,0 +1,32 @@
/* $XConsortium: free.h /main/1 1996/04/21 19:23:19 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#ifndef _FREE_H
#define _FREE_H
#include <EUSCompat.h>
#include "ansi_c.h"
extern CSA_calendar_user *_DtCm_alloc_calendar_users(uint num_elem);
extern char **_DtCm_alloc_character_pointers(uint num_elem);
extern CSA_attribute *_DtCm_alloc_attributes(uint num_elem);
extern CSA_entry_handle *_DtCm_alloc_entry_handles(uint num_elem);
extern CSA_reminder_reference *_DtCm_alloc_reminder_references(uint num_elem);
extern void *_DtCm_alloc_entry();
extern CSA_return_code _DtCm_free(void *ptr);
extern void _DtCm_free_character_pointers P((uint num_elem, void *vptr));
#endif

218
cde/lib/csa/hash.c Normal file
View File

@@ -0,0 +1,218 @@
/* $XConsortium: hash.c /main/1 1996/04/21 19:23:21 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
/*
Synopsis:
#include "hash.h"
void * _DtCmMakeHash(int size)
void * _DtCmMakeIHash(int size)
void ** _DtCmGetHash(void * tbl, unsigned char * key)
void ** _DtCmFindHash(void * tbl,unsigned char * key)
void ** _DtCmDelHash(void * tbl, unsigned char * key)
int _DtCmOperateHash(void * tbl, void (*op_func)(), void * usr_arg)
void _DtCmDestroyHash(void * tbl, int (*des_func)(), void * usr_arg)
Description:
These routines provide a general purpose hash table facility that
supports multiple open hash tables. Each entry in the table consists of a
key and a data ptr. The key is a null terminated character string, while
the data ptr is opaque. Since all the entries are maintained in a doubly
linked lists, deletions and operations on entire table execute very quickly.
This make these routines suitable for use when the tables may be very ephemeral.
_DtCmMakeHash returns a pointer to the created table. The size argument
indicate the number of buckets the routine is to allocate. This should be ~
the max number of items expected in the table for maximum performance....
but /2 or /3 should still be ok. Note that for maximum efficiency the hash
table size should be a prime number (a side effect of the hash alorithm).
_DtCmMakeIHash performs the same function as _DtCmMakeHash, except that the hash
routines will use the key arguments as arbitrary integers rather than strings.
_DtCmGetHash searches the specified hash table tbl for an entry with the
specified key. If the entry does not exist, it is created with a NULL data
ptr. The routine returns a ptr to the area where the data ptr is (can be)
stored.
_DtCmFindHash searchs the table for an entry with the specified key. If the
entry is found, the address of the data pointer associated with the key is
returned. If no such entry exists, the routine returns NULL.
_DtCmDelHash deletes the specified table entry and returns the associated data
ptr. If the entry did not exist ( or the data ptr was NULL), the routine
returns NULL.
_DtCmOperateHash calls the routine pointed to by op_func once for each entry
in tbl, with three arguments: the data ptr, the usr_arg ptr and a ptr to the
key for that entry (which should NOT be altered). This is useful for
transversing a hash table quickly and operating on the entries. Note that
the order of the traversal of the hash table is the reverse order of
insertion.
_DtCmDestroyHash destroys the specified hash table after operating on it
with the specified des_func function as described for _DtCmOperateHash. All storage
allocated by the hash routines is reclaimed.
Author: Bart Smaalders 1/89
*/
#include <EUSCompat.h>
#include <stdio.h> /* grab NULL define */
#include <stdlib.h>
#include <string.h>
#include "hash.h"
static int hash_string();
typedef struct hash_entry {
struct hash_entry
* next_entry,
* right_entry,
* left_entry;
unsigned char * key;
void * data;
} hash_entry;
typedef struct hash {
int size;
hash_entry ** table;
hash_entry * start;
enum hash_type { String_Key = 0 , Integer_Key = 1} hash_type;
} hash;
void * _DtCmMakeHash(int size)
{
hash * ptr;
ptr = (hash *) malloc(sizeof(*ptr));
ptr->size = size;
ptr->table = (hash_entry **) malloc( (unsigned) (sizeof(hash_entry *) * size) );
(void)memset((char *) ptr->table, (char) 0, sizeof(hash_entry *)*size);
ptr->start = NULL;
ptr->hash_type = String_Key;
return((void*)ptr);
}
void ** _DtCmGetHash(void * t, const unsigned char * key)
{
hash * tbl = (hash *) t;
register int bucket;
register hash_entry * tmp;
hash_entry * new;
if(tbl->hash_type == String_Key)
tmp = tbl->table[bucket = hash_string(key, tbl->size)];
else
tmp = tbl->table[bucket = abs((long)key) % tbl->size];
if(tbl->hash_type == String_Key)
while(tmp!=NULL)
{
if(strcmp((char *)tmp->key, (char *)key)==0)
return(&tmp->data);
tmp = tmp->next_entry;
}
else
while(tmp!=NULL)
{
if(tmp->key == key)
return(&tmp->data);
tmp = tmp->next_entry;
}
/*
not found....
insert new entry into bucket...
*/
new = (hash_entry *) malloc(sizeof(*new));
new->key = (unsigned char *)((tbl->hash_type == String_Key)?(unsigned char *)strdup((char *)key):key);
/*
hook into chain from tbl...
*/
new->right_entry = NULL;
new->left_entry = tbl->start;
tbl->start = new;
/*
hook into bucket chain
*/
new->next_entry = tbl->table[bucket];
tbl->table[bucket] = new;
new->data = NULL; /* so we know that it is new */
return((void*)& new->data);
}
void ** _DtCmFindHash(void * t, const unsigned char * key)
{
register hash * tbl = (hash *) t;
register hash_entry * tmp;
if(tbl->hash_type == String_Key)
{
tmp = tbl->table[hash_string(key, tbl->size)];
for(;tmp!=NULL; tmp = tmp->next_entry)
if(!strcmp((char *)tmp->key, (char *)key))
return((void *)&tmp->data);
}
else
{
tmp = tbl->table[abs((long)key) % tbl->size];
for(;tmp!=NULL; tmp = tmp->next_entry)
if(tmp->key == key)
return((void *)&tmp->data);
}
return(NULL);
}
void _DtCmDestroyHash(void * t, int (*ptr)(), void * usr_arg)
{
hash * tbl = (hash *) t;
register hash_entry * tmp = tbl->start, * prev;
while(tmp)
{
if(ptr)
(*ptr)(tmp->data,usr_arg, tmp->key);
if(tbl->hash_type == String_Key)
free(tmp->key);
prev = tmp;
tmp = tmp->left_entry;
free((char *)prev);
}
free((char *)tbl->table);
free(tbl);
}
static int hash_string(s,modulo)
register char *s;
int modulo;
{
register unsigned result = 0;
register int i=1;
while(*s!=0)
result += (*s++ << i++);
return(result % modulo);
}

23
cde/lib/csa/hash.h Normal file
View File

@@ -0,0 +1,23 @@
/* $XConsortium: hash.h /main/1 1996/04/21 19:23:24 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#ifndef _HASH_H
#define _HASH_H
#include "ansi_c.h"
extern void * _DtCmMakeHash P((int size));
extern void ** _DtCmGetHash P((void * tbl, const unsigned char * key));
extern void ** _DtCmFindHash P((void * tbl,const unsigned char * key));
extern void _DtCmDestroyHash P((void * tbl, int (*des_func)(), void * usr_arg));
#endif /* _HASH_H */

319
cde/lib/csa/iso8601.c Normal file
View File

@@ -0,0 +1,319 @@
/* $TOG: iso8601.c /main/2 1997/12/29 10:46:50 bill $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#include <EUSCompat.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <time.h>
#include <string.h>
#include "iso8601.h"
static void
set_timezone(char *tzname)
{
static char tzenv[BUFSIZ];
if (tzname==NULL)
system("unset TZ\n");
else {
sprintf(tzenv, "TZ=%s", tzname);
(void) putenv(tzenv);
tzset();
}
}
static int
validate_iso8601(char *buf)
{
/* validation rules:
* - sscanf returns # of matches, which must be 6.
* - crude range check on each numerical value scanned.
* - length of input is fixed: strlen("CCYYMMDDThhmmssZ")
* - last char must be Z, indicating UTC time
*/
int year, month, day, hour, min, sec;
int scan_ret=0;
static char tmp[] = "CCYYMMDDThhmmssZ";
scan_ret=sscanf(buf, "%4d%2d%2dT%2d%2d%2dZ",
&year, &month, &day, &hour, &min, &sec);
/* the rules: if any fail, whole test fails so return */
if (strlen(buf) != strlen(tmp)) return (-1);
if (buf[strlen(buf)-1] != 'Z') return (-1);
if (scan_ret != 6) return (-1);
if ((year<1970) || (year>2038)) return (-1);
if ((month<1) || (month>12)) return (-1);
if ((day<1) || (day>31)) return (-1);
if ((hour<0) || (hour>24)) return (-1);
if ((min<0) || (min>59)) return (-1);
if ((sec<0) || (sec>59)) return (-1);
return (0);
}
/*
* _csa_iso8601_to_tick - convert a standard date/time string to a tick
*
* Note 1:This function supports a limited subset of the iso8601 standard.
* Only one of the variations described by the standard is
* supported, namely:
*
* CCYYMMDDThhmmssZ
*
* ...known in the standard as "Complete Representation, Basic Format"
* for calendar date and "Coordinated Universal Time (UTC), Basic Format"
* for time.
*
* This can carry all the information required for date+time by
* the CDE 1.0 Calendar component. More general support, if ever
* needed (say for interoperability or finer granularity) can be
* implemented inside this function without modifying its interface.
*
* Note 2:All output time information is in UTC, and all input
* time information is assumed to be pre-converted to UTC.
*
* dac 19940728T224055Z :-)
*/
int
_csa_iso8601_to_tick(char *buf, time_t *tick_out)
{
int year, month, day, hour, min, sec;
struct tm time_str;
char tz_orig[BUFSIZ];
boolean_t orig_tzset = B_FALSE;
int scan_ret=0;
scan_ret=sscanf(buf, "%4d%2d%2dT%2d%2d%2dZ",
&year, &month, &day, &hour, &min, &sec);
if (validate_iso8601(buf) != 0)
return(-1);
time_str.tm_year = year - 1900;
time_str.tm_mon = month - 1;
time_str.tm_mday = day;
time_str.tm_hour = hour;
time_str.tm_min = min;
time_str.tm_sec = sec;
time_str.tm_isdst = -1;
if (getenv("TZ")) {
strncpy(tz_orig, getenv("TZ"), sizeof(tz_orig));
tz_orig[sizeof(tz_orig)-1] = '\0';
orig_tzset = B_TRUE;
}
#ifdef __osf__
set_timezone("GMT0");
#else
set_timezone("GMT");
#endif
*tick_out = mktime(&time_str);
if (orig_tzset == B_TRUE)
set_timezone(tz_orig);
else
set_timezone(NULL);
if (*tick_out != (long)-1)
return(0);
else
return(-1);
}
/*
* _csa_tick_to_iso8601 - convert from tick to iso8601 time string
*
* Note 1: Similar comments to the above. This function complements
* _csa_iso8601_to_tick, providing bi-directional conversion.
*
* Note 2: All input and output time information is UTC.
*/
int
_csa_tick_to_iso8601(time_t tick, char *buf_out)
{
struct tm *time_str;
time_t tk=tick;
char tz_orig[BUFSIZ];
boolean_t orig_tzset = B_FALSE;
/* tick must be +ve to be valid */
if (tick < 0) {
return(-1);
}
if (getenv("TZ")) {
strncpy(tz_orig, getenv("TZ"), sizeof(tz_orig));
tz_orig[sizeof(tz_orig)-1] = '\0';
orig_tzset = B_TRUE;
}
#ifdef __osf__
set_timezone("GMT0");
#else
set_timezone("GMT");
#endif
time_str = localtime(&tk);
if (orig_tzset == B_TRUE)
set_timezone(tz_orig);
else
set_timezone(NULL);
/* format string forces fixed width (zero-padded) fields */
sprintf(buf_out, "%04d%02d%02dT%02d%02d%02dZ",
time_str->tm_year + 1900,
time_str->tm_mon + 1,
time_str->tm_mday,
time_str->tm_hour,
time_str->tm_min,
time_str->tm_sec);
return (0);
}
/*
* Convert iso8601 date time range to a start tick and an end tick
*
* iso8601 range is:
* <start> "/" <end>
*
* start and end are iso8601 strings in CCYYMMDDThhmmssZ format.
*/
int
_csa_iso8601_to_range(char *buf, time_t *start, time_t *end)
{
int nchars;
char tmpstr[BUFSIZ];
char *p;
if ((p = strchr(buf, '/')) == NULL) {
return (-1);
}
nchars=(p-buf);
strncpy(tmpstr, buf, (size_t)nchars);
tmpstr[nchars]='\0';
if (_csa_iso8601_to_tick(tmpstr, start) != 0) {
return (-1);
}
p++;
if (_csa_iso8601_to_tick(p, end) != 0) {
return (-1);
}
if (end < start)
return (-1);
else
return(0);
}
/*
* Convert time range specified as start/end ticks to iso8601 format
*
* iso8601 result is:
* <start> "/" <end>
*
* start and end are iso8601 strings in CCYYMMDDThhmmssZ format.
*/
int
_csa_range_to_iso8601(time_t start, time_t end, char *buf)
{
char tmpstr1[BUFSIZ], tmpstr2[BUFSIZ];
/* validate: ticks must be +ve, and end can't preceed start */
if ((start < 0) || (end < 0) || (end < start)) {
return(-1);
}
if (_csa_tick_to_iso8601(start, tmpstr1) != 0) {
return (-1);
}
if (_csa_tick_to_iso8601(end, tmpstr2) != 0) {
return (-1);
}
if (sprintf(buf, "%s/%s", tmpstr1, tmpstr2) < 0) {
return (-1);
}
else
return(0);
}
static int
not_sign(char c)
{
if ((c=='+') || (c=='-'))
return (0);
else
return (1);
}
/*
* This converts from a string representation of a quantity of time,
* to (signed) integer number of * seconds.
* The first character (byte) must be a '+' or * a '-', indicating
* the sense of the period. This can be used however you like - it's
* just a way of carrying round the sign, while keeping the main part
* of the string in ISO 8601.
* The string must be in the format described by ISO 8601, clause
* 5.5.1 (b), with the added restriction that only seconds may be specified.
* format: [+/-]PTnS
*/
int
_csa_iso8601_to_duration(char *buf, time_t *sec)
{
/* buf must begin with '+' or '-', then 'P', end with 'S' */
char sign, *ptr, *ptr2, *numptr;
int num=0;
ptr2 = ptr = buf;
sign = *ptr++;
if (not_sign(sign)) {
if (*ptr2++ != 'P' || *ptr2++ != 'T') {
return (-1);
}
} else if (not_sign(sign) || *ptr++ != 'P' || *ptr++ != 'T') {
return (-1);
}
if (not_sign(sign))
ptr = ptr2;
numptr = ptr;
while (*ptr >= '0' && *ptr <= '9') ptr++;
if (numptr == ptr || !(*ptr && *ptr++ == 'S' && *ptr == NULL))
return (-1);
else {
num = atoi(numptr);
*sec = (sign == '-') ? -num : num;
return (0);
}
}
/*
* This converts from a (signed) integer number of seconds to a string
* representation. The string format is a sign character followed by
* an IS0 8601 string as described above for _csa_iso8601_to_duration.
*/
int
_csa_duration_to_iso8601(time_t sec, char *buf)
{
sprintf(buf, "%cPT%dS", (sec < 0) ? '-': '+', abs(sec));
return(0);
}

27
cde/lib/csa/iso8601.h Normal file
View File

@@ -0,0 +1,27 @@
/* $XConsortium: iso8601.h /main/1 1996/04/21 19:23:30 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#ifndef ISO8601_H
#define ISO8601_H
/*
* iso8601.h
*
* header file for functions to convert between tick and
* ISO 8601 times, ranges and durations.
*/
/* extern functions */
extern int _csa_iso8601_to_tick(char *, time_t *);
extern int _csa_tick_to_iso8601(time_t, char *);
extern int _csa_iso8601_to_range(char *, time_t *, time_t *);
extern int _csa_range_to_iso8601(time_t, time_t, char *);
extern int _csa_iso8601_to_duration(char *, time_t *);
extern int _csa_duration_to_iso8601(time_t, char *);
#endif /* ISO8601_H */

290
cde/lib/csa/laccess.c Normal file
View File

@@ -0,0 +1,290 @@
/* $XConsortium: laccess.c /main/1 1996/04/21 19:23:33 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#include <EUSCompat.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "laccess.h"
#include "lutil.h"
/******************************************************************************
* forward declaration of static functions used within the file
******************************************************************************/
static void get_component(char **str, char *comp, char token);
static void get_last_component(char *head, char **tail, char *comp, char token);
static boolean_t match_forward(char *str1, char *str2);
static boolean_t match_backward(char *str1, char *str2);
/*****************************************************************************
* extern functions used in the library
*****************************************************************************/
/*
* Correct format assumed, i.e. str = label1[.label2 ...]
* Compare str2 against str1 which should be more fully qualified than str2
*/
extern boolean_t
_DtCmIsSamePath(char *str1, char *str2)
{
char *ptr1,*ptr2;
char *user;
int res, n;
if (str1 == NULL || str2 == NULL)
return(B_FALSE);
/* check format */
if (*str1 == '.' || *str2 == '.')
return (B_FALSE); /* bad format */
if (match_forward(str1, str2) == B_TRUE)
return (B_TRUE);
else
return (match_backward(str1, str2));
}
/*
* compare user1 and user2
* user1 = user@host[.domain]
* user2 = any format in (user, user@host[.domain], user@domain)
*/
extern boolean_t
_DtCmIsSameUser(char *user1, char *user2)
{
char *str1, *str2;
char buf[BUFSIZ], *domain;
boolean_t res;
if (user1 == NULL || user2 == NULL)
return (B_FALSE);
/* compare user name */
str1 = _DtCmGetPrefix(user1, '@');
str2 = _DtCmGetPrefix(user2, '@');
if (str1 == NULL || str2 == NULL)
return (B_FALSE);
if (strcmp(str1, str2)) {
free(str1);
free(str2);
return (B_FALSE);
}
free(str1);
free(str2);
/* if only user name is specified, don't need to check domain */
str2 = strchr(user2, '@');
if (str2 == NULL)
return (B_TRUE);
domain = _DtCmGetLocalDomain(NULL);
/* first assume user2=user@domain */
str1 = strchr(user1, '.');
if (str1 == NULL) {
if (_DtCmIsSamePath(domain, ++str2)) {
free(domain);
return (B_TRUE);
}
} else {
if (_DtCmIsSamePath(++str1, ++str2)) {
return (B_TRUE);
}
}
/* assume user2=user@host[.domain] */
if (str1 == NULL) {
str1 = strchr(user1, '@');
sprintf(buf, "%s.%s", ++str1, domain);
str1 = buf;
} else {
str1 = strchr(user1, '@');
str1++;
}
if (_DtCmIsSamePath(str1, str2))
return (B_TRUE);
else
return (B_FALSE);
}
/*****************************************************************************
* static functions used within the file
*****************************************************************************/
/*
* str consists of components separated by token
* get and copy the first component into comp and
* strip it out of str, so str would point to the first
* token or the null terminator.
*/
static void
get_component(char **str, char *comp, char token)
{
char *ptr;
*comp = 0;
if (str == NULL)
return;
else
ptr = *str;
while (ptr && *ptr != 0 && *ptr != token)
*comp++ = *ptr++;
*str = ptr;
*comp = 0;
}
/*
* head and tail points to the first and last character
* of a string which consists of components separated by token.
* get and copy the last component into comp and
* strip it out of the string, so tail would point to the last
* token or the head of the string.
*/
static void
get_last_component(char *head, char **tail, char *comp, char token)
{
char *ptr, *cptr;
*comp = 0;
if (tail == NULL)
return;
else
cptr = *tail;
while (cptr != head && *cptr != token)
cptr--;
if (*cptr == token)
ptr = cptr + 1;
else
ptr = cptr;
while (ptr != (*tail + 1))
*comp++ = *ptr++;
*tail = cptr;
*comp = 0;
}
static boolean_t
match_forward(char *str1, char *str2)
{
char com1[BUFSIZ], com2[BUFSIZ];
if (str1 == NULL || str2 == NULL)
return (B_FALSE);
while (B_TRUE) {
get_component(&str1, com1, '.');
get_component(&str2, com2, '.');
if (*com1) {
if (*com2 == NULL)
return (B_TRUE);
} else {
if (*com2 == NULL)
return (B_TRUE);
else
return (B_FALSE);
}
if (strcasecmp(com1, com2) != 0)
return (B_FALSE);
/* take care of case: a.b a. */
if (strcmp(str2, ".") == 0
&& (strcmp(str1, ".") != 0 || *str1 != NULL))
return (B_FALSE);
/* skip "." */
if (*str1 == '.') {
if (*str2 == NULL)
return (B_TRUE);
else {
str1++;
str2++;
}
} else if (strcmp(str2, ".") == 0 || *str2 == NULL)
return (B_TRUE);
else
return (B_FALSE);
}
}
static boolean_t
match_backward(char *str1, char *str2)
{
int len1, len2;
char *ptr1, *ptr2;
char com1[BUFSIZ], com2[BUFSIZ];
if (str1 == NULL || str2 == NULL)
return (B_FALSE);
len1 = strlen(str1);
len2 = strlen(str2);
if (len2 > len1)
return (B_FALSE);
else if (len2 == 0)
return (B_TRUE);
ptr1 = (len1 ? (str1 + len1 - 1) : str1);
ptr2 = (len2 ? (str2 + len2 - 1) : str2);
if (*ptr1 == '.' && ptr1 != str1)
ptr1--;
if (*ptr2 == '.' && ptr2 != str2)
ptr2--;
while (B_TRUE) {
get_last_component(str1, &ptr1, com1, '.');
get_last_component(str2, &ptr2, com2, '.');
if (*com1) {
if (*com2 == NULL)
return (B_TRUE);
} else {
if (*com2 == NULL)
return (B_TRUE);
else
return (B_FALSE);
}
if (strcasecmp(com1, com2) != 0)
return (B_FALSE);
/* skip "." */
if (*ptr1 == '.') {
if (ptr1 != str1)
ptr1--;
else
return (B_FALSE); /* bad format */
} else
return (B_TRUE); /* done */
if (*ptr2 == '.') {
if (ptr2 != str2)
ptr2--;
else
return (B_FALSE); /* bad format */
} else
return (B_TRUE); /* done */
}
}

18
cde/lib/csa/laccess.h Normal file
View File

@@ -0,0 +1,18 @@
/* $XConsortium: laccess.h /main/1 1996/04/21 19:23:36 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#ifndef _LACCESS_H
#define _LACCESS_H
#include "ansi_c.h"
extern boolean_t _DtCmIsSamePath P((char *str1, char *str2));
extern boolean_t _DtCmIsSameUser P((char *user1, char *user2));
#endif

601
cde/lib/csa/libcsa.elist Normal file
View File

@@ -0,0 +1,601 @@
/* $TOG: libcsa.elist /main/3 1999/10/14 17:47:27 mgreess $
*
* (c) Copyright 1996 Digital Equipment Corporation.
* (c) Copyright 1996 Hewlett-Packard Company.
* (c) Copyright 1996 International Business Machines Corp.
* (c) Copyright 1996 Sun Microsystems, Inc.
* (c) Copyright 1996 Novell, Inc.
* (c) Copyright 1996 FUJITSU LIMITED.
* (c) Copyright 1996 Hitachi.
*/
/*************************************************************************
* Export list for libcsa
* This list *must* be updated whenever a change is made to the library API.
*
* The syntax for the symbol declarations in this list is as follows:
* public sym => Public C symbol, i.e., publicized API
* publicC++ sym => Public C++ symbol, i.e., publicized API
* private sym => Private C symbol, i.e., unpublicized API
* privateC++ sym => Private C++ symbol, i.e., unpublicized API
* internal sym => Internal C symbol, i.e., not part of API
* internalC++ sym => Internal C++ symbol, i.e., not part of API
*
**************************************************************************/
/********************************************************************
* Public symbols -- available to everyone
********************************************************************/
public csa_free
public csa_list_calendars
public csa_logoff
public csa_logon
public csa_look_up
public csa_query_configuration
public csa_restore
public csa_save
public csa_add_calendar
public csa_delete_calendar
public csa_list_calendar_attributes
public csa_read_calendar_attributes
public csa_register_callback
public csa_unregister_callback
public csa_call_callbacks
public csa_update_calendar_attributes
public csa_add_entry
public csa_delete_entry
public csa_free_time_search
public csa_list_entries
public csa_list_entry_attributes
public csa_list_entry_sequence
public csa_read_entry_attributes
public csa_read_next_reminder
public csa_update_entry_attributes
public csa_add_event
public csa_add_todo
public csa_add_memo
public _CSA_calendar_attribute_names
public _CSA_entry_attribute_names
public _CSA_entry_subtype_values
/********************************************************************
* Private symbols -- used by dtcm's server (rpc.cmsd)
********************************************************************/
private _CSA_cal_attr_info
private _DtCmAccessRightToV4AccessType
private _DtCmAttr4ToReminderValue
private _DtCmExtendNameTable
private _DtCmFreeHashedArrays
private _DtCmGetHostAtDomain
private _DtCmGetLocalDomain
private _DtCmGetLocalHost
private _DtCmGetPrefix
private _DtCmGrowAttrArray
private _DtCmHashCriteria
private _DtCmIsSamePath
private _DtCmIsSameUser
private _DtCmIsUserName
private _DtCmUpdateAccessListAttrVal
private _DtCmUpdateAttribute
private _DtCmUpdateAttributes
private _DtCmUpdateDateTimeListAttrVal
private _DtCmUpdateSint32AttrVal
private _DtCmUpdateStringAttrVal
private _DtCm_accargs2_to_accargs4
private _DtCm_accargs3_to_accargs4
private _DtCm_accargs4_to_accargs2
private _DtCm_accargs4_to_accargs3
private _DtCm_accessentry4_to_cmsaccesslist
private _DtCm_accstat4_to_accstat2
private _DtCm_accstat4_to_accstat3
private _DtCm_add_reminder
private _DtCm_appt4_to_attrs
private _DtCm_appt_to_abbrev4
private _DtCm_appt_to_semiprivate_abbrev4
private _DtCm_apptstatus4_to_status
private _DtCm_attrs_to_eventtype4
private _DtCm_cal_name_tbl
private _DtCm_check_cal_cms_attributes
private _DtCm_check_entry_cms_attributes
private _DtCm_check_operator
private _DtCm_classification_to_privacy4
private _DtCm_cms_entry_to_appt4
private _DtCm_copy_appt4
private _DtCm_copy_cms_attr_val
private _DtCm_copy_cms_attribute
private _DtCm_copy_cms_attributes
private _DtCm_copy_cms_entry
private _DtCm_copy_excpt4
private _DtCm_copy_one_appt4
private _DtCm_copy_semiprivate_appt4
private _DtCm_entry_name_tbl
private _DtCm_eventtype4_to_subtype
private _DtCm_eventtype4_to_type
private _DtCm_free_abbrev_appt4
private _DtCm_free_access_list4
private _DtCm_free_appt4
private _DtCm_free_cms_access_entry
private _DtCm_free_cms_attribute_value
private _DtCm_free_cms_attribute_values
private _DtCm_free_cms_attributes
private _DtCm_free_cms_entries
private _DtCm_free_cms_entry
private _DtCm_free_date_time_list
private _DtCm_free_excpt4
private _DtCm_free_keyentry4
private _DtCm_free_name_table
private _DtCm_free_re
private _DtCm_free_re_state
private _DtCm_free_reminder4
private _DtCm_get_attribute_types
private _DtCm_get_index_from_table
private _DtCm_init_hash
private _DtCm_interval4_to_rtype
private _DtCm_make_access_entry4
private _DtCm_make_appt4
private _DtCm_make_attr4
private _DtCm_make_cms_entry
private _DtCm_match_one_appt
private _DtCm_match_reminder_attribute
private _DtCm_match_sint32_attribute
private _DtCm_match_string_attribute
private _DtCm_match_time_attribute
private _DtCm_match_time_duration_attribute
private _DtCm_match_uint32_attribute
private _DtCm_old_reminder_name_to_index
private _DtCm_old_reminder_name_to_name
private _DtCm_privacy4_to_classification
private _DtCm_reg2_to_reg4
private _DtCm_reg3_to_reg4
private _DtCm_regstat4_to_regstat2
private _DtCm_regstat4_to_regstat3
private _DtCm_remove_reminder
private _DtCm_repeat_info
private _DtCm_rtype_to_interval4
private _DtCm_rule_buf
private _DtCm_rule_parser
private _DtCm_set_opaque_attrval
private _DtCm_set_reminder_attrval
private _DtCm_set_string_attrval
private _DtCm_set_uint32_attrval
private _DtCm_set_user_attrval
private _DtCm_status_to_apptstatus4
private _DtCm_tableargs2_to_tableargs4
private _DtCm_tableargs3_to_tableargs4
private _DtCm_tabledelargs2_to_tabledelargs4
private _DtCm_tabledelargs3_to_tabledelargs4
private _DtCm_tableres4_to_tableres2
private _DtCm_tableres4_to_tableres3
private _DtCm_tablestat4_to_tablestat2
private _DtCm_tablestat4_to_tablestat3
private _DtCm_xdr_Access_Args_2
private _DtCm_xdr_Access_Args_3
private _DtCm_xdr_Access_Args_4
private _DtCm_xdr_Access_Status_2
private _DtCm_xdr_Access_Status_3
private _DtCm_xdr_Access_Status_4
private _DtCm_xdr_Registration_2
private _DtCm_xdr_Registration_3
private _DtCm_xdr_Registration_4
private _DtCm_xdr_Registration_Status_2
private _DtCm_xdr_Registration_Status_3
private _DtCm_xdr_Registration_Status_4
private _DtCm_xdr_Table_Args_2
private _DtCm_xdr_Table_Args_3
private _DtCm_xdr_Table_Args_4
private _DtCm_xdr_Table_Op_Args_4
private _DtCm_xdr_Table_Res_2
private _DtCm_xdr_Table_Res_3
private _DtCm_xdr_Table_Res_4
private _DtCm_xdr_Table_Status_2
private _DtCm_xdr_Table_Status_3
private _DtCm_xdr_Table_Status_4
private xdr_cmcb_update_callback_args
private xdr_cms_archive_args
private xdr_cms_archive_res
private xdr_cms_create_args
private xdr_cms_delete_args
private xdr_cms_entries_res
private xdr_cms_entry_res
private xdr_cms_enumerate_args
private xdr_cms_enumerate_calendar_attr_res
private xdr_cms_get_cal_attr_args
private xdr_cms_get_cal_attr_res
private xdr_cms_get_entry_attr_args
private xdr_cms_get_entry_attr_res
private xdr_cms_insert_args
private xdr_cms_list_calendars_res
private xdr_cms_lookup_entries_args
private xdr_cms_name
private xdr_cms_open_args
private xdr_cms_open_res
private xdr_cms_register_args
private xdr_cms_reminder_args
private xdr_cms_reminder_res
private xdr_cms_remove_args
private xdr_cms_restore_args
private xdr_cms_set_cal_attr_args
private xdr_cms_update_args
/********************************************************************
* Private symbols -- Undocumented APIs that are exported for B.C.
* or because privileged applications may need used them.
********************************************************************/
private _csa_iso8601_to_tick
private _csa_tick_to_iso8601
private _csa_iso8601_to_range
private _csa_range_to_iso8601
private _csa_iso8601_to_duration
private _csa_duration_to_iso8601
private _DtCm_set_sint32_attrval
/********************************************************************
* Internal symbols -- not to be used outside the library.
********************************************************************/
#ifdef NEED_STRCASECMP
internal strcasecmp
internal strncasecmp
#endif
internal _CSA_entry_attr_info
internal _DtCmCmsentriesToLibentries
internal _DtCmDestroyHash
internal _DtCmFindHash
internal _DtCmGetHash
internal _DtCmGetUserName
internal _DtCmMakeHash
internal _DtCmUpdateOpaqueDataAttrVal
internal _DtCmUpdateReminderAttrVal
internal _DtCm_acclist4_to_acclist2
internal _DtCm_acclist4_to_acclist3
internal _DtCm_accstat2_to_accstat4
internal _DtCm_accstat3_to_accstat4
internal _DtCm_active_cal_list
internal _DtCm_add_name_to_table
internal _DtCm_add_registration
internal _DtCm_add_to_entry_list
internal _DtCm_alloc_attributes
internal _DtCm_alloc_calendar_users
internal _DtCm_alloc_character_pointers
internal _DtCm_alloc_entry
internal _DtCm_alloc_entry_handles
internal _DtCm_alloc_reminder_references
internal _DtCm_appt4_to_appt2
internal _DtCm_appt4_to_appt3
internal _DtCm_appt4_to_libentries
internal _DtCm_attrs_to_appt4
internal _DtCm_attrs_to_apptdata
internal _DtCm_check_cal_csa_attributes
internal _DtCm_check_entry_attributes
internal _DtCm_clnt_call
internal _DtCm_clntstat_to_csastat
internal _DtCm_cms2csa_access_list
internal _DtCm_cms2csa_attribute
internal _DtCm_cms2csa_attrval
internal _DtCm_cms2csa_reminder_ref
internal _DtCm_cmsattrs_to_apptdata
internal _DtCm_convert_entry_wheader
internal _DtCm_copy_cms_access_list
internal _DtCm_copy_date_time_list
internal _DtCm_copy_opaque_data
internal _DtCm_copy_reminder
internal _DtCm_copy_reminder4
internal _DtCm_count_entry_in_list
internal _DtCm_create_tcp_client
internal _DtCm_create_udp_client
internal _DtCm_csa2cms_access_list
internal _DtCm_csaaccesslist_toaccessentry4
internal _DtCm_deregister_callback_2
internal _DtCm_deregister_callback_3
internal _DtCm_deregister_callback_4
internal _DtCm_destroy_agent
internal _DtCm_do_registration
internal _DtCm_do_unregistration
internal _DtCm_free
internal _DtCm_free_Calendar
internal _DtCm_free_appt2
internal _DtCm_free_appt3
internal _DtCm_free_attr2
internal _DtCm_free_attr3
internal _DtCm_free_attr4
internal _DtCm_free_attribute_value
internal _DtCm_free_attribute_values
internal _DtCm_free_attributes
internal _DtCm_free_character_pointers
internal _DtCm_free_csa_access_list
internal _DtCm_free_entry_content
internal _DtCm_free_entry_handles
internal _DtCm_free_libentries
internal _DtCm_free_libentries_from_list
internal _DtCm_free_opaque_data
internal _DtCm_free_reminder
internal _DtCm_free_reminder_references
internal _DtCm_get_Calendar
internal _DtCm_get_all_cal_attrs
internal _DtCm_get_all_entry_attrs
internal _DtCm_get_cal_attrs_by_name
internal _DtCm_get_entry_attr_names
internal _DtCm_get_entry_attrs_by_name
internal _DtCm_get_entry_detail
internal _DtCm_get_libentry
internal _DtCm_get_old_attr_by_index
internal _DtCm_get_old_attr_by_name
internal _DtCm_get_server_rpc_version
internal _DtCm_id4_to_id2
internal _DtCm_id4_to_id3
internal _DtCm_init_agent
internal _DtCm_keyrange4_to_keyrange3
internal _DtCm_libentries_to_appt4
internal _DtCm_libentry_to_entryh
internal _DtCm_list_old_cal_attr_names
internal _DtCm_make_libentry
internal _DtCm_make_name_table
internal _DtCm_match_appts
internal _DtCm_match_reminders
internal _DtCm_new_Calendar
internal _DtCm_print_errmsg
internal _DtCm_print_tick
internal _DtCm_process_updates
internal _DtCm_range4_to_range2
internal _DtCm_range4_to_range3
internal _DtCm_register_callback_2
internal _DtCm_register_callback_3
internal _DtCm_register_callback_4
internal _DtCm_register_xtcallback
internal _DtCm_regstat2_to_regstat4
internal _DtCm_regstat3_to_regstat4
internal _DtCm_reminder4_to_csareminder
internal _DtCm_remove_from_entry_list
internal _DtCm_remove_registration
internal _DtCm_reset_cal_attrs
internal _DtCm_rpc_create_calendar
internal _DtCm_rpc_delete_calendar
internal _DtCm_rpc_delete_entry
internal _DtCm_rpc_enumerate_sequence
internal _DtCm_rpc_get_cal_attrs
internal _DtCm_rpc_insert_entry
internal _DtCm_rpc_list_calendar_attributes
internal _DtCm_rpc_list_calendars
internal _DtCm_rpc_lookup_entries
internal _DtCm_rpc_lookup_entry_by_id
internal _DtCm_rpc_lookup_reminder
internal _DtCm_rpc_open_calendar
internal _DtCm_rpc_register_client
internal _DtCm_rpc_set_cal_attrs
internal _DtCm_rpc_unregister_client
internal _DtCm_rpc_update_entry
internal _DtCm_rtable_abbreviated_lookup_key_range_3
internal _DtCm_rtable_abbreviated_lookup_key_range_4
internal _DtCm_rtable_abbreviated_lookup_range_2
internal _DtCm_rtable_abbreviated_lookup_range_3
internal _DtCm_rtable_abbreviated_lookup_range_4
internal _DtCm_rtable_change_2
internal _DtCm_rtable_change_3
internal _DtCm_rtable_change_4
internal _DtCm_rtable_change_instance_2
internal _DtCm_rtable_change_instance_3
internal _DtCm_rtable_change_instance_4
internal _DtCm_rtable_check_2
internal _DtCm_rtable_check_3
internal _DtCm_rtable_check_4
internal _DtCm_rtable_create_4
internal _DtCm_rtable_delete_2
internal _DtCm_rtable_delete_3
internal _DtCm_rtable_delete_4
internal _DtCm_rtable_delete_instance_2
internal _DtCm_rtable_delete_instance_3
internal _DtCm_rtable_delete_instance_4
internal _DtCm_rtable_flush_table_2
internal _DtCm_rtable_flush_table_3
internal _DtCm_rtable_flush_table_4
internal _DtCm_rtable_get_access_2
internal _DtCm_rtable_get_access_3
internal _DtCm_rtable_get_access_4
internal _DtCm_rtable_gmtoff_3
internal _DtCm_rtable_gmtoff_4
internal _DtCm_rtable_insert_2
internal _DtCm_rtable_insert_3
internal _DtCm_rtable_insert_4
internal _DtCm_rtable_lookup_2
internal _DtCm_rtable_lookup_3
internal _DtCm_rtable_lookup_4
internal _DtCm_rtable_lookup_next_larger_2
internal _DtCm_rtable_lookup_next_larger_3
internal _DtCm_rtable_lookup_next_larger_4
internal _DtCm_rtable_lookup_next_reminder_2
internal _DtCm_rtable_lookup_next_reminder_3
internal _DtCm_rtable_lookup_next_reminder_4
internal _DtCm_rtable_lookup_next_smaller_2
internal _DtCm_rtable_lookup_next_smaller_3
internal _DtCm_rtable_lookup_next_smaller_4
internal _DtCm_rtable_lookup_range_2
internal _DtCm_rtable_lookup_range_3
internal _DtCm_rtable_lookup_range_4
internal _DtCm_rtable_ping_2
internal _DtCm_rtable_ping_3
internal _DtCm_rtable_ping_4
internal _DtCm_rtable_remove_4
internal _DtCm_rtable_rename_4
internal _DtCm_rtable_set_access_2
internal _DtCm_rtable_set_access_3
internal _DtCm_rtable_set_access_4
internal _DtCm_rtable_size_2
internal _DtCm_rtable_size_3
internal _DtCm_rtable_size_4
internal _DtCm_scope_to_options4
internal _DtCm_set_csa_access_attrval
internal _DtCm_set_csa_string_attrval
internal _DtCm_set_csa_uint32_attrval
internal _DtCm_table_create
internal _DtCm_table_delete
internal _DtCm_table_get_access
internal _DtCm_table_insert
internal _DtCm_table_lookup
internal _DtCm_table_lookup_key_range
internal _DtCm_table_lookup_range
internal _DtCm_table_lookup_reminder
internal _DtCm_table_register_target
internal _DtCm_table_set_access
internal _DtCm_table_size
internal _DtCm_table_unregister_target
internal _DtCm_table_update
internal _DtCm_tableres2_to_tableres4
internal _DtCm_tableres3_to_tableres4
internal _DtCm_tablestat2_to_tablestat4
internal _DtCm_tablestat3_to_tablestat4
internal _DtCm_transient
internal _DtCm_uid4_to_uid2
internal _DtCm_uid4_to_uid3
internal _DtCm_uidopt4_to_uid2
internal _DtCm_uidopt4_to_uid3
internal _DtCm_update_callback_1
internal _DtCm_xdr_Abb_Appt_2
internal _DtCm_xdr_Abb_Appt_3
internal _DtCm_xdr_Abb_Appt_4
internal _DtCm_xdr_Access_Entry_2
internal _DtCm_xdr_Access_Entry_3
internal _DtCm_xdr_Access_Entry_4
internal _DtCm_xdr_Appt_2
internal _DtCm_xdr_Appt_3
internal _DtCm_xdr_Appt_4
internal _DtCm_xdr_Appt_Status_3
internal _DtCm_xdr_Appt_Status_4
internal _DtCm_xdr_Apptid_2
internal _DtCm_xdr_Apptid_3
internal _DtCm_xdr_Apptid_4
internal _DtCm_xdr_Args_2
internal _DtCm_xdr_Args_3
internal _DtCm_xdr_Args_4
internal _DtCm_xdr_Attr_2
internal _DtCm_xdr_Attr_3
internal _DtCm_xdr_Attr_4
internal _DtCm_xdr_Attribute_2
internal _DtCm_xdr_Attribute_3
internal _DtCm_xdr_Attribute_4
internal _DtCm_xdr_Buffer_2
internal _DtCm_xdr_Buffer_3
internal _DtCm_xdr_Buffer_4
internal _DtCm_xdr_Event_Type_3
internal _DtCm_xdr_Event_Type_4
internal _DtCm_xdr_Except_2
internal _DtCm_xdr_Except_3
internal _DtCm_xdr_Except_4
internal _DtCm_xdr_Exception_2
internal _DtCm_xdr_Exception_3
internal _DtCm_xdr_Exception_4
internal _DtCm_xdr_Id_2
internal _DtCm_xdr_Id_3
internal _DtCm_xdr_Id_4
internal _DtCm_xdr_Interval_3
internal _DtCm_xdr_Interval_4
internal _DtCm_xdr_Keyrange_3
internal _DtCm_xdr_Keyrange_4
internal _DtCm_xdr_Options_4
internal _DtCm_xdr_Period_2
internal _DtCm_xdr_Period_3
internal _DtCm_xdr_Period_4
internal _DtCm_xdr_Privacy_Level_3
internal _DtCm_xdr_Privacy_Level_4
internal _DtCm_xdr_Range_2
internal _DtCm_xdr_Range_3
internal _DtCm_xdr_Range_4
internal _DtCm_xdr_Reminder_2
internal _DtCm_xdr_Reminder_3
internal _DtCm_xdr_Reminder_4
internal _DtCm_xdr_Table_Args_Type_2
internal _DtCm_xdr_Table_Args_Type_3
internal _DtCm_xdr_Table_Args_Type_4
internal _DtCm_xdr_Table_Res_List_2
internal _DtCm_xdr_Table_Res_List_3
internal _DtCm_xdr_Table_Res_List_4
internal _DtCm_xdr_Table_Res_Type_2
internal _DtCm_xdr_Table_Res_Type_3
internal _DtCm_xdr_Table_Res_Type_4
internal _DtCm_xdr_Tag_2
internal _DtCm_xdr_Tag_3
internal _DtCm_xdr_Tag_4
internal _DtCm_xdr_Transaction_2
internal _DtCm_xdr_Transaction_3
internal _DtCm_xdr_Uid_2
internal _DtCm_xdr_Uid_3
internal _DtCm_xdr_Uid_4
internal _DtCm_xdr_Uidopt_4
internal _DtCm_xdr_Update_Status
internal _DtCm_yydebug
internal _DtCm_yyerror
internal _DtCm_yylex
internal _DtCm_yylval
internal _DtCm_yynerrs
internal _DtCm_yytext
#if defined(__hpux)
internal _DtCm_yymaxdepth
#endif
#if defined(sun)
internal _DtCm_yy__DtCm_yys
internal _DtCm_yy__DtCm_yyv
internal _DtCm_yyact
internal _DtCm_yychar
internal _DtCm_yychk
internal _DtCm_yydef
internal _DtCm_yyerrflag
internal _DtCm_yyexca
internal _DtCm_yypact
internal _DtCm_yypgo
internal _DtCm_yyps
internal _DtCm_yypv
internal _DtCm_yyr1
internal _DtCm_yyr2
internal _DtCm_yys
internal _DtCm_yystate
internal _DtCm_yytmp
internal _DtCm_yyv
internal _DtCm_yyval
#endif
internal cmcb_update_callback_2_svc
internal cms_archive_5
internal cms_create_calendar_5
internal cms_delete_entry_5
internal cms_enumerate_calendar_attr_5
internal cms_enumerate_sequence_5
internal cms_get_calendar_attr_5
internal cms_get_entry_attr_5
internal cms_insert_entry_5
internal cms_list_calendars_5
internal cms_lookup_entries_5
internal cms_lookup_reminder_5
internal cms_open_calendar_5
internal cms_ping_5
internal cms_register_5
internal cms_remove_calendar_5
internal cms_restore_5
internal cms_set_calendar_attr_5
internal cms_unregister_5
internal cms_update_entry_5
internal xdr_CSA_date_time_entry
internal xdr_CSA_opaque_data
internal xdr_CSA_reminder
internal xdr_cmcb_add_entry_data
internal xdr_cmcb_cal_attr_data
internal xdr_cmcb_delete_entry_data
internal xdr_cmcb_update_data
internal xdr_cmcb_update_entry_data
internal xdr_cms_access_entry
internal xdr_cms_attr_name
internal xdr_cms_attribute
internal xdr_cms_attribute_value
internal xdr_cms_entry
internal xdr_cms_get_entry_attr_res_item
internal xdr_cms_key
internal xdr_cms_reminder_ref
internal xdr_time_t

161
cde/lib/csa/lutil.c Normal file
View File

@@ -0,0 +1,161 @@
/* $XConsortium: lutil.c /main/4 1996/11/21 20:00:35 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#include <EUSCompat.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <rpc/rpc.h>
#include <unistd.h>
#if defined(sun) || defined(USL) || defined(__uxp__)
#include <netdb.h>
#include <sys/systeminfo.h>
#endif
#define X_INCLUDE_PWD_H
#define XOS_USE_XT_LOCKING
#include <X11/Xos_r.h>
extern char * strdup(const char *);
extern char *
_DtCmGetPrefix(char *str, char sep)
{
char buf[BUFSIZ];
char *ptr;
if (str == NULL)
return(NULL);
ptr = buf;
while (*str && *str != sep)
*ptr++ = *str++;
if (ptr == buf)
return(NULL);
else {
*ptr = NULL;
return(strdup(buf));
}
}
extern char *
_DtCmGetLocalHost()
{
static char *host = NULL;
if (host == NULL) {
host = (char *)malloc(MAXHOSTNAMELEN+1);
#if defined(sun) || defined(USL) || defined(__uxp__)
(void)sysinfo(SI_HOSTNAME, host, MAXHOSTNAMELEN);
#else
(void)gethostname(host, MAXHOSTNAMELEN);
#endif /* sun || USL || __uxp__ */
}
return (host);
}
extern char *
_DtCmGetLocalDomain(char *hostname)
{
static char *domain = NULL;
char buf[BUFSIZ], *ptr;
CLIENT *cl;
if (domain == NULL) {
domain = (char *)malloc(BUFSIZ);
#if defined(sun) || defined(USL) || defined(__uxp__)
sysinfo(SI_SRPC_DOMAIN, domain, BUFSIZ - 1);
#else
getdomainname(domain, BUFSIZ - 1);
#endif /* sun || USL || __uxp__ */
/* check domain name */
/* this is a hack to find out the domain name that
* is acceptable to the rpc interface, e.g.
* DGDO.Eng.Sun.COM is returned by sysinfo but
* this name is not acceptable to the rpc interface
* hence we need to stripe out the first component
*/
ptr = domain;
if (hostname == NULL) hostname = _DtCmGetLocalHost();
while (1) {
sprintf(buf, "%s.%s", hostname, ptr);
if ((cl = clnt_create(buf, 100068, 5, "udp")) == NULL) {
ptr = strchr(ptr, '.');
if (ptr)
ptr++;
else
break;
} else {
clnt_destroy(cl);
break;
}
}
if (ptr && ptr != domain)
domain = ptr;
}
return (domain);
}
extern char *
_DtCmGetHostAtDomain()
{
static char *hostname = NULL;
char *host;
if (hostname == NULL) {
hostname = malloc(BUFSIZ);
host = _DtCmGetLocalHost();
if (strchr(host, '.') == NULL)
sprintf(hostname, "%s.%s", host,
_DtCmGetLocalDomain(host));
else
strcpy(hostname, host);
}
return (hostname);
}
extern char *
_DtCmGetUserName()
{
static char *name = NULL;
_Xgetpwparams pwd_buf;
struct passwd * pwd_ret;
if (name == NULL) {
name = malloc(BUFSIZ);
if ((pwd_ret = _XGetpwuid(geteuid(), pwd_buf)) == NULL)
strcpy(name, "nobody");
else
strcpy(name, pwd_ret->pw_name);
}
return name;
}
/*
* this routine checks whether the given name is a valid user name
*/
extern boolean_t
_DtCmIsUserName(char *user)
{
_Xgetpwparams pwd_buf;
struct passwd * pwd_ret;
pwd_ret = _XGetpwnam(user, pwd_buf);
if (pwd_ret == NULL)
return (B_FALSE);
else
return (B_TRUE);
}

26
cde/lib/csa/lutil.h Normal file
View File

@@ -0,0 +1,26 @@
/* $XConsortium: lutil.h /main/1 1996/04/21 19:23:45 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#ifndef _LUTIL_H
#define _LUTIL_H
#include "ansi_c.h"
extern char *_DtCmGetPrefix P((char *str, char sep));
extern char *_DtCmGetLocalHost P(());
extern char *_DtCmGetLocalDomain P((char *hostname));
extern char *_DtCmGetHostAtDomain P(());
extern char *_DtCmGetUserName P(());
extern boolean_t _DtCmIsUserName P((char *user));
#endif

1153
cde/lib/csa/match.c Normal file

File diff suppressed because it is too large Load Diff

97
cde/lib/csa/match.h Normal file
View File

@@ -0,0 +1,97 @@
/* $XConsortium: match.h /main/1 1996/04/21 19:23:51 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#ifndef _MATCH_H
#define _MATCH_H
#include <EUSCompat.h>
#include "ansi_c.h"
#include "cm.h"
#include "rtable4.h"
extern CSA_return_code _DtCmHashCriteria P((
_DtCmNameTable *tbl,
CSA_uint32 num_attrs,
CSA_attribute *csaattrs,
cms_attribute *cmsattrs,
CSA_enum *ops,
boolean_t *no_match,
boolean_t *no_start_time_range,
boolean_t *no_end_time_range,
time_t *start1,
time_t *start2,
time_t *end1,
time_t *end2,
long *id,
CSA_uint32 *hnum,
cms_attribute **hattrs,
CSA_enum **hops));
extern void _DtCmFreeHashedArrays P((
CSA_uint32 hnum,
cms_attribute *hattrs,
CSA_enum *hops));
extern Appt_4 *_DtCm_match_appts P((
Appt_4 *appts,
long id,
boolean_t no_end_time_range,
time_t end1,
time_t end2,
CSA_uint32 num_attrs,
cms_attribute *attrs,
CSA_enum *ops));
extern boolean_t _DtCm_match_one_appt(
Appt_4 *appt,
uint num_attrs,
cms_attribute * attrs,
CSA_enum *ops);
extern Reminder_4 *_DtCm_match_reminders P((
Reminder_4 *rems,
uint num_names,
char **names));
extern CSA_return_code _DtCm_check_operator P((
uint size,
CSA_attribute *csaattrs,
cms_attribute *cmsattrs,
CSA_enum *ops));
extern boolean_t _DtCm_match_sint32_attribute P((
cms_attribute_value *val1,
cms_attribute_value *val2,
CSA_enum op));
extern boolean_t _DtCm_match_uint32_attribute P((
cms_attribute_value *val1,
cms_attribute_value *val2,
CSA_enum op));
extern boolean_t _DtCm_match_time_attribute P((
cms_attribute_value *val1,
cms_attribute_value *val2,
CSA_enum op));
extern boolean_t _DtCm_match_time_duration_attribute P((
cms_attribute_value *val1,
cms_attribute_value *val2,
CSA_enum op));
extern boolean_t _DtCm_match_string_attribute P((
cms_attribute_value *val1,
cms_attribute_value *val2,
CSA_enum op));
extern boolean_t _DtCm_match_reminder_attribute P((
cms_attribute_value *val1,
cms_attribute_value *val2,
CSA_enum op));
#endif

32
cde/lib/csa/misc.h Normal file
View File

@@ -0,0 +1,32 @@
/* $XConsortium: misc.h /main/1 1996/04/21 19:23:54 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#ifndef _MISC_H
#define _MISC_H
/*
* This file contains some miscellaneous defines.
*/
#define _DtCM_FIRST_EXTENSIBLE_SERVER_VERSION 5
#define _DtCM_FIRST_EXTENSIBLE_DATA_VERSION 4
#define _DtCM_SPEC_VERSION_SUPPORTED \
"-//XAPIA/CSA/VERSION1/NONSGML CSA Version 1//EN"
#define _DtCM_PRODUCT_IDENTIFIER \
"-//DT//NONSGML Calendar Product Version 1//EN"
/*
* Time related definitions
*/
#define _DtCM_BOT 0
#define _DtCM_EOT 2147483647 /* 2^31-1 */
#endif

102
cde/lib/csa/namechange1.sed Normal file
View File

@@ -0,0 +1,102 @@
#
# namechange1.sed
#
# static char sccsid[] = "@(#)namechange1.sed 1.2 94/08/04 Copyr 1991 Sun Microsystems, Inc.";
#
# $XConsortium: namechange1.sed /main/1 1996/04/21 19:23:57 drk $
#
# RESTRICTED CONFIDENTIAL INFORMATION:
#
# The information in this document is subject to special
# restrictions in a confidential disclosure agreement between
# HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
# document outside HP, IBM, Sun, USL, SCO, or Univel without
# Sun's specific written approval. This document and all copies
# and derivative works thereof must be returned or destroyed at
# Sun's request.
#
# Copyright 1993 Sun Microsystems, Inc. All rights reserved.
#
# This file contains the sed script statement to convert rpcgen
# generated symbols to conform to the CDE naming convention
#
s/clnt_call/_DtCm_clnt_call/g
s/CLIENT \*/_DtCm_Connection \*/g
# script to do name changes for files generated by rpcgen from agent.x
s/update_callback_1/_DtCm_update_callback_1/g
s/xdr_Update_Status/_DtCm_xdr_Update_Status/g
#
# script to do name changes for files generated by rpcgen from rtable2.x
s/rtable_ping_2/_DtCm_rtable_ping_2/g
s/rtable_lookup_2/_DtCm_rtable_lookup_2/g
s/rtable_lookup_next_larger_2/_DtCm_rtable_lookup_next_larger_2/g
s/rtable_lookup_next_smaller_2/_DtCm_rtable_lookup_next_smaller_2/g
s/rtable_lookup_range_2/_DtCm_rtable_lookup_range_2/g
s/rtable_abbreviated_lookup_range_2/_DtCm_rtable_abbreviated_lookup_range_2/g
s/rtable_insert_2/_DtCm_rtable_insert_2/g
s/rtable_delete_2/_DtCm_rtable_delete_2/g
s/rtable_delete_instance_2/_DtCm_rtable_delete_instance_2/g
s/rtable_change_2/_DtCm_rtable_change_2/g
s/rtable_change_instance_2/_DtCm_rtable_change_instance_2/g
s/rtable_lookup_next_reminder_2/_DtCm_rtable_lookup_next_reminder_2/g
s/rtable_check_2/_DtCm_rtable_check_2/g
s/rtable_flush_table_2/_DtCm_rtable_flush_table_2/g
s/rtable_size_2/_DtCm_rtable_size_2/g
s/deregister_callback_2/_DtCm_deregister_callback_2/g
s/register_callback_2/_DtCm_register_callback_2/g
s/_de_DtCm_register_callback_2/_deregister_callback_2/g
s/rtable_set_access_2/_DtCm_rtable_set_access_2/g
s/rtable_get_access_2/_DtCm_rtable_get_access_2/g
s/xdr_Buffer_2/_DtCm_xdr_Buffer_2/g
s/xdr_Transaction_2/_DtCm_xdr_Transaction_2/g
s/xdr_Uid_2/_DtCm_xdr_Uid_2/g
s/xdr_Tag_2/_DtCm_xdr_Tag_2/g
s/xdr_Table_Status_2/_DtCm_xdr_Table_Status_2/g
s/xdr_Table_Res_Type_2/_DtCm_xdr_Table_Res_Type_2/g
s/xdr_Table_Res_List_2/_DtCm_xdr_Table_Res_List_2/g
s/xdr_Table_Res_2/_DtCm_xdr_Table_Res_2/g
s/xdr_Table_Args_Type_2/_DtCm_xdr_Table_Args_Type_2/g
s/xdr_Table_Args_2/_DtCm_xdr_Table_Args_2/g
s/xdr_Reminder_2/_DtCm_xdr_Reminder_2/g
s/xdr_Registration_Status_2/_DtCm_xdr_Registration_Status_2/g
s/xdr_Registration_2/_DtCm_xdr_Registration_2/g
s/xdr_Range_2/_DtCm_xdr_Range_2/g
s/xdr_Period_2/_DtCm_xdr_Period_2/g
s/xdr_Id_2/_DtCm_xdr_Id_2/g
s/xdr_Exception_2/_DtCm_xdr_Exception_2/g
s/xdr_Except_2/_DtCm_xdr_Except_2/g
s/xdr_Attribute_2/_DtCm_xdr_Attribute_2/g
s/xdr_Attr_2/_DtCm_xdr_Attr_2/g
s/xdr_Args_2/_DtCm_xdr_Args_2/g
s/xdr_Apptid_2/_DtCm_xdr_Apptid_2/g
s/xdr_Appt_2/_DtCm_xdr_Appt_2/g
s/xdr_Access_Status_2/_DtCm_xdr_Access_Status_2/g
s/xdr_Access_Entry_2/_DtCm_xdr_Access_Entry_2/g
s/xdr_Access_Args_2/_DtCm_xdr_Access_Args_2/g
s/xdr_Abb_Appt_2/_DtCm_xdr_Abb_Appt_2/g
#
# script to do name changes for files generated by rpcgen from rtable3.x
s/deregister_callback_3/_DtCm_deregister_callback_3/g
s/register_callback_3/_DtCm_register_callback_3/g
s/_de_DtCm_register_callback_3/_deregister_callback_3/g
s/rtable_size_3/_DtCm_rtable_size_3/g
s/rtable_set_access_3/_DtCm_rtable_set_access_3/g
s/rtable_ping_3/_DtCm_rtable_ping_3/g
s/rtable_lookup_range_3/_DtCm_rtable_lookup_range_3/g
s/rtable_lookup_next_smaller_3/_DtCm_rtable_lookup_next_smaller_3/g
s/rtable_lookup_next_reminder_3/_DtCm_rtable_lookup_next_reminder_3/g
s/rtable_lookup_next_larger_3/_DtCm_rtable_lookup_next_larger_3/g
s/rtable_lookup_3/_DtCm_rtable_lookup_3/g
s/rtable_insert_3/_DtCm_rtable_insert_3/g
s/rtable_gmtoff_3/_DtCm_rtable_gmtoff_3/g
s/rtable_get_access_3/_DtCm_rtable_get_access_3/g
s/rtable_flush_table_3/_DtCm_rtable_flush_table_3/g
s/rtable_delete_instance_3/_DtCm_rtable_delete_instance_3/g
s/rtable_delete_3/_DtCm_rtable_delete_3/g
s/rtable_check_3/_DtCm_rtable_check_3/g
s/rtable_change_instance_3/_DtCm_rtable_change_instance_3/g
s/rtable_change_3/_DtCm_rtable_change_3/g
s/rtable_abbreviated_lookup_range_3/_DtCm_rtable_abbreviated_lookup_range_3/g
s/rtable_abbreviated_lookup_key_range_3/_DtCm_rtable_abbreviated_lookup_key_range_3/g
s/xdr_Uid_3/_DtCm_xdr_Uid_3/g
s/xdr_Transaction_3/_DtCm_xdr_Transaction_3/g

116
cde/lib/csa/namechange2.sed Normal file
View File

@@ -0,0 +1,116 @@
#
# namechange2.sed
#
# static char sccsid[] = "@(#)namechange2.sed 1.2 94/08/04 Copyr 1991 Sun Microsystems, Inc.";
#
# $XConsortium: namechange2.sed /main/1 1996/04/21 19:23:59 drk $
#
# RESTRICTED CONFIDENTIAL INFORMATION:
#
# The information in this document is subject to special
# restrictions in a confidential disclosure agreement between
# HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
# document outside HP, IBM, Sun, USL, SCO, or Univel without
# Sun's specific written approval. This document and all copies
# and derivative works thereof must be returned or destroyed at
# Sun's request.
#
# Copyright 1993 Sun Microsystems, Inc. All rights reserved.
#
# This file contains the sed script statement to convert rpcgen
# generated symbols to conform to the CDE naming convention
#
s/xdr_Tag_3/_DtCm_xdr_Tag_3/g
s/xdr_Table_Status_3/_DtCm_xdr_Table_Status_3/g
s/xdr_Table_Res_Type_3/_DtCm_xdr_Table_Res_Type_3/g
s/xdr_Table_Res_List_3/_DtCm_xdr_Table_Res_List_3/g
s/xdr_Table_Res_3/_DtCm_xdr_Table_Res_3/g
s/xdr_Table_Args_Type_3/_DtCm_xdr_Table_Args_Type_3/g
s/xdr_Table_Args_3/_DtCm_xdr_Table_Args_3/g
s/xdr_Reminder_3/_DtCm_xdr_Reminder_3/g
s/xdr_Registration_Status_3/_DtCm_xdr_Registration_Status_3/g
s/xdr_Registration_3/_DtCm_xdr_Registration_3/g
s/xdr_Range_3/_DtCm_xdr_Range_3/g
s/xdr_Privacy_Level_3/_DtCm_xdr_Privacy_Level_3/g
s/xdr_Period_3/_DtCm_xdr_Period_3/g
s/xdr_Keyrange_3/_DtCm_xdr_Keyrange_3/g
s/xdr_Interval_3/_DtCm_xdr_Interval_3/g
s/xdr_Id_3/_DtCm_xdr_Id_3/g
s/xdr_Exception_3/_DtCm_xdr_Exception_3/g
s/xdr_Except_3/_DtCm_xdr_Except_3/g
s/xdr_Event_Type_3/_DtCm_xdr_Event_Type_3/g
s/xdr_Buffer_3/_DtCm_xdr_Buffer_3/g
s/xdr_Attribute_3/_DtCm_xdr_Attribute_3/g
s/xdr_Attr_3/_DtCm_xdr_Attr_3/g
s/xdr_Args_3/_DtCm_xdr_Args_3/g
s/xdr_Apptid_3/_DtCm_xdr_Apptid_3/g
s/xdr_Appt_Status_3/_DtCm_xdr_Appt_Status_3/g
s/xdr_Appt_3/_DtCm_xdr_Appt_3/g
s/xdr_Access_Status_3/_DtCm_xdr_Access_Status_3/g
s/xdr_Access_Entry_3/_DtCm_xdr_Access_Entry_3/g
s/xdr_Access_Args_3/_DtCm_xdr_Access_Args_3/g
s/xdr_Abb_Appt_3/_DtCm_xdr_Abb_Appt_3/g
#
# script to do name changes for files generated by rpcgen from rtable4.x
s/xdr_Uidopt_4/_DtCm_xdr_Uidopt_4/g
s/xdr_Uid_4/_DtCm_xdr_Uid_4/g
s/xdr_Tag_4/_DtCm_xdr_Tag_4/g
s/xdr_Table_Status_4/_DtCm_xdr_Table_Status_4/g
s/xdr_Table_Res_Type_4/_DtCm_xdr_Table_Res_Type_4/g
s/xdr_Table_Res_List_4/_DtCm_xdr_Table_Res_List_4/g
s/xdr_Table_Res_4/_DtCm_xdr_Table_Res_4/g
s/xdr_Table_Op_Args_4/_DtCm_xdr_Table_Op_Args_4/g
s/xdr_Table_Args_Type_4/_DtCm_xdr_Table_Args_Type_4/g
s/xdr_Table_Args_4/_DtCm_xdr_Table_Args_4/g
s/xdr_Reminder_4/_DtCm_xdr_Reminder_4/g
s/xdr_Registration_Status_4/_DtCm_xdr_Registration_Status_4/g
s/xdr_Registration_4/_DtCm_xdr_Registration_4/g
s/xdr_Range_4/_DtCm_xdr_Range_4/g
s/xdr_Privacy_Level_4/_DtCm_xdr_Privacy_Level_4/g
s/xdr_Period_4/_DtCm_xdr_Period_4/g
s/xdr_Options_4/_DtCm_xdr_Options_4/g
s/xdr_Keyrange_4/_DtCm_xdr_Keyrange_4/g
s/xdr_Interval_4/_DtCm_xdr_Interval_4/g
s/xdr_Id_4/_DtCm_xdr_Id_4/g
s/xdr_Exception_4/_DtCm_xdr_Exception_4/g
s/xdr_Except_4/_DtCm_xdr_Except_4/g
s/xdr_Event_Type_4/_DtCm_xdr_Event_Type_4/g
s/xdr_Buffer_4/_DtCm_xdr_Buffer_4/g
s/xdr_Attribute_4/_DtCm_xdr_Attribute_4/g
s/xdr_Attr_4/_DtCm_xdr_Attr_4/g
s/xdr_Args_4/_DtCm_xdr_Args_4/g
s/xdr_Apptid_4/_DtCm_xdr_Apptid_4/g
s/xdr_Appt_Status_4/_DtCm_xdr_Appt_Status_4/g
s/xdr_Appt_4/_DtCm_xdr_Appt_4/g
s/xdr_Access_Status_4/_DtCm_xdr_Access_Status_4/g
s/xdr_Access_Entry_4/_DtCm_xdr_Access_Entry_4/g
s/xdr_Access_Args_4/_DtCm_xdr_Access_Args_4/g
s/xdr_Abb_Appt_4/_DtCm_xdr_Abb_Appt_4/g
s/rtable_ping_4/_DtCm_rtable_ping_4/g
s/rtable_lookup_4/_DtCm_rtable_lookup_4/g
s/rtable_lookup_next_larger_4/_DtCm_rtable_lookup_next_larger_4/g
s/rtable_lookup_next_smaller_4/_DtCm_rtable_lookup_next_smaller_4/g
s/rtable_lookup_range_4/_DtCm_rtable_lookup_range_4/g
s/rtable_abbreviated_lookup_range_4/_DtCm_rtable_abbreviated_lookup_range_4/g
s/rtable_insert_4/_DtCm_rtable_insert_4/g
s/rtable_delete_4/_DtCm_rtable_delete_4/g
s/rtable_delete_instance_4/_DtCm_rtable_delete_instance_4/g
s/rtable_change_4/_DtCm_rtable_change_4/g
s/rtable_change_instance_4/_DtCm_rtable_change_instance_4/g
s/rtable_lookup_next_reminder_4/_DtCm_rtable_lookup_next_reminder_4/g
s/rtable_check_4/_DtCm_rtable_check_4/g
s/rtable_flush_table_4/_DtCm_rtable_flush_table_4/g
s/rtable_size_4/_DtCm_rtable_size_4/g
s/deregister_callback_4/_DtCm_deregister_callback_4/g
s/register_callback_4/_DtCm_register_callback_4/g
s/_de_DtCm_register_callback_4/_deregister_callback_4/g
s/rtable_set_access_4/_DtCm_rtable_set_access_4/g
s/rtable_get_access_4/_DtCm_rtable_get_access_4/g
s/rtable_abbreviated_lookup_key_range_4/_DtCm_rtable_abbreviated_lookup_key_range_4/g
s/rtable_gmtoff_4/_DtCm_rtable_gmtoff_4/g
s/rtable_create_4/_DtCm_rtable_create_4/g
s/rtable_remove_4/_DtCm_rtable_remove_4/g
s/rtable_rename_4/_DtCm_rtable_rename_4/g
#cm.x
s/xdr_CSA_return_code/xdr_u_int/g
s/xdr_CSA_enum/xdr_int/g

177
cde/lib/csa/nametbl.c Normal file
View File

@@ -0,0 +1,177 @@
/* $XConsortium: nametbl.c /main/1 1996/04/21 19:24:03 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#include <EUSCompat.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "nametbl.h"
#include "hash.h"
#define MAX_CAL_TBL_SIZE 23
#define MAX_ENTRY_TBL_SIZE 37
extern _DtCmNameTable *
_DtCm_make_name_table(int size, char **names)
{
_DtCmNameTable *tbl;
int i;
if ((tbl = (_DtCmNameTable *)calloc(1, sizeof(_DtCmNameTable))) == NULL)
return (NULL);
if ((tbl->tbl = _DtCmMakeHash(MAX_CAL_TBL_SIZE)) == NULL) {
free(tbl);
return (NULL);
}
if ((tbl->names = (char **)malloc(sizeof(char *) * (size+1))) == NULL) {
_DtCm_free_name_table(tbl);
return (NULL);
}
for (i = 1; i <= size; i++) {
if ((tbl->names[i] = strdup(names[i])) == NULL) {
tbl->size = i;
_DtCm_free_name_table(tbl);
return (NULL);
}
*(int *)_DtCmGetHash(tbl->tbl, (unsigned char *)names[i]) = i;
}
tbl->size = i - 1;
return (tbl);
}
extern void
_DtCm_free_name_table(_DtCmNameTable *tbl)
{
int i;
if (tbl == NULL) return;
if (tbl->tbl)
_DtCmDestroyHash(tbl->tbl, NULL, NULL);
for (i = 1; i <= tbl->size; i++)
free(tbl->names[i]);
if (tbl->names)
free(tbl->names);
free(tbl);
}
/*
* if index == 0, then add one more element to the table
* otherwise use the index to add the new name and extend the
* table by (index - size)
*/
extern CSA_return_code
_DtCm_add_name_to_table(_DtCmNameTable *tbl, int index, char *newname)
{
int *ptr;
char **newptr;
if (index > 0 && index <= tbl->size && tbl->names[index])
return (CSA_E_INVALID_PARAMETER);
if (index == 0)
index = tbl->size + 1;
/* add new name to table */
ptr = (int *)_DtCmGetHash(tbl->tbl, (unsigned char *)newname);
if (ptr)
*ptr = index;
if (index > tbl->size) {
if ((newptr = (char **)realloc(tbl->names,
sizeof(char *)*(index + 1))) == NULL) {
*ptr = -1;
return (CSA_E_INSUFFICIENT_MEMORY);
} else {
tbl->names = newptr;
memset((void *)&tbl->names[tbl->size+1], NULL,
sizeof(char *)*(index - tbl->size));
}
}
if ((tbl->names[index] = strdup(newname)) == NULL) {
*ptr = -1;
return (CSA_E_INSUFFICIENT_MEMORY);
} else {
if (index > tbl->size)
tbl->size = index;
}
return (CSA_SUCCESS);
}
extern int
_DtCm_get_index_from_table(_DtCmNameTable *tbl, char *name)
{
int *ptr;
ptr = (int *)_DtCmFindHash(tbl->tbl, (unsigned char *)name);
if (ptr)
return (*ptr);
else
return (-1);
}
/*
* if index == 0, then add one more element to the table
* other use the index to add the new name and extend the
* table by (index - size)
*/
extern CSA_return_code
_DtCmExtendNameTable(
char *name,
int index,
int type,
_DtCmNameTable *base,
int basesize,
char **basenames,
_DtCmNameTable **tbl,
int **types)
{
_DtCmNameTable *ntbl;
int *newarray;
int newindex;
if (index > 0 && index <= (*tbl)->size)
return (CSA_E_INVALID_PARAMETER);
if (*tbl == base) {
if ((ntbl = _DtCm_make_name_table(basesize, basenames)) == NULL)
{
return (CSA_E_INSUFFICIENT_MEMORY);
} else
*tbl = ntbl;
}
if (types) {
newindex = (index == 0) ? (*tbl)->size+1 : index;
if ((newarray = (int *)realloc(*types,
sizeof(int) * (newindex+1))) == NULL) {
return (CSA_E_INSUFFICIENT_MEMORY);
} else {
*types = newarray;
(*types)[newindex] = type;
}
}
return (_DtCm_add_name_to_table(*tbl, index, name));
}

59
cde/lib/csa/nametbl.h Normal file
View File

@@ -0,0 +1,59 @@
/* $XConsortium: nametbl.h /main/1 1996/04/21 19:24:05 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#ifndef _NAMETBL_H
#define _NAMETBL_H
/*
* Contain the definition for a hashed name table for attribute names.
* It is intended to be used by both the library and the daemon to
* build name tables for calendar attribute names and entry attribute
* names.
*/
#include "ansi_c.h"
#include "csa.h"
/*
* NOTE: The first element in names is not used. So a name table
* with a size of 5 actually contains names in element 1 to 5
* of names.
*/
typedef struct {
void *tbl;
int size;
char **names;
} _DtCmNameTable;
extern _DtCmNameTable *_DtCm_make_name_table P((
int size,
char **names));
extern void _DtCm_free_name_table P((_DtCmNameTable *tbl));
extern CSA_return_code _DtCm_add_name_to_table P((
_DtCmNameTable *tbl,
int index,
char *newname));
extern int _DtCm_get_index_from_table P((
_DtCmNameTable *tbl,
char *name));
extern CSA_return_code _DtCmExtendNameTable P((
char *name,
int index,
int type,
_DtCmNameTable *base,
int basesize,
char **basenames,
_DtCmNameTable **tbl,
int **types));
#endif /* _NAMETBL_H */

96
cde/lib/csa/refree.c Normal file
View File

@@ -0,0 +1,96 @@
/* $XConsortium: refree.c /main/1 1996/04/21 19:24:08 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#include <time.h>
#include <stdlib.h>
#include "rerule.h"
#define RE_DAILY(re) (re->re_data.re_daily)
#define RE_WEEKLY(re) (re->re_data.re_weekly)
#define RE_MONTHLY(re) (re->re_data.re_monthly)
#define RE_YEARLY(re) (re->re_data.re_yearly)
/*
* Deallocate a RepeatEvent structure.
*/
void
_DtCm_free_re(
RepeatEvent *re)
{
int i;
if (!re) return;
switch (re->re_type) {
case RT_MINUTE:
break;
case RT_DAILY:
if (RE_DAILY(re)->dd_ntime)
free(RE_DAILY(re)->dd_time);
if (RE_DAILY(re))
free (RE_DAILY(re));
break;
case RT_WEEKLY:
if (RE_WEEKLY(re)->wd_ndaytime) {
for (i = 0; i < RE_WEEKLY(re)->wd_ndaytime; i++) {
if (RE_WEEKLY(re)->wd_daytime[i].dt_ntime)
free(
RE_WEEKLY(re)->wd_daytime[i].dt_time);
}
free(RE_WEEKLY(re)->wd_daytime);
}
if (RE_WEEKLY(re))
free (RE_WEEKLY(re));
break;
case RT_MONTHLY_POSITION:
if (RE_MONTHLY(re)->md_nitems) {
for (i = 0; i < RE_MONTHLY(re)->md_nitems; i++) {
if (RE_MONTHLY(re)->md_weektime[i].wdt_nday)
free(RE_MONTHLY(re)->
md_weektime[i].wdt_day);
if (RE_MONTHLY(re)->md_weektime[i].wdt_ntime)
free(RE_MONTHLY(re)->
md_weektime[i].wdt_time);
if (RE_MONTHLY(re)->md_weektime[i].wdt_nweek)
free(RE_MONTHLY(re)->
md_weektime[i].wdt_week);
}
free(RE_MONTHLY(re)->md_weektime);
}
if (RE_MONTHLY(re))
free (RE_MONTHLY(re));
break;
case RT_MONTHLY_DAY:
if (RE_MONTHLY(re)->md_nitems)
free(RE_MONTHLY(re)->md_days);
if (RE_MONTHLY(re))
free (RE_MONTHLY(re));
break;
case RT_YEARLY_MONTH:
case RT_YEARLY_DAY:
if (RE_YEARLY(re)->yd_nitems)
free(RE_YEARLY(re)->yd_items);
if (RE_YEARLY(re))
free(RE_YEARLY(re));
break;
}
free(re);
}
/*
* Deallocate a RepeatEventState structure.
*/
void
_DtCm_free_re_state(
RepeatEventState *res)
{
if (!res) return;
free(res);
}

1071
cde/lib/csa/reparser.y Normal file

File diff suppressed because it is too large Load Diff

158
cde/lib/csa/rerule.h Normal file
View File

@@ -0,0 +1,158 @@
/* $XConsortium: rerule.h /main/1 1996/04/21 19:24:15 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#ifndef _RERULE_H
#define _RERULE_H
typedef unsigned long Time;
typedef unsigned int Interval;
typedef int Duration;
#define RE_INFINITY -1
#define RE_NOTSET -2
#define RE_ERROR -3
#define RE_LASTDAY 32
#define RE_STOP_FLAG 0x80000000
#define RE_SET_FLAG(data) (data |= RE_STOP_FLAG)
#define RE_STOP_IS_SET(data) (data & RE_STOP_FLAG)
#define RE_MASK_STOP(data) (data & ~RE_STOP_FLAG)
#ifndef TRUE
#define TRUE 1
#define FALSE 0
#endif
typedef enum {
WD_SUN = 0,
WD_MON,
WD_TUE,
WD_WED,
WD_THU,
WD_FRI,
WD_SAT
} WeekDay;
typedef enum {
WK_F1 = 0,
WK_F2,
WK_F3,
WK_F4,
WK_F5,
WK_L1,
WK_L2,
WK_L3,
WK_L4,
WK_L5
} WeekNumber;
typedef enum {
RT_MINUTE,
RT_DAILY,
RT_WEEKLY,
RT_MONTHLY_POSITION,
RT_MONTHLY_DAY,
RT_YEARLY_MONTH,
RT_YEARLY_DAY
} RepeatType;
typedef struct _NumberList {
struct _NumberList *nl_next;
unsigned int nl_number;
} NumberList;
typedef struct _DayTime {
WeekDay dt_day;
unsigned int dt_ntime;
Time *dt_time;
} DayTime;
typedef struct _DayTimeList {
struct _DayTimeList *dtl_next;
DayTime *dtl_daytime;
} DayTimeList;
typedef struct _WeekDayTime {
unsigned int wdt_nday;
WeekDay *wdt_day;
unsigned int wdt_ntime;
Time *wdt_time;
unsigned int wdt_nweek;
WeekNumber *wdt_week;
} WeekDayTime;
typedef struct _WeekDayTimeList {
struct _WeekDayTimeList *wdtl_next;
WeekDayTime *wdtl_weektime;
} WeekDayTimeList;
typedef struct _DailyData {
unsigned int dd_ntime;
Time *dd_time;
} DailyData;
typedef struct _WeeklyData {
unsigned int wd_ndaytime;
DayTime *wd_daytime;
} WeeklyData;
typedef struct _MonthlyData {
unsigned int md_nitems; /* # of md_weektime or md_days */
WeekDayTime *md_weektime; /* Used in MP command */
unsigned int *md_days; /* Array of days for MD command */
} MonthlyData;
typedef struct _YearlyData {
unsigned int yd_nitems;
unsigned int *yd_items; /* Array of days/months event occurs */
} YearlyData;
typedef struct _RepeatEvent {
struct _RepeatEvent *re_next;
struct _RepeatEvent *re_prev;
Interval re_interval;
Duration re_duration;
time_t re_end_date;
RepeatType re_type;
union {
DailyData *re_daily;
WeeklyData *re_weekly;
MonthlyData *re_monthly;
YearlyData *re_yearly;
} re_data;
} RepeatEvent;
typedef struct _RepeatEventState {
struct _RepeatEventState *res_next;
const RepeatEvent *res_re;
Duration res_duration; /* # events remaining */
union {
struct _DailyState {
unsigned int res_time;
} ds;
struct _WeeklyState {
unsigned int res_daytime;
unsigned int res_time;
} ws;
struct _MonthlyState {
unsigned int res_day;
unsigned int res_weektime;
unsigned int res_wday;
unsigned int res_wtime;
unsigned int res_wweek;
} ms;
struct _YearlyState {
unsigned int res_daymonth;
} ys;
} res_data;
} RepeatEventState;
extern void _DtCm_free_re(RepeatEvent *);
extern void _DtCm_free_re_state(RepeatEventState *);
#endif /* _RERULE_H */

248
cde/lib/csa/rescan.c Normal file
View File

@@ -0,0 +1,248 @@
/* $XConsortium: rescan.c /main/1 1996/04/21 19:24:17 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#include <EUSCompat.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <errno.h>
#include <time.h>
#include "rerule.h"
#include "reparser.h"
#define EOL 0
#define ENDMARKERSYMBOL '$'
#define DURATIONSYMBOL '#'
#define FRONTWEEKSYMBOL '+'
#define REARWEEKSYMBOL '-'
#define MINUTESYMBOL 'M'
#define DAILYSYMBOL 'D'
#define WEEKLYSYMBOL 'W'
#define LASTDAYSYMBOL "LD"
#define MONTHPOSSYMBOL "MP"
#define MONTHDAYSYMBOL "MD"
#define YEARDAYSYMBOL "YD"
#define YEARMONTHSYMBOL "YM"
#define SUNSYMBOL "SU"
#define MONSYMBOL "MO"
#define TUESYMBOL "TU"
#define WEDSYMBOL "WE"
#define THUSYMBOL "TH"
#define FRISYMBOL "FR"
#define SATSYMBOL "SA"
static int scanbuf(char **inbuf, char *, int *);
/* The rule that needs to be parsed is passed to yylex() through this var */
char *_DtCm_rule_buf;
char _DtCm_yytext[128];
int
_DtCm_yylex()
{
int token = 0;
int yylen = 128;
_DtCm_yylval.number = 0;
token = scanbuf(&_DtCm_rule_buf, _DtCm_yytext, &yylen);
if (token == NUMBER)
sscanf(_DtCm_yytext, "%d", &_DtCm_yylval.number);
if (token == DATE)
strcpy(_DtCm_yylval.date, _DtCm_yytext);
return (token);
}
static int
scanbuf(
char **buf,
char *yytext,
int *yylen)
{
int token = 0;
int state = 0;
char c = '\0';
char lastchar = '\0';
char *yystart = yytext;
memset(yytext, '\0', *yylen);
yytext[*yylen - 1] = '\0';
(*yylen)--; /* Leave room for trailing '\0' */
while (token == 0) {
lastchar = c;
c = *(*buf)++;
if (*yylen > 0) {
*yytext++ = c;
(*yylen)--;
}
switch (state) {
/* State 0 */
case 0:
if (isspace(c)) {
/* Keep whitespace out of text */
yytext--;
(*yylen)++;
/* State remains 0 */
} else if (isdigit(c)) {
if (**buf == '+' || **buf == '-') /* 1+ or 2- */
state = 3;
else
state = 1;
} else if (isalpha(c)) {
if (isalpha(**buf))
state = 2;
else
state = 4;
} else if (c == ENDMARKERSYMBOL) {
return(ENDMARKER);
} else if (c == DURATIONSYMBOL) {
return(DURATION);
} else if (c == '\0') {
return(EOL);
} else
return(ERROR);
break;
case 1:
/* Get number */
if (isdigit(c)) {
/* Stay in state 1 and get rest of number */
;
} else if (isspace(c) || c == '\0') {
/* Hit a delimiter. Put it back into the
* input buffer and keep it out of the token
* text.
*/
(*buf)--;
yytext--; (*yylen)++;
*yytext = '\0';
return(NUMBER);
} else
state = 5;
break;
case 2:
/* Get a command or weekday */
if (strcmp(yystart, MONTHPOSSYMBOL) == 0) {
return(MONTHPOSCOMMAND);
} else if (strcmp(yystart, MONTHDAYSYMBOL) == 0) {
return(MONTHDAYCOMMAND);
} else if (strcmp(yystart, YEARDAYSYMBOL) == 0) {
return(YEARDAYCOMMAND);
} else if (strcmp(yystart, YEARMONTHSYMBOL) == 0) {
return(YEARMONTHCOMMAND);
} else if (strcmp(yystart, LASTDAYSYMBOL) == 0) {
return(LASTDAY);
} else if (strcmp(yystart, SUNSYMBOL) == 0) {
return(SUNDAY);
} else if (strcmp(yystart, MONSYMBOL) == 0) {
return(MONDAY);
} else if (strcmp(yystart, TUESYMBOL) == 0) {
return(TUESDAY);
} else if (strcmp(yystart, WEDSYMBOL) == 0) {
return(WEDNESDAY);
} else if (strcmp(yystart, THUSYMBOL) == 0) {
return(THURSDAY);
} else if (strcmp(yystart, FRISYMBOL) == 0) {
return(FRIDAY);
} else if (strcmp(yystart, SATSYMBOL) == 0) {
return(SATURDAY);
} else
return(ERROR);
case 3:
/* Get a weeknumber */
if (c == FRONTWEEKSYMBOL) {
int num = lastchar - '0';
switch (num) {
case 1:
return(FIRSTWEEK);
case 2:
return(SECONDWEEK);
case 3:
return(THIRDWEEK);
case 4:
return(FOURTHWEEK);
case 5:
return(FIFTHWEEK);
default:
return(ERROR);
}
} else if (c == REARWEEKSYMBOL) {
int num = lastchar - '0';
switch (num) {
case 1:
return(LASTWEEK);
case 2:
return(SECONDLAST);
case 3:
return(THIRDLAST);
case 4:
return(FOURTHLAST);
case 5:
return(FIFTHLAST);
default:
return(ERROR);
}
}
case 4:
/* Found a single letter...probably a command */
/* We expect an interval to follow a command */
if (isdigit(c) == 0) return(ERROR);
/* Backup to before digit */
(*buf)--;
yytext--; (*yylen)++;
*yytext = '\0';
switch (lastchar) {
case DAILYSYMBOL:
return(DAILYCOMMAND);
case MINUTESYMBOL:
return(MINUTECOMMAND);
case WEEKLYSYMBOL:
return(WEEKLYCOMMAND);
default:
return(ERROR);
}
case 5:
/* Reading an ISO 8601 date */
if (isspace(c) || c == '\0') {
/* Hit a delimiter. Put it back into the
* input buffer and keep it out of the token
* text.
*/
(*buf)--;
yytext--; (*yylen)++;
*yytext = '\0';
return(DATE);
}
break;
}
}
/* Should never get to */
return (ERROR);
}

1445
cde/lib/csa/rpccalls.c Normal file

File diff suppressed because it is too large Load Diff

115
cde/lib/csa/rpccalls.h Normal file
View File

@@ -0,0 +1,115 @@
/* $XConsortium: rpccalls.h /main/1 1996/04/21 19:24:24 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#ifndef _RPCCALLS_H
#define _RPCCALLS_H
#include <EUSCompat.h>
#include "ansi_c.h"
#include "csa.h"
#include "entry.h"
/*
* interface to cm rpc calls
*/
extern CSA_return_code _DtCm_rpc_open_calendar P((Calendar *cal));
extern CSA_return_code _DtCm_rpc_create_calendar P((
Calendar *cal,
CSA_uint32 num_attrs,
CSA_attribute * attrs));
extern CSA_return_code _DtCm_rpc_delete_calendar P((Calendar *cal));
extern CSA_return_code _DtCm_rpc_register_client P((
Calendar *cal,
unsigned long type));
extern CSA_return_code _DtCm_rpc_unregister_client P((
Calendar *cal,
unsigned long type));
extern CSA_return_code _DtCm_rpc_enumerate_sequence P((
Calendar *cal,
_DtCm_libentry *entry,
time_t start,
time_t end,
_DtCm_libentry **elist_r));
extern CSA_return_code _DtCm_rpc_lookup_entries P((
Calendar *cal,
CSA_uint32 size,
CSA_attribute * attrs,
CSA_enum *ops,
_DtCm_libentry **entries_r));
extern CSA_return_code _DtCm_rpc_lookup_entry_by_id P((
Calendar *cal,
_DtCm_libentry *entry));
extern CSA_return_code _DtCm_rpc_lookup_reminder P((
Calendar *cal,
time_t tick,
CSA_uint32 num_names,
char **reminder_names,
CSA_uint32 *num_rems,
CSA_reminder_reference **rems));
extern CSA_return_code _DtCm_rpc_set_cal_attrs P((
Calendar *cal,
CSA_uint32 num_attrs,
CSA_attribute * attrs));
extern CSA_return_code _DtCm_rpc_get_cal_attrs P((
Calendar *cal,
int index,
CSA_uint32 num_attrs,
char **names));
extern CSA_return_code _DtCm_rpc_insert_entry P((
Calendar *cal,
CSA_uint32 num_attrs,
CSA_attribute * attrs,
_DtCm_libentry **entry_r));
extern CSA_return_code _DtCm_rpc_delete_entry P((
Calendar *cal,
_DtCm_libentry *entry,
CSA_enum scope));
extern CSA_return_code _DtCm_rpc_update_entry P((
Calendar *cal,
_DtCm_libentry *oentry,
CSA_uint32 num_attrs,
CSA_attribute * attrs,
CSA_enum scope,
_DtCm_libentry **nentry));
extern CSA_return_code _DtCm_rpc_list_calendar_attributes P((
Calendar *cal,
CSA_uint32 *number_names,
char ***names_r));
extern CSA_return_code _DtCm_rpc_list_calendars P((
char *location,
CSA_uint32 *number_names,
CSA_calendar_user **names_r));
extern CSA_return_code _DtCm_do_unregistration P((
_DtCm_Connection *conn,
char *cal,
unsigned long update_type));
extern CSA_return_code _DtCm_do_registration P((
_DtCm_Connection *conn,
char *cal,
unsigned long update_type));
#endif

451
cde/lib/csa/rtable2.h Normal file
View File

@@ -0,0 +1,451 @@
/*******************************************************************************
**
** rtable2.h
**
** static char sccsid[] = "@(#)rtable2.h 1.1 94/09/05 Copyr 1991 Sun Microsystems, Inc.";
**
** $TOG: rtable2.h /main/3 1999/10/14 17:47:41 mgreess $
**
** RESTRICTED CONFIDENTIAL INFORMATION:
**
** The information in this document is subject to special
** restrictions in a confidential disclosure agreement between
** HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
** document outside HP, IBM, Sun, USL, SCO, or Univel without
** Sun's specific written approval. This document and all copies
** and derivative works thereof must be returned or destroyed at
** Sun's request.
**
** Copyright 1993 Sun Microsystems, Inc. All rights reserved.
**
*******************************************************************************/
#ifndef _RTABLE2_H
#define _RTABLE2_H
#ifndef SunOS
#include <rpc/types.h>
#endif /* HPUX */
#include <rpc/rpc.h>
#ifdef __cplusplus
extern "C" {
#endif
#include "connection.h"
extern bool_t xdr_time_t();
typedef char *Buffer_2;
enum Transaction_2 {
add_2 = 0,
cm_remove_2 = 1
};
typedef enum Transaction_2 Transaction_2;
enum Period_2 {
single_2 = 0,
daily_2 = 1,
weekly_2 = 2,
biweekly_2 = 3,
monthly_2 = 4,
yearly_2 = 5,
nthWeekday_2 = 6,
everyNthDay_2 = 7,
everyNthWeek_2 = 8,
everyNthMonth_2 = 9,
otherPeriod_2 = 10
};
typedef enum Period_2 Period_2;
enum Tag_2 {
appointment_2 = 0,
reminder_2 = 1,
otherTag_2 = 2
};
typedef enum Tag_2 Tag_2;
struct Attribute_2 {
struct Attribute_2 *next;
Buffer_2 attr;
Buffer_2 value;
};
typedef struct Attribute_2 Attribute_2;
typedef Attribute_2 *Attr_2;
struct Except_2 {
int ordinal;
struct Except_2 *next;
};
typedef struct Except_2 Except_2;
typedef Except_2 *Exception_2;
struct Id_2 {
time_t tick;
long key;
};
typedef struct Id_2 Id_2;
struct Uid_2 {
struct Id_2 appt_id;
struct Uid_2 *next;
};
typedef struct Uid_2 Uid_2;
struct Appt_2 {
struct Id_2 appt_id;
Tag_2 tag;
int duration;
int ntimes;
Buffer_2 what;
Buffer_2 mailto;
Buffer_2 script;
Period_2 period;
Buffer_2 author;
Buffer_2 client_data;
struct Except_2 *exception;
struct Attribute_2 *attr;
struct Appt_2 *next;
};
typedef struct Appt_2 Appt_2;
struct Abb_Appt_2 {
struct Id_2 appt_id;
Buffer_2 what;
int duration;
Period_2 period;
struct Abb_Appt_2 *next;
};
typedef struct Abb_Appt_2 Abb_Appt_2;
struct Apptid_2 {
struct Id_2 *oid;
struct Appt_2 *new_appt;
};
typedef struct Apptid_2 Apptid_2;
struct Reminder_2 {
struct Id_2 appt_id;
long tick;
Attribute_2 attr;
struct Reminder_2 *next;
};
typedef struct Reminder_2 Reminder_2;
enum Table_Res_Type_2 {
AP_2 = 0,
RM_2 = 1,
AB_2 = 2,
ID_2 = 3
};
typedef enum Table_Res_Type_2 Table_Res_Type_2;
struct Table_Res_List_2 {
Table_Res_Type_2 tag;
union {
Appt_2 *a;
Reminder_2 *r;
Abb_Appt_2 *b;
Uid_2 *i;
} Table_Res_List_2_u;
};
typedef struct Table_Res_List_2 Table_Res_List_2;
enum Access_Status_2 {
access_ok_2 = 0,
access_added_2 = 1,
access_removed_2 = 2,
access_failed_2 = 3,
access_exists_2 = 4,
access_partial_2 = 5,
access_other_2 = 6
};
typedef enum Access_Status_2 Access_Status_2;
struct Table_Res_2 {
Access_Status_2 status;
Table_Res_List_2 res;
};
typedef struct Table_Res_2 Table_Res_2;
#define access_none_2 0x0 /* owner only */
#define access_read_2 0x1
#define access_write_2 0x2
#define access_delete_2 0x4
#define access_exec_2 0x8 /* execution permission is a hack! */
#define VOIDPID -1 /* pre-V3 tools do present pids */
struct Access_Entry_2 {
Buffer_2 who;
int access_type;
struct Access_Entry_2 *next;
};
typedef struct Access_Entry_2 Access_Entry_2;
struct Access_Args_2 {
Buffer_2 target;
Access_Entry_2 *access_list;
};
typedef struct Access_Args_2 Access_Args_2;
struct Range_2 {
long key1;
long key2;
struct Range_2 *next;
};
typedef struct Range_2 Range_2;
enum Table_Args_Type_2 {
TICK_2 = 0,
APPTID_2 = 1,
UID_2 = 2,
APPT_2 = 3,
RANGE_2 = 4
};
typedef enum Table_Args_Type_2 Table_Args_Type_2;
struct Args_2 {
Table_Args_Type_2 tag;
union {
long tick;
Apptid_2 apptid;
Uid_2 *key;
Appt_2 *appt;
Range_2 *range;
} Args_2_u;
};
typedef struct Args_2 Args_2;
struct Table_Args_2 {
Buffer_2 target;
Args_2 args;
};
typedef struct Table_Args_2 Table_Args_2;
struct Registration_2 {
Buffer_2 target;
u_long prognum;
u_long versnum;
u_long procnum;
struct Registration_2 *next;
};
typedef struct Registration_2 Registration_2;
enum Table_Status_2 {
ok_2 = 0,
duplicate_2 = 1,
badtable_2 = 2,
notable_2 = 3,
denied_2 = 4,
other_2 = 5
};
typedef enum Table_Status_2 Table_Status_2;
enum Registration_Status_2 {
registered_2 = 0,
failed_2 = 1,
deregistered_2 = 2,
confused_2 = 3
};
typedef enum Registration_Status_2 Registration_Status_2;
#define TABLEPROG ((unsigned long)(100068))
#define TABLEVERS_2 ((unsigned long)(2))
#if defined(__STDC__) || defined(__cplusplus)
#define rtable_ping ((unsigned long)(0))
extern void * _DtCm_rtable_ping_2(void *, _DtCm_Connection *);
extern void * _DtCm_rtable_ping_2_svc(void *, struct svc_req *);
#define rtable_lookup ((unsigned long)(1))
extern Table_Res_2 * _DtCm_rtable_lookup_2(Table_Args_2 *, _DtCm_Connection *);
extern Table_Res_2 * _DtCm_rtable_lookup_2_svc(Table_Args_2 *, struct svc_req *);
#define rtable_lookup_next_larger ((unsigned long)(2))
extern Table_Res_2 * _DtCm_rtable_lookup_next_larger_2(Table_Args_2 *, _DtCm_Connection *);
extern Table_Res_2 * _DtCm_rtable_lookup_next_larger_2_svc(Table_Args_2 *, struct svc_req *);
#define rtable_lookup_next_smaller ((unsigned long)(3))
extern Table_Res_2 * _DtCm_rtable_lookup_next_smaller_2(Table_Args_2 *, _DtCm_Connection *);
extern Table_Res_2 * _DtCm_rtable_lookup_next_smaller_2_svc(Table_Args_2 *, struct svc_req *);
#define rtable_lookup_range ((unsigned long)(4))
extern Table_Res_2 * _DtCm_rtable_lookup_range_2(Table_Args_2 *, _DtCm_Connection *);
extern Table_Res_2 * _DtCm_rtable_lookup_range_2_svc(Table_Args_2 *, struct svc_req *);
#define rtable_abbreviated_lookup_range ((unsigned long)(5))
extern Table_Res_2 * _DtCm_rtable_abbreviated_lookup_range_2(Table_Args_2 *, _DtCm_Connection *);
extern Table_Res_2 * _DtCm_rtable_abbreviated_lookup_range_2_svc(Table_Args_2 *, struct svc_req *);
#define rtable_insert ((unsigned long)(6))
extern Table_Res_2 * _DtCm_rtable_insert_2(Table_Args_2 *, _DtCm_Connection *);
extern Table_Res_2 * _DtCm_rtable_insert_2_svc(Table_Args_2 *, struct svc_req *);
#define rtable_delete ((unsigned long)(7))
extern Table_Res_2 * _DtCm_rtable_delete_2(Table_Args_2 *, _DtCm_Connection *);
extern Table_Res_2 * _DtCm_rtable_delete_2_svc(Table_Args_2 *, struct svc_req *);
#define rtable_delete_instance ((unsigned long)(8))
extern Table_Res_2 * _DtCm_rtable_delete_instance_2(Table_Args_2 *, _DtCm_Connection *);
extern Table_Res_2 * _DtCm_rtable_delete_instance_2_svc(Table_Args_2 *, struct svc_req *);
#define rtable_change ((unsigned long)(9))
extern Table_Res_2 * _DtCm_rtable_change_2(Table_Args_2 *, _DtCm_Connection *);
extern Table_Res_2 * _DtCm_rtable_change_2_svc(Table_Args_2 *, struct svc_req *);
#define rtable_change_instance ((unsigned long)(10))
extern Table_Res_2 * _DtCm_rtable_change_instance_2(Table_Args_2 *, _DtCm_Connection *);
extern Table_Res_2 * _DtCm_rtable_change_instance_2_svc(Table_Args_2 *, struct svc_req *);
#define rtable_lookup_next_reminder ((unsigned long)(11))
extern Table_Res_2 * _DtCm_rtable_lookup_next_reminder_2(Table_Args_2 *, _DtCm_Connection *);
extern Table_Res_2 * _DtCm_rtable_lookup_next_reminder_2_svc(Table_Args_2 *, struct svc_req *);
#define rtable_check ((unsigned long)(12))
extern Table_Status_2 * _DtCm_rtable_check_2(Table_Args_2 *, _DtCm_Connection *);
extern Table_Status_2 * _DtCm_rtable_check_2_svc(Table_Args_2 *, struct svc_req *);
#define rtable_flush_table ((unsigned long)(13))
extern Table_Status_2 * _DtCm_rtable_flush_table_2(Table_Args_2 *, _DtCm_Connection *);
extern Table_Status_2 * _DtCm_rtable_flush_table_2_svc(Table_Args_2 *, struct svc_req *);
#define rtable_size ((unsigned long)(14))
extern int * _DtCm_rtable_size_2(Table_Args_2 *, _DtCm_Connection *);
extern int * _DtCm_rtable_size_2_svc(Table_Args_2 *, struct svc_req *);
#define register_callback ((unsigned long)(15))
extern Registration_Status_2 * _DtCm_register_callback_2(Registration_2 *, _DtCm_Connection *);
extern Registration_Status_2 * _DtCm_register_callback_2_svc(Registration_2 *, struct svc_req *);
#define deregister_callback ((unsigned long)(16))
extern Registration_Status_2 * _DtCm_deregister_callback_2(Registration_2 *, _DtCm_Connection *);
extern Registration_Status_2 * _DtCm_deregister_callback_2_svc(Registration_2 *, struct svc_req *);
#define rtable_set_access ((unsigned long)(17))
extern Access_Status_2 * _DtCm_rtable_set_access_2(Access_Args_2 *, _DtCm_Connection *);
extern Access_Status_2 * _DtCm_rtable_set_access_2_svc(Access_Args_2 *, struct svc_req *);
#define rtable_get_access ((unsigned long)(18))
extern Access_Args_2 * _DtCm_rtable_get_access_2(Access_Args_2 *, _DtCm_Connection *);
extern Access_Args_2 * _DtCm_rtable_get_access_2_svc(Access_Args_2 *, struct svc_req *);
extern int tableprog_2_freeresult(SVCXPRT *, xdrproc_t, caddr_t);
#else /* K&R C */
#define rtable_ping ((unsigned long)(0))
extern void * _DtCm_rtable_ping_2();
extern void * _DtCm_rtable_ping_2_svc();
#define rtable_lookup ((unsigned long)(1))
extern Table_Res_2 * _DtCm_rtable_lookup_2();
extern Table_Res_2 * _DtCm_rtable_lookup_2_svc();
#define rtable_lookup_next_larger ((unsigned long)(2))
extern Table_Res_2 * _DtCm_rtable_lookup_next_larger_2();
extern Table_Res_2 * _DtCm_rtable_lookup_next_larger_2_svc();
#define rtable_lookup_next_smaller ((unsigned long)(3))
extern Table_Res_2 * _DtCm_rtable_lookup_next_smaller_2();
extern Table_Res_2 * _DtCm_rtable_lookup_next_smaller_2_svc();
#define rtable_lookup_range ((unsigned long)(4))
extern Table_Res_2 * _DtCm_rtable_lookup_range_2();
extern Table_Res_2 * _DtCm_rtable_lookup_range_2_svc();
#define rtable_abbreviated_lookup_range ((unsigned long)(5))
extern Table_Res_2 * _DtCm_rtable_abbreviated_lookup_range_2();
extern Table_Res_2 * _DtCm_rtable_abbreviated_lookup_range_2_svc();
#define rtable_insert ((unsigned long)(6))
extern Table_Res_2 * _DtCm_rtable_insert_2();
extern Table_Res_2 * _DtCm_rtable_insert_2_svc();
#define rtable_delete ((unsigned long)(7))
extern Table_Res_2 * _DtCm_rtable_delete_2();
extern Table_Res_2 * _DtCm_rtable_delete_2_svc();
#define rtable_delete_instance ((unsigned long)(8))
extern Table_Res_2 * _DtCm_rtable_delete_instance_2();
extern Table_Res_2 * _DtCm_rtable_delete_instance_2_svc();
#define rtable_change ((unsigned long)(9))
extern Table_Res_2 * _DtCm_rtable_change_2();
extern Table_Res_2 * _DtCm_rtable_change_2_svc();
#define rtable_change_instance ((unsigned long)(10))
extern Table_Res_2 * _DtCm_rtable_change_instance_2();
extern Table_Res_2 * _DtCm_rtable_change_instance_2_svc();
#define rtable_lookup_next_reminder ((unsigned long)(11))
extern Table_Res_2 * _DtCm_rtable_lookup_next_reminder_2();
extern Table_Res_2 * _DtCm_rtable_lookup_next_reminder_2_svc();
#define rtable_check ((unsigned long)(12))
extern Table_Status_2 * _DtCm_rtable_check_2();
extern Table_Status_2 * _DtCm_rtable_check_2_svc();
#define rtable_flush_table ((unsigned long)(13))
extern Table_Status_2 * _DtCm_rtable_flush_table_2();
extern Table_Status_2 * _DtCm_rtable_flush_table_2_svc();
#define rtable_size ((unsigned long)(14))
extern int * _DtCm_rtable_size_2();
extern int * _DtCm_rtable_size_2_svc();
#define register_callback ((unsigned long)(15))
extern Registration_Status_2 * _DtCm_register_callback_2();
extern Registration_Status_2 * _DtCm_register_callback_2_svc();
#define deregister_callback ((unsigned long)(16))
extern Registration_Status_2 * _DtCm_deregister_callback_2();
extern Registration_Status_2 * _DtCm_deregister_callback_2_svc();
#define rtable_set_access ((unsigned long)(17))
extern Access_Status_2 * _DtCm_rtable_set_access_2();
extern Access_Status_2 * _DtCm_rtable_set_access_2_svc();
#define rtable_get_access ((unsigned long)(18))
extern Access_Args_2 * _DtCm_rtable_get_access_2();
extern Access_Args_2 * _DtCm_rtable_get_access_2_svc();
extern int tableprog_2_freeresult();
#endif /* K&R C */
/* the xdr functions */
#if defined(__STDC__) || defined(__cplusplus)
extern bool_t _DtCm_xdr_Buffer_2(XDR *, Buffer_2*);
extern bool_t _DtCm_xdr_Transaction_2(XDR *, Transaction_2*);
extern bool_t _DtCm_xdr_Period_2(XDR *, Period_2*);
extern bool_t _DtCm_xdr_Tag_2(XDR *, Tag_2*);
extern bool_t _DtCm_xdr_Attribute_2(XDR *, Attribute_2*);
extern bool_t _DtCm_xdr_Attr_2(XDR *, Attr_2*);
extern bool_t _DtCm_xdr_Except_2(XDR *, Except_2*);
extern bool_t _DtCm_xdr_Exception_2(XDR *, Exception_2*);
extern bool_t _DtCm_xdr_Id_2(XDR *, Id_2*);
extern bool_t _DtCm_xdr_Uid_2(XDR *, Uid_2*);
extern bool_t _DtCm_xdr_Appt_2(XDR *, Appt_2*);
extern bool_t _DtCm_xdr_Abb_Appt_2(XDR *, Abb_Appt_2*);
extern bool_t _DtCm_xdr_Apptid_2(XDR *, Apptid_2*);
extern bool_t _DtCm_xdr_Reminder_2(XDR *, Reminder_2*);
extern bool_t _DtCm_xdr_Table_Res_Type_2(XDR *, Table_Res_Type_2*);
extern bool_t _DtCm_xdr_Table_Res_List_2(XDR *, Table_Res_List_2*);
extern bool_t _DtCm_xdr_Access_Status_2(XDR *, Access_Status_2*);
extern bool_t _DtCm_xdr_Table_Res_2(XDR *, Table_Res_2*);
extern bool_t _DtCm_xdr_Access_Entry_2(XDR *, Access_Entry_2*);
extern bool_t _DtCm_xdr_Access_Args_2(XDR *, Access_Args_2*);
extern bool_t _DtCm_xdr_Range_2(XDR *, Range_2*);
extern bool_t _DtCm_xdr_Table_Args_Type_2(XDR *, Table_Args_Type_2*);
extern bool_t _DtCm_xdr_Args_2(XDR *, Args_2*);
extern bool_t _DtCm_xdr_Table_Args_2(XDR *, Table_Args_2*);
extern bool_t _DtCm_xdr_Registration_2(XDR *, Registration_2*);
extern bool_t _DtCm_xdr_Table_Status_2(XDR *, Table_Status_2*);
extern bool_t _DtCm_xdr_Registration_Status_2(XDR *, Registration_Status_2*);
#else /* K&R C */
extern bool_t _DtCm_xdr_Buffer_2();
extern bool_t _DtCm_xdr_Transaction_2();
extern bool_t _DtCm_xdr_Period_2();
extern bool_t _DtCm_xdr_Tag_2();
extern bool_t _DtCm_xdr_Attribute_2();
extern bool_t _DtCm_xdr_Attr_2();
extern bool_t _DtCm_xdr_Except_2();
extern bool_t _DtCm_xdr_Exception_2();
extern bool_t _DtCm_xdr_Id_2();
extern bool_t _DtCm_xdr_Uid_2();
extern bool_t _DtCm_xdr_Appt_2();
extern bool_t _DtCm_xdr_Abb_Appt_2();
extern bool_t _DtCm_xdr_Apptid_2();
extern bool_t _DtCm_xdr_Reminder_2();
extern bool_t _DtCm_xdr_Table_Res_Type_2();
extern bool_t _DtCm_xdr_Table_Res_List_2();
extern bool_t _DtCm_xdr_Access_Status_2();
extern bool_t _DtCm_xdr_Table_Res_2();
extern bool_t _DtCm_xdr_Access_Entry_2();
extern bool_t _DtCm_xdr_Access_Args_2();
extern bool_t _DtCm_xdr_Range_2();
extern bool_t _DtCm_xdr_Table_Args_Type_2();
extern bool_t _DtCm_xdr_Args_2();
extern bool_t _DtCm_xdr_Table_Args_2();
extern bool_t _DtCm_xdr_Registration_2();
extern bool_t _DtCm_xdr_Table_Status_2();
extern bool_t _DtCm_xdr_Registration_Status_2();
#endif /* K&R C */
#ifdef __cplusplus
}
#endif
#ifdef HPUX
#undef hpux
#define hpux
#endif
#endif

201
cde/lib/csa/rtable2.x Normal file
View File

@@ -0,0 +1,201 @@
/* $XConsortium: rtable2.x /main/1 1996/04/21 19:24:30 drk $ */
/*
* (c) Copyright 1996 Digital Equipment Corporation.
* (c) Copyright 1993,1994,1996 Hewlett-Packard Company.
* (c) Copyright 1993,1994,1996 International Business Machines Corp.
* (c) Copyright 1993,1994,1996 Sun Microsystems, Inc.
* (c) Copyright 1993,1994,1996 Novell, Inc.
* (c) Copyright 1996 FUJITSU LIMITED.
* (c) Copyright 1996 Hitachi.
*/
#ifdef RPC_HDR
%#include "connection.h"
%
#endif
typedef string Buffer_2<>;
enum Transaction_2 {
add_2, cm_remove_2
};
enum Period_2 {
single_2, daily_2, weekly_2, biweekly_2, monthly_2, yearly_2,
nthWeekday_2, everyNthDay_2, everyNthWeek_2,
everyNthMonth_2, otherPeriod_2
};
enum Tag_2{
appointment_2, reminder_2, otherTag_2
};
struct Attribute_2 {
struct Attribute_2 *next;
Buffer_2 attr;
Buffer_2 value;
};
typedef Attribute_2 *Attr_2;
struct Except_2 {
int ordinal;
struct Except_2 *next;
};
typedef Except_2 *Exception_2;
struct Id_2 {
time_t tick; /* user specified time stored as GMT */
long key; /* system assigned id */
};
struct Uid_2 {
struct Id_2 appt_id;
struct Uid_2 *next;
};
struct Appt_2 {
struct Id_2 appt_id; /* appointment/repeater id */
Tag_2 tag; /* appointment or otherTag */
int duration; /* appt duration in seconds */
int ntimes; /* n repeat times (0 .. forever) */
Buffer_2 what; /* text of appointment */
Buffer_2 mailto; /* addressee of mail reminder */
Buffer_2 script; /* text of unix script for script reminder */
Period_2 period; /* periodicity of event: single default */
Buffer_2 author; /* user who inserted the appt */
Buffer_2 client_data; /* TBD. */
struct Except_2 *exception; /* list of exceptions to repeating events */
struct Attribute_2 *attr; /* list of reminder attributes */
struct Appt_2 *next; /* next appointment */
};
struct Abb_Appt_2 {
struct Id_2 appt_id;
Buffer_2 what;
int duration;
Period_2 period;
struct Abb_Appt_2 *next;
};
struct Apptid_2 {
struct Id_2 *oid; /* old appt key */
struct Appt_2 *new_appt; /* new appt */
};
struct Reminder_2 {
struct Id_2 appt_id; /* actual appt. key */
long tick; /* the happening tick */
Attribute_2 attr; /* (attr, value) */
struct Reminder_2 *next;
};
enum Table_Res_Type_2 {AP_2, RM_2, AB_2, ID_2};
union Table_Res_List_2 switch (Table_Res_Type_2 tag) {
case AP_2:
Appt_2 *a;
case RM_2:
Reminder_2 *r;
case AB_2:
Abb_Appt_2 *b;
case ID_2:
Uid_2 *i;
default:
void;
};
enum Access_Status_2 {
access_ok_2,
access_added_2,
access_removed_2,
access_failed_2,
access_exists_2,
access_partial_2,
access_other_2
};
struct Table_Res_2 {
Access_Status_2 status;
Table_Res_List_2 res;
};
%#define access_none_2 0x0 /* owner only */
%#define access_read_2 0x1
%#define access_write_2 0x2
%#define access_delete_2 0x4
%#define access_exec_2 0x8 /* execution permission is a hack! */
%#define VOIDPID -1 /* pre-V3 tools do present pids */
struct Access_Entry_2 {
Buffer_2 who;
int access_type; /* Bit mask from access_read,write,delete */
Access_Entry_2 *next;
};
struct Access_Args_2 {
Buffer_2 target;
Access_Entry_2 *access_list;
};
struct Range_2 {
long key1; /* lower bound tick */
long key2; /* upper bound tick */
struct Range_2 *next;
};
enum Table_Args_Type_2 {TICK_2, APPTID_2, UID_2, APPT_2, RANGE_2};
union Args_2 switch (Table_Args_Type_2 tag) {
case TICK_2:
time_t tick;
case APPTID_2:
Apptid_2 apptid;
case UID_2:
Uid_2 *key;
case APPT_2:
Appt_2 *appt;
case RANGE_2:
Range_2 *range;
};
struct Table_Args_2 {
Buffer_2 target;
Args_2 args;
};
struct Registration_2 {
Buffer_2 target;
u_long prognum;
u_long versnum;
u_long procnum;
struct Registration_2 *next;
};
enum Table_Status_2 {ok_2, duplicate_2, badtable_2, notable_2, denied_2, other_2};
enum Registration_Status_2 {registered_2, failed_2, deregistered_2, confused_2};
program TABLEPROG {
version TABLEVERS_2 {
void rtable_ping(void) = 0;
Table_Res_2 rtable_lookup(Table_Args_2) = 1;
Table_Res_2 rtable_lookup_next_larger(Table_Args_2) = 2;
Table_Res_2 rtable_lookup_next_smaller(Table_Args_2) = 3;
Table_Res_2 rtable_lookup_range(Table_Args_2) = 4;
Table_Res_2 rtable_abbreviated_lookup_range(Table_Args_2) = 5;
Table_Res_2 rtable_insert(Table_Args_2) = 6;
Table_Res_2 rtable_delete(Table_Args_2) = 7;
Table_Res_2 rtable_delete_instance(Table_Args_2) = 8;
Table_Res_2 rtable_change(Table_Args_2) = 9;
Table_Res_2 rtable_change_instance(Table_Args_2) = 10;
Table_Res_2 rtable_lookup_next_reminder(Table_Args_2) = 11;
Table_Status_2 rtable_check(Table_Args_2) = 12;
Table_Status_2 rtable_flush_table(Table_Args_2) = 13;
int rtable_size(Table_Args_2) = 14;
Registration_Status_2 register_callback(Registration_2) = 15;
Registration_Status_2 deregister_callback(Registration_2) = 16;
Access_Status_2 rtable_set_access(Access_Args_2) = 17;
Access_Args_2 rtable_get_access(Access_Args_2) = 18;
} = 2;
} = 100068;

519
cde/lib/csa/rtable3.h Normal file
View File

@@ -0,0 +1,519 @@
/*******************************************************************************
**
** rtable3.h
**
** static char sccsid[] = "@(#)rtable3.h 1.1 94/09/05 Copyr 1991 Sun Microsystems, Inc.";
**
** $TOG: rtable3.h /main/3 1999/10/14 17:47:54 mgreess $
**
** RESTRICTED CONFIDENTIAL INFORMATION:
**
** The information in this document is subject to special
** restrictions in a confidential disclosure agreement between
** HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
** document outside HP, IBM, Sun, USL, SCO, or Univel without
** Sun's specific written approval. This document and all copies
** and derivative works thereof must be returned or destroyed at
** Sun's request.
**
** Copyright 1993 Sun Microsystems, Inc. All rights reserved.
**
*******************************************************************************/
#ifndef _RTABLE3_H
#define _RTABLE3_H
#ifndef SunOS
#include <rpc/types.h>
#endif /* HPUX */
#include <rpc/rpc.h>
#ifdef __cplusplus
extern "C" {
#endif
#include "connection.h"
extern bool_t xdr_time_t();
typedef char *Buffer_3;
enum Transaction_3 {
add_3 = 0,
cm_remove_3 = 1
};
typedef enum Transaction_3 Transaction_3;
enum Interval_3 {
single_3 = 0,
daily_3 = 1,
weekly_3 = 2,
biweekly_3 = 3,
monthly_3 = 4,
yearly_3 = 5,
nthWeekday_3 = 6,
everyNthDay_3 = 7,
everyNthWeek_3 = 8,
everyNthMonth_3 = 9,
otherPeriod_3 = 10
};
typedef enum Interval_3 Interval_3;
struct Period_3 {
Interval_3 period;
int nth;
};
typedef struct Period_3 Period_3;
enum Event_Type_3 {
appointment_3 = 0,
reminder_3 = 1,
otherTag_3 = 2,
holiday_3 = 3,
toDo_3 = 4
};
typedef enum Event_Type_3 Event_Type_3;
struct Tag_3 {
Event_Type_3 tag;
int showtime;
struct Tag_3 *next;
};
typedef struct Tag_3 Tag_3;
enum Privacy_Level_3 {
public_3 = 0,
private_3 = 1,
semiprivate_3 = 2
};
typedef enum Privacy_Level_3 Privacy_Level_3;
struct Attribute_3 {
struct Attribute_3 *next;
Buffer_3 attr;
Buffer_3 value;
Buffer_3 clientdata;
};
typedef struct Attribute_3 Attribute_3;
typedef Attribute_3 *Attr_3;
struct Except_3 {
int ordinal;
struct Except_3 *next;
};
typedef struct Except_3 Except_3;
typedef Except_3 *Exception_3;
struct Id_3 {
long tick;
long key;
};
typedef struct Id_3 Id_3;
struct Uid_3 {
struct Id_3 appt_id;
struct Uid_3 *next;
};
typedef struct Uid_3 Uid_3;
enum Appt_Status_3 {
active_3 = 0,
pendingAdd_3 = 1,
pendingDelete_3 = 2,
committed_3 = 3,
cancelled_3 = 4,
completed_3 = 5
};
typedef enum Appt_Status_3 Appt_Status_3;
struct Appt_3 {
struct Id_3 appt_id;
struct Tag_3 *tag;
int duration;
int ntimes;
Buffer_3 what;
struct Period_3 period;
Buffer_3 author;
Buffer_3 client_data;
struct Except_3 *exception;
struct Attribute_3 *attr;
Appt_Status_3 appt_status;
Privacy_Level_3 privacy;
struct Appt_3 *next;
};
typedef struct Appt_3 Appt_3;
struct Abb_Appt_3 {
struct Id_3 appt_id;
struct Tag_3 *tag;
Buffer_3 what;
int duration;
struct Period_3 period;
struct Abb_Appt_3 *next;
Appt_Status_3 appt_status;
Privacy_Level_3 privacy;
};
typedef struct Abb_Appt_3 Abb_Appt_3;
struct Apptid_3 {
struct Id_3 *oid;
struct Appt_3 *new_appt;
};
typedef struct Apptid_3 Apptid_3;
struct Reminder_3 {
struct Id_3 appt_id;
long tick;
Attribute_3 attr;
struct Reminder_3 *next;
};
typedef struct Reminder_3 Reminder_3;
enum Table_Res_Type_3 {
AP_3 = 0,
RM_3 = 1,
AB_3 = 2,
ID_3 = 3
};
typedef enum Table_Res_Type_3 Table_Res_Type_3;
struct Table_Res_List_3 {
Table_Res_Type_3 tag;
union {
Appt_3 *a;
Reminder_3 *r;
Abb_Appt_3 *b;
Uid_3 *i;
} Table_Res_List_3_u;
};
typedef struct Table_Res_List_3 Table_Res_List_3;
enum Access_Status_3 {
access_ok_3 = 0,
access_added_3 = 1,
access_removed_3 = 2,
access_failed_3 = 3,
access_exists_3 = 4,
access_partial_3 = 5,
access_other_3 = 6
};
typedef enum Access_Status_3 Access_Status_3;
struct Table_Res_3 {
Access_Status_3 status;
Table_Res_List_3 res;
};
typedef struct Table_Res_3 Table_Res_3;
#define access_none_3 0x0 /* owner only */
#define access_read_3 0x1
#define access_write_3 0x2
#define access_delete_3 0x4
#define access_exec_3 0x8 /* execution permission is a hack! */
struct Access_Entry_3 {
Buffer_3 who;
int access_type;
struct Access_Entry_3 *next;
};
typedef struct Access_Entry_3 Access_Entry_3;
struct Access_Args_3 {
Buffer_3 target;
Access_Entry_3 *access_list;
};
typedef struct Access_Args_3 Access_Args_3;
struct Range_3 {
long key1;
long key2;
struct Range_3 *next;
};
typedef struct Range_3 Range_3;
struct Keyrange_3 {
long key;
long tick1;
long tick2;
struct Keyrange_3 *next;
};
typedef struct Keyrange_3 Keyrange_3;
enum Table_Args_Type_3 {
TICK_3 = 0,
APPTID_3 = 1,
UID_3 = 2,
APPT_3 = 3,
RANGE_3 = 4,
KEYRANGE_3 = 5
};
typedef enum Table_Args_Type_3 Table_Args_Type_3;
struct Args_3 {
Table_Args_Type_3 tag;
union {
long tick;
Apptid_3 apptid;
Uid_3 *key;
Appt_3 *appt;
Range_3 *range;
Keyrange_3 *keyrange;
} Args_3_u;
};
typedef struct Args_3 Args_3;
struct Table_Args_3 {
Buffer_3 target;
Args_3 args;
int pid;
};
typedef struct Table_Args_3 Table_Args_3;
struct Registration_3 {
Buffer_3 target;
u_long prognum;
u_long versnum;
u_long procnum;
struct Registration_3 *next;
int pid;
};
typedef struct Registration_3 Registration_3;
enum Table_Status_3 {
ok_3 = 0,
duplicate_3 = 1,
badtable_3 = 2,
notable_3 = 3,
denied_3 = 4,
other_3 = 5
};
typedef enum Table_Status_3 Table_Status_3;
enum Registration_Status_3 {
registered_3 = 0,
failed_3 = 1,
deregistered_3 = 2,
confused_3 = 3
};
typedef enum Registration_Status_3 Registration_Status_3;
#define TABLEPROG ((unsigned long)(100068))
#define TABLEVERS_3 ((unsigned long)(3))
#if defined(__STDC__) || defined(__cplusplus)
#define rtable_ping ((unsigned long)(0))
extern void * _DtCm_rtable_ping_3(void *, _DtCm_Connection *);
extern void * _DtCm_rtable_ping_3_svc(void *, struct svc_req *);
#define rtable_lookup ((unsigned long)(1))
extern Table_Res_3 * _DtCm_rtable_lookup_3(Table_Args_3 *, _DtCm_Connection *);
extern Table_Res_3 * _DtCm_rtable_lookup_3_svc(Table_Args_3 *, struct svc_req *);
#define rtable_lookup_next_larger ((unsigned long)(2))
extern Table_Res_3 * _DtCm_rtable_lookup_next_larger_3(Table_Args_3 *, _DtCm_Connection *);
extern Table_Res_3 * _DtCm_rtable_lookup_next_larger_3_svc(Table_Args_3 *, struct svc_req *);
#define rtable_lookup_next_smaller ((unsigned long)(3))
extern Table_Res_3 * _DtCm_rtable_lookup_next_smaller_3(Table_Args_3 *, _DtCm_Connection *);
extern Table_Res_3 * _DtCm_rtable_lookup_next_smaller_3_svc(Table_Args_3 *, struct svc_req *);
#define rtable_lookup_range ((unsigned long)(4))
extern Table_Res_3 * _DtCm_rtable_lookup_range_3(Table_Args_3 *, _DtCm_Connection *);
extern Table_Res_3 * _DtCm_rtable_lookup_range_3_svc(Table_Args_3 *, struct svc_req *);
#define rtable_abbreviated_lookup_range ((unsigned long)(5))
extern Table_Res_3 * _DtCm_rtable_abbreviated_lookup_range_3(Table_Args_3 *, _DtCm_Connection *);
extern Table_Res_3 * _DtCm_rtable_abbreviated_lookup_range_3_svc(Table_Args_3 *, struct svc_req *);
#define rtable_insert ((unsigned long)(6))
extern Table_Res_3 * _DtCm_rtable_insert_3(Table_Args_3 *, _DtCm_Connection *);
extern Table_Res_3 * _DtCm_rtable_insert_3_svc(Table_Args_3 *, struct svc_req *);
#define rtable_delete ((unsigned long)(7))
extern Table_Res_3 * _DtCm_rtable_delete_3(Table_Args_3 *, _DtCm_Connection *);
extern Table_Res_3 * _DtCm_rtable_delete_3_svc(Table_Args_3 *, struct svc_req *);
#define rtable_delete_instance ((unsigned long)(8))
extern Table_Res_3 * _DtCm_rtable_delete_instance_3(Table_Args_3 *, _DtCm_Connection *);
extern Table_Res_3 * _DtCm_rtable_delete_instance_3_svc(Table_Args_3 *, struct svc_req *);
#define rtable_change ((unsigned long)(9))
extern Table_Res_3 * _DtCm_rtable_change_3(Table_Args_3 *, _DtCm_Connection *);
extern Table_Res_3 * _DtCm_rtable_change_3_svc(Table_Args_3 *, struct svc_req *);
#define rtable_change_instance ((unsigned long)(10))
extern Table_Res_3 * _DtCm_rtable_change_instance_3(Table_Args_3 *, _DtCm_Connection *);
extern Table_Res_3 * _DtCm_rtable_change_instance_3_svc(Table_Args_3 *, struct svc_req *);
#define rtable_lookup_next_reminder ((unsigned long)(11))
extern Table_Res_3 * _DtCm_rtable_lookup_next_reminder_3(Table_Args_3 *, _DtCm_Connection *);
extern Table_Res_3 * _DtCm_rtable_lookup_next_reminder_3_svc(Table_Args_3 *, struct svc_req *);
#define rtable_check ((unsigned long)(12))
extern Table_Status_3 * _DtCm_rtable_check_3(Table_Args_3 *, _DtCm_Connection *);
extern Table_Status_3 * _DtCm_rtable_check_3_svc(Table_Args_3 *, struct svc_req *);
#define rtable_flush_table ((unsigned long)(13))
extern Table_Status_3 * _DtCm_rtable_flush_table_3(Table_Args_3 *, _DtCm_Connection *);
extern Table_Status_3 * _DtCm_rtable_flush_table_3_svc(Table_Args_3 *, struct svc_req *);
#define rtable_size ((unsigned long)(14))
extern int * _DtCm_rtable_size_3(Table_Args_3 *, _DtCm_Connection *);
extern int * _DtCm_rtable_size_3_svc(Table_Args_3 *, struct svc_req *);
#define register_callback ((unsigned long)(15))
extern Registration_Status_3 * _DtCm_register_callback_3(Registration_3 *, _DtCm_Connection *);
extern Registration_Status_3 * _DtCm_register_callback_3_svc(Registration_3 *, struct svc_req *);
#define deregister_callback ((unsigned long)(16))
extern Registration_Status_3 * _DtCm_deregister_callback_3(Registration_3 *, _DtCm_Connection *);
extern Registration_Status_3 * _DtCm_deregister_callback_3_svc(Registration_3 *, struct svc_req *);
#define rtable_set_access ((unsigned long)(17))
extern Access_Status_3 * _DtCm_rtable_set_access_3(Access_Args_3 *, _DtCm_Connection *);
extern Access_Status_3 * _DtCm_rtable_set_access_3_svc(Access_Args_3 *, struct svc_req *);
#define rtable_get_access ((unsigned long)(18))
extern Access_Args_3 * _DtCm_rtable_get_access_3(Access_Args_3 *, _DtCm_Connection *);
extern Access_Args_3 * _DtCm_rtable_get_access_3_svc(Access_Args_3 *, struct svc_req *);
#define rtable_abbreviated_lookup_key_range ((unsigned long)(19))
extern Table_Res_3 * _DtCm_rtable_abbreviated_lookup_key_range_3(Table_Args_3 *, _DtCm_Connection *);
extern Table_Res_3 * _DtCm_rtable_abbreviated_lookup_key_range_3_svc(Table_Args_3 *, struct svc_req *);
#define rtable_gmtoff ((unsigned long)(20))
extern long * _DtCm_rtable_gmtoff_3(void *, _DtCm_Connection *);
extern long * _DtCm_rtable_gmtoff_3_svc(void *, struct svc_req *);
extern int tableprog_3_freeresult(SVCXPRT *, xdrproc_t, caddr_t);
#else /* K&R C */
#define rtable_ping ((unsigned long)(0))
extern void * _DtCm_rtable_ping_3();
extern void * _DtCm_rtable_ping_3_svc();
#define rtable_lookup ((unsigned long)(1))
extern Table_Res_3 * _DtCm_rtable_lookup_3();
extern Table_Res_3 * _DtCm_rtable_lookup_3_svc();
#define rtable_lookup_next_larger ((unsigned long)(2))
extern Table_Res_3 * _DtCm_rtable_lookup_next_larger_3();
extern Table_Res_3 * _DtCm_rtable_lookup_next_larger_3_svc();
#define rtable_lookup_next_smaller ((unsigned long)(3))
extern Table_Res_3 * _DtCm_rtable_lookup_next_smaller_3();
extern Table_Res_3 * _DtCm_rtable_lookup_next_smaller_3_svc();
#define rtable_lookup_range ((unsigned long)(4))
extern Table_Res_3 * _DtCm_rtable_lookup_range_3();
extern Table_Res_3 * _DtCm_rtable_lookup_range_3_svc();
#define rtable_abbreviated_lookup_range ((unsigned long)(5))
extern Table_Res_3 * _DtCm_rtable_abbreviated_lookup_range_3();
extern Table_Res_3 * _DtCm_rtable_abbreviated_lookup_range_3_svc();
#define rtable_insert ((unsigned long)(6))
extern Table_Res_3 * _DtCm_rtable_insert_3();
extern Table_Res_3 * _DtCm_rtable_insert_3_svc();
#define rtable_delete ((unsigned long)(7))
extern Table_Res_3 * _DtCm_rtable_delete_3();
extern Table_Res_3 * _DtCm_rtable_delete_3_svc();
#define rtable_delete_instance ((unsigned long)(8))
extern Table_Res_3 * _DtCm_rtable_delete_instance_3();
extern Table_Res_3 * _DtCm_rtable_delete_instance_3_svc();
#define rtable_change ((unsigned long)(9))
extern Table_Res_3 * _DtCm_rtable_change_3();
extern Table_Res_3 * _DtCm_rtable_change_3_svc();
#define rtable_change_instance ((unsigned long)(10))
extern Table_Res_3 * _DtCm_rtable_change_instance_3();
extern Table_Res_3 * _DtCm_rtable_change_instance_3_svc();
#define rtable_lookup_next_reminder ((unsigned long)(11))
extern Table_Res_3 * _DtCm_rtable_lookup_next_reminder_3();
extern Table_Res_3 * _DtCm_rtable_lookup_next_reminder_3_svc();
#define rtable_check ((unsigned long)(12))
extern Table_Status_3 * _DtCm_rtable_check_3();
extern Table_Status_3 * _DtCm_rtable_check_3_svc();
#define rtable_flush_table ((unsigned long)(13))
extern Table_Status_3 * _DtCm_rtable_flush_table_3();
extern Table_Status_3 * _DtCm_rtable_flush_table_3_svc();
#define rtable_size ((unsigned long)(14))
extern int * _DtCm_rtable_size_3();
extern int * _DtCm_rtable_size_3_svc();
#define register_callback ((unsigned long)(15))
extern Registration_Status_3 * _DtCm_register_callback_3();
extern Registration_Status_3 * _DtCm_register_callback_3_svc();
#define deregister_callback ((unsigned long)(16))
extern Registration_Status_3 * _DtCm_deregister_callback_3();
extern Registration_Status_3 * _DtCm_deregister_callback_3_svc();
#define rtable_set_access ((unsigned long)(17))
extern Access_Status_3 * _DtCm_rtable_set_access_3();
extern Access_Status_3 * _DtCm_rtable_set_access_3_svc();
#define rtable_get_access ((unsigned long)(18))
extern Access_Args_3 * _DtCm_rtable_get_access_3();
extern Access_Args_3 * _DtCm_rtable_get_access_3_svc();
#define rtable_abbreviated_lookup_key_range ((unsigned long)(19))
extern Table_Res_3 * _DtCm_rtable_abbreviated_lookup_key_range_3();
extern Table_Res_3 * _DtCm_rtable_abbreviated_lookup_key_range_3_svc();
#define rtable_gmtoff ((unsigned long)(20))
extern long * _DtCm_rtable_gmtoff_3();
extern long * _DtCm_rtable_gmtoff_3_svc();
extern int tableprog_3_freeresult();
#endif /* K&R C */
/* the xdr functions */
#if defined(__STDC__) || defined(__cplusplus)
extern bool_t _DtCm_xdr_Buffer_3(XDR *, Buffer_3*);
extern bool_t _DtCm_xdr_Transaction_3(XDR *, Transaction_3*);
extern bool_t _DtCm_xdr_Interval_3(XDR *, Interval_3*);
extern bool_t _DtCm_xdr_Period_3(XDR *, Period_3*);
extern bool_t _DtCm_xdr_Event_Type_3(XDR *, Event_Type_3*);
extern bool_t _DtCm_xdr_Tag_3(XDR *, Tag_3*);
extern bool_t _DtCm_xdr_Privacy_Level_3(XDR *, Privacy_Level_3*);
extern bool_t _DtCm_xdr_Attribute_3(XDR *, Attribute_3*);
extern bool_t _DtCm_xdr_Attr_3(XDR *, Attr_3*);
extern bool_t _DtCm_xdr_Except_3(XDR *, Except_3*);
extern bool_t _DtCm_xdr_Exception_3(XDR *, Exception_3*);
extern bool_t _DtCm_xdr_Id_3(XDR *, Id_3*);
extern bool_t _DtCm_xdr_Uid_3(XDR *, Uid_3*);
extern bool_t _DtCm_xdr_Appt_Status_3(XDR *, Appt_Status_3*);
extern bool_t _DtCm_xdr_Appt_3(XDR *, Appt_3*);
extern bool_t _DtCm_xdr_Abb_Appt_3(XDR *, Abb_Appt_3*);
extern bool_t _DtCm_xdr_Apptid_3(XDR *, Apptid_3*);
extern bool_t _DtCm_xdr_Reminder_3(XDR *, Reminder_3*);
extern bool_t _DtCm_xdr_Table_Res_Type_3(XDR *, Table_Res_Type_3*);
extern bool_t _DtCm_xdr_Table_Res_List_3(XDR *, Table_Res_List_3*);
extern bool_t _DtCm_xdr_Access_Status_3(XDR *, Access_Status_3*);
extern bool_t _DtCm_xdr_Table_Res_3(XDR *, Table_Res_3*);
extern bool_t _DtCm_xdr_Access_Entry_3(XDR *, Access_Entry_3*);
extern bool_t _DtCm_xdr_Access_Args_3(XDR *, Access_Args_3*);
extern bool_t _DtCm_xdr_Range_3(XDR *, Range_3*);
extern bool_t _DtCm_xdr_Keyrange_3(XDR *, Keyrange_3*);
extern bool_t _DtCm_xdr_Table_Args_Type_3(XDR *, Table_Args_Type_3*);
extern bool_t _DtCm_xdr_Args_3(XDR *, Args_3*);
extern bool_t _DtCm_xdr_Table_Args_3(XDR *, Table_Args_3*);
extern bool_t _DtCm_xdr_Registration_3(XDR *, Registration_3*);
extern bool_t _DtCm_xdr_Table_Status_3(XDR *, Table_Status_3*);
extern bool_t _DtCm_xdr_Registration_Status_3(XDR *, Registration_Status_3*);
#else /* K&R C */
extern bool_t _DtCm_xdr_Buffer_3();
extern bool_t _DtCm_xdr_Transaction_3();
extern bool_t _DtCm_xdr_Interval_3();
extern bool_t _DtCm_xdr_Period_3();
extern bool_t _DtCm_xdr_Event_Type_3();
extern bool_t _DtCm_xdr_Tag_3();
extern bool_t _DtCm_xdr_Privacy_Level_3();
extern bool_t _DtCm_xdr_Attribute_3();
extern bool_t _DtCm_xdr_Attr_3();
extern bool_t _DtCm_xdr_Except_3();
extern bool_t _DtCm_xdr_Exception_3();
extern bool_t _DtCm_xdr_Id_3();
extern bool_t _DtCm_xdr_Uid_3();
extern bool_t _DtCm_xdr_Appt_Status_3();
extern bool_t _DtCm_xdr_Appt_3();
extern bool_t _DtCm_xdr_Abb_Appt_3();
extern bool_t _DtCm_xdr_Apptid_3();
extern bool_t _DtCm_xdr_Reminder_3();
extern bool_t _DtCm_xdr_Table_Res_Type_3();
extern bool_t _DtCm_xdr_Table_Res_List_3();
extern bool_t _DtCm_xdr_Access_Status_3();
extern bool_t _DtCm_xdr_Table_Res_3();
extern bool_t _DtCm_xdr_Access_Entry_3();
extern bool_t _DtCm_xdr_Access_Args_3();
extern bool_t _DtCm_xdr_Range_3();
extern bool_t _DtCm_xdr_Keyrange_3();
extern bool_t _DtCm_xdr_Table_Args_Type_3();
extern bool_t _DtCm_xdr_Args_3();
extern bool_t _DtCm_xdr_Table_Args_3();
extern bool_t _DtCm_xdr_Registration_3();
extern bool_t _DtCm_xdr_Table_Status_3();
extern bool_t _DtCm_xdr_Registration_Status_3();
#endif /* K&R C */
#ifdef __cplusplus
}
#endif
#ifdef HPUX
#undef hpux
#define hpux
#endif
#endif

236
cde/lib/csa/rtable3.x Normal file
View File

@@ -0,0 +1,236 @@
/* $XConsortium: rtable3.x /main/1 1996/04/21 19:24:37 drk $ */
/*
* (c) Copyright 1996 Digital Equipment Corporation.
* (c) Copyright 1993,1994,1996 Hewlett-Packard Company.
* (c) Copyright 1993,1994,1996 International Business Machines Corp.
* (c) Copyright 1993,1994,1996 Sun Microsystems, Inc.
* (c) Copyright 1993,1994,1996 Novell, Inc.
* (c) Copyright 1996 FUJITSU LIMITED.
* (c) Copyright 1996 Hitachi.
*/
#ifdef RPC_HDR
%#include "connection.h"
%
#endif
typedef string Buffer_3<>;
enum Transaction_3 {
add_3, cm_remove_3
};
enum Interval_3 {
single_3, daily_3, weekly_3, biweekly_3, monthly_3, yearly_3,
nthWeekday_3, everyNthDay_3, everyNthWeek_3,
everyNthMonth_3, otherPeriod_3
};
struct Period_3 {
Interval_3 period;
int nth;
};
enum Event_Type_3 {
appointment_3, reminder_3, otherTag_3, holiday_3, toDo_3
};
struct Tag_3 {
Event_Type_3 tag;
int showtime; /* Advisory for formatting time */
struct Tag_3 *next;
};
enum Privacy_Level_3 {
public_3, private_3, semiprivate_3
};
struct Attribute_3 {
struct Attribute_3 *next;
Buffer_3 attr;
Buffer_3 value;
Buffer_3 clientdata;
};
typedef Attribute_3 *Attr_3;
struct Except_3 {
int ordinal;
struct Except_3 *next;
};
typedef Except_3 *Exception_3;
struct Id_3 {
time_t tick; /* user specified time stored as GMT */
long key; /* system assigned id */
};
struct Uid_3 {
struct Id_3 appt_id;
struct Uid_3 *next;
};
enum Appt_Status_3 {
active_3, pendingAdd_3, pendingDelete_3, committed_3,
cancelled_3, completed_3
};
struct Appt_3 {
struct Id_3 appt_id; /* appointment/repeater id */
struct Tag_3 *tag; /* event type & advisory time display */
int duration; /* appt duration in seconds */
int ntimes; /* n repeat times (0 .. forever) */
Buffer_3 what; /* text of appointment */
struct Period_3 period; /* periodicity of event: single default */
Buffer_3 author; /* user who inserted the appt */
Buffer_3 client_data; /* TBD. */
struct Except_3 *exception; /* list of exceptions to repeating events */
struct Attribute_3 *attr; /* list of reminder attributes */
Appt_Status_3 appt_status;
Privacy_Level_3 privacy;
struct Appt_3 *next; /* next appointment */
};
struct Abb_Appt_3 {
struct Id_3 appt_id;
struct Tag_3 *tag;
Buffer_3 what;
int duration;
struct Period_3 period;
struct Abb_Appt_3 *next;
Appt_Status_3 appt_status;
Privacy_Level_3 privacy;
};
struct Apptid_3 {
struct Id_3 *oid; /* old appt key */
struct Appt_3 *new_appt; /* new appt */
};
struct Reminder_3 {
struct Id_3 appt_id; /* actual appt. key */
time_t tick; /* the happening tick */
Attribute_3 attr; /* (attr, value) */
struct Reminder_3 *next;
};
enum Table_Res_Type_3 {AP_3, RM_3, AB_3, ID_3};
union Table_Res_List_3 switch (Table_Res_Type_3 tag) {
case AP_3:
Appt_3 *a;
case RM_3:
Reminder_3 *r;
case AB_3:
Abb_Appt_3 *b;
case ID_3:
Uid_3 *i;
default:
void;
};
enum Access_Status_3 {
access_ok_3,
access_added_3,
access_removed_3,
access_failed_3,
access_exists_3,
access_partial_3,
access_other_3
};
struct Table_Res_3 {
Access_Status_3 status;
Table_Res_List_3 res;
};
%#define access_none_3 0x0 /* owner only */
%#define access_read_3 0x1
%#define access_write_3 0x2
%#define access_delete_3 0x4
%#define access_exec_3 0x8 /* execution permission is a hack! */
struct Access_Entry_3 {
Buffer_3 who;
int access_type; /* Bit mask from access_read,write,delete */
Access_Entry_3 *next;
};
struct Access_Args_3 {
Buffer_3 target;
Access_Entry_3 *access_list;
};
struct Range_3 {
long key1; /* lower bound tick */
long key2; /* upper bound tick */
struct Range_3 *next;
};
struct Keyrange_3 {
long key; /* key of appt */
time_t tick1; /* lower bound tick */
time_t tick2; /* upper bound tick */
struct Keyrange_3 *next;
};
enum Table_Args_Type_3 {TICK_3, APPTID_3, UID_3, APPT_3, RANGE_3, KEYRANGE_3};
union Args_3 switch (Table_Args_Type_3 tag) {
case TICK_3:
time_t tick;
case APPTID_3:
Apptid_3 apptid;
case UID_3:
Uid_3 *key;
case APPT_3:
Appt_3 *appt;
case RANGE_3:
Range_3 *range;
case KEYRANGE_3:
Keyrange_3 *keyrange;
};
struct Table_Args_3 {
Buffer_3 target;
Args_3 args;
int pid;
};
struct Registration_3 {
Buffer_3 target;
u_long prognum;
u_long versnum;
u_long procnum;
struct Registration_3 *next;
int pid;
};
enum Table_Status_3 {ok_3, duplicate_3, badtable_3, notable_3, denied_3, other_3};
enum Registration_Status_3 {registered_3, failed_3, deregistered_3, confused_3};
program TABLEPROG {
version TABLEVERS_3 {
void rtable_ping(void)=0;
Table_Res_3 rtable_lookup(Table_Args_3) = 1;
Table_Res_3 rtable_lookup_next_larger(Table_Args_3) = 2;
Table_Res_3 rtable_lookup_next_smaller(Table_Args_3) = 3;
Table_Res_3 rtable_lookup_range(Table_Args_3) = 4;
Table_Res_3 rtable_abbreviated_lookup_range(Table_Args_3) = 5;
Table_Res_3 rtable_insert(Table_Args_3) = 6;
Table_Res_3 rtable_delete(Table_Args_3) = 7;
Table_Res_3 rtable_delete_instance(Table_Args_3) = 8;
Table_Res_3 rtable_change(Table_Args_3) = 9;
Table_Res_3 rtable_change_instance(Table_Args_3) = 10;
Table_Res_3 rtable_lookup_next_reminder(Table_Args_3) = 11;
Table_Status_3 rtable_check(Table_Args_3) = 12;
Table_Status_3 rtable_flush_table(Table_Args_3) = 13;
int rtable_size(Table_Args_3) = 14;
Registration_Status_3 register_callback(Registration_3) = 15;
Registration_Status_3 deregister_callback(Registration_3) = 16;
Access_Status_3 rtable_set_access(Access_Args_3) = 17;
Access_Args_3 rtable_get_access(Access_Args_3) = 18;
Table_Res_3 rtable_abbreviated_lookup_key_range(Table_Args_3) = 19;
long rtable_gmtoff(void) = 20;
} = 3;
} = 100068;

583
cde/lib/csa/rtable4.h Normal file
View File

@@ -0,0 +1,583 @@
/*******************************************************************************
**
** rtable4.h
**
** $TOG: rtable4.h /main/3 1999/10/14 17:48:06 mgreess $
**
** RESTRICTED CONFIDENTIAL INFORMATION:
**
** The information in this document is subject to special
** restrictions in a confidential disclosure agreement between
** HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
** document outside HP, IBM, Sun, USL, SCO, or Univel without
** Sun's specific written approval. This document and all copies
** and derivative works thereof must be returned or destroyed at
** Sun's request.
**
** (c) Copyright 1996 Digital Equipment Corporation.
** (c) Copyright 1996 Hewlett-Packard Company.
** (c) Copyright 1996 International Business Machines Corp.
** (c) Copyright 1993,1996 Sun Microsystems, Inc.
** (c) Copyright 1996 Novell, Inc.
** (c) Copyright 1996 FUJITSU LIMITED.
** (c) Copyright 1996 Hitachi.
**
*******************************************************************************/
#ifndef _RTABLE4_H
#define _RTABLE4_H
#ifndef SunOS
#include <rpc/types.h>
#endif
#include <rpc/rpc.h>
#ifdef __cplusplus
extern "C" {
#endif
#include "connection.h"
extern bool_t xdr_time_t();
typedef char *Buffer_4;
enum Interval_4 {
single_4 = 0,
daily_4 = 1,
weekly_4 = 2,
biweekly_4 = 3,
monthly_4 = 4,
yearly_4 = 5,
nthWeekday_4 = 6,
everyNthDay_4 = 7,
everyNthWeek_4 = 8,
everyNthMonth_4 = 9,
otherPeriod_4 = 10,
monThruFri_4 = 11,
monWedFri_4 = 12,
tueThur_4 = 13,
daysOfWeek_4 = 14
};
typedef enum Interval_4 Interval_4;
struct Period_4 {
Interval_4 period;
int nth;
time_t enddate;
};
typedef struct Period_4 Period_4;
enum Event_Type_4 {
appointment_4 = 0,
reminder_4 = 1,
otherTag_4 = 2,
holiday_4 = 3,
toDo_4 = 4
};
typedef enum Event_Type_4 Event_Type_4;
enum Options_4 {
do_all_4 = 0,
do_one_4 = 1,
do_forward_4 = 2
};
typedef enum Options_4 Options_4;
struct Tag_4 {
Event_Type_4 tag;
int showtime;
struct Tag_4 *next;
};
typedef struct Tag_4 Tag_4;
enum Privacy_Level_4 {
public_4 = 0,
private_4 = 1,
semiprivate_4 = 2
};
typedef enum Privacy_Level_4 Privacy_Level_4;
struct Attribute_4 {
struct Attribute_4 *next;
Buffer_4 attr;
Buffer_4 value;
Buffer_4 clientdata;
};
typedef struct Attribute_4 Attribute_4;
typedef Attribute_4 *Attr_4;
struct Except_4 {
int ordinal;
struct Except_4 *next;
};
typedef struct Except_4 Except_4;
typedef Except_4 *Exception_4;
struct Id_4 {
time_t tick;
long key;
};
typedef struct Id_4 Id_4;
struct Uid_4 {
struct Id_4 appt_id;
struct Uid_4 *next;
};
typedef struct Uid_4 Uid_4;
enum Appt_Status_4 {
active_4 = 0,
pendingAdd_4 = 1,
pendingDelete_4 = 2,
committed_4 = 3,
cancelled_4 = 4,
completed_4 = 5
};
typedef enum Appt_Status_4 Appt_Status_4;
struct Appt_4 {
struct Id_4 appt_id;
struct Tag_4 *tag;
int duration;
int ntimes;
Buffer_4 what;
struct Period_4 period;
Buffer_4 author;
Buffer_4 client_data;
struct Except_4 *exception;
struct Attribute_4 *attr;
Appt_Status_4 appt_status;
Privacy_Level_4 privacy;
struct Appt_4 *next;
};
typedef struct Appt_4 Appt_4;
struct Abb_Appt_4 {
struct Id_4 appt_id;
struct Tag_4 *tag;
Buffer_4 what;
int duration;
struct Period_4 period;
struct Abb_Appt_4 *next;
Appt_Status_4 appt_status;
Privacy_Level_4 privacy;
};
typedef struct Abb_Appt_4 Abb_Appt_4;
struct Apptid_4 {
struct Id_4 *oid;
struct Appt_4 *new_appt;
Options_4 option;
};
typedef struct Apptid_4 Apptid_4;
struct Reminder_4 {
struct Id_4 appt_id;
time_t tick;
Attribute_4 attr;
struct Reminder_4 *next;
};
typedef struct Reminder_4 Reminder_4;
enum Table_Res_Type_4 {
AP_4 = 0,
RM_4 = 1,
AB_4 = 2,
ID_4 = 3
};
typedef enum Table_Res_Type_4 Table_Res_Type_4;
struct Table_Res_List_4 {
Table_Res_Type_4 tag;
union {
Appt_4 *a;
Reminder_4 *r;
Abb_Appt_4 *b;
Uid_4 *i;
} Table_Res_List_4_u;
};
typedef struct Table_Res_List_4 Table_Res_List_4;
enum Access_Status_4 {
access_ok_4 = 0,
access_added_4 = 1,
access_removed_4 = 2,
access_failed_4 = 3,
access_exists_4 = 4,
access_partial_4 = 5,
access_other_4 = 6,
access_notable_4 = 7,
access_notsupported_4 = 8,
access_incomplete_4 = 9
};
typedef enum Access_Status_4 Access_Status_4;
struct Table_Res_4 {
Access_Status_4 status;
Table_Res_List_4 res;
};
typedef struct Table_Res_4 Table_Res_4;
#define access_none_4 0x0 /* owner only */
#define access_read_4 0x1
#define access_write_4 0x2
#define access_delete_4 0x4
#define access_exec_4 0x8 /* execution permission is a hack! */
#define WORLD "world" /* special user */
struct Access_Entry_4 {
Buffer_4 who;
int access_type;
struct Access_Entry_4 *next;
};
typedef struct Access_Entry_4 Access_Entry_4;
struct Access_Args_4 {
Buffer_4 target;
Access_Entry_4 *access_list;
};
typedef struct Access_Args_4 Access_Args_4;
struct Range_4 {
long key1;
long key2;
struct Range_4 *next;
};
typedef struct Range_4 Range_4;
struct Keyrange_4 {
long key;
time_t tick1;
time_t tick2;
struct Keyrange_4 *next;
};
typedef struct Keyrange_4 Keyrange_4;
struct Uidopt_4 {
struct Id_4 appt_id;
Options_4 option;
struct Uidopt_4 *next;
};
typedef struct Uidopt_4 Uidopt_4;
enum Table_Args_Type_4 {
TICK_4 = 0,
APPTID_4 = 1,
UID_4 = 2,
APPT_4 = 3,
RANGE_4 = 4,
KEYRANGE_4 = 5,
UIDOPT_4 = 6
};
typedef enum Table_Args_Type_4 Table_Args_Type_4;
struct Args_4 {
Table_Args_Type_4 tag;
union {
time_t tick;
Apptid_4 apptid;
Uid_4 *key;
Appt_4 *appt;
Range_4 *range;
Keyrange_4 *keyrange;
Uidopt_4 *uidopt;
} Args_4_u;
};
typedef struct Args_4 Args_4;
struct Table_Args_4 {
Buffer_4 target;
Args_4 args;
int pid;
};
typedef struct Table_Args_4 Table_Args_4;
struct Registration_4 {
Buffer_4 target;
u_long prognum;
u_long versnum;
u_long procnum;
struct Registration_4 *next;
int pid;
};
typedef struct Registration_4 Registration_4;
struct Table_Op_Args_4 {
Buffer_4 target;
Buffer_4 new_target;
};
typedef struct Table_Op_Args_4 Table_Op_Args_4;
enum Table_Status_4 {
ok_4 = 0,
duplicate_4 = 1,
badtable_4 = 2,
notable_4 = 3,
denied_4 = 4,
other_4 = 5,
tbl_not_owner_4 = 6,
tbl_exist_4 = 7,
tbl_notsupported_4 = 8
};
typedef enum Table_Status_4 Table_Status_4;
enum Registration_Status_4 {
registered_4 = 0,
failed_4 = 1,
deregistered_4 = 2,
confused_4 = 3,
reg_notable_4 = 4
};
typedef enum Registration_Status_4 Registration_Status_4;
/*
* rtable_delete and rtable_change take over the functionality of
* rtable_delete_instance and rtable_change_instance repectively.
* rtable_delete_instance and rtable_change_instance are now dummy
* routines exist for backward compatibility purpose and return
* access_notsupported.
*/
#define TABLEPROG ((unsigned long)(100068))
#define TABLEVERS_4 ((unsigned long)(4))
#if defined(__STDC__) || defined(__cplusplus)
#define rtable_ping ((unsigned long)(0))
extern void * _DtCm_rtable_ping_4(void *, _DtCm_Connection *);
extern void * _DtCm_rtable_ping_4_svc(void *, struct svc_req *);
#define rtable_lookup ((unsigned long)(1))
extern Table_Res_4 * _DtCm_rtable_lookup_4(Table_Args_4 *, _DtCm_Connection *);
extern Table_Res_4 * _DtCm_rtable_lookup_4_svc(Table_Args_4 *, struct svc_req *);
#define rtable_lookup_next_larger ((unsigned long)(2))
extern Table_Res_4 * _DtCm_rtable_lookup_next_larger_4(Table_Args_4 *, _DtCm_Connection *);
extern Table_Res_4 * _DtCm_rtable_lookup_next_larger_4_svc(Table_Args_4 *, struct svc_req *);
#define rtable_lookup_next_smaller ((unsigned long)(3))
extern Table_Res_4 * _DtCm_rtable_lookup_next_smaller_4(Table_Args_4 *, _DtCm_Connection *);
extern Table_Res_4 * _DtCm_rtable_lookup_next_smaller_4_svc(Table_Args_4 *, struct svc_req *);
#define rtable_lookup_range ((unsigned long)(4))
extern Table_Res_4 * _DtCm_rtable_lookup_range_4(Table_Args_4 *, _DtCm_Connection *);
extern Table_Res_4 * _DtCm_rtable_lookup_range_4_svc(Table_Args_4 *, struct svc_req *);
#define rtable_abbreviated_lookup_range ((unsigned long)(5))
extern Table_Res_4 * _DtCm_rtable_abbreviated_lookup_range_4(Table_Args_4 *, _DtCm_Connection *);
extern Table_Res_4 * _DtCm_rtable_abbreviated_lookup_range_4_svc(Table_Args_4 *, struct svc_req *);
#define rtable_insert ((unsigned long)(6))
extern Table_Res_4 * _DtCm_rtable_insert_4(Table_Args_4 *, _DtCm_Connection *);
extern Table_Res_4 * _DtCm_rtable_insert_4_svc(Table_Args_4 *, struct svc_req *);
#define rtable_delete ((unsigned long)(7))
extern Table_Res_4 * _DtCm_rtable_delete_4(Table_Args_4 *, _DtCm_Connection *);
extern Table_Res_4 * _DtCm_rtable_delete_4_svc(Table_Args_4 *, struct svc_req *);
#define rtable_delete_instance ((unsigned long)(8))
extern Table_Res_4 * _DtCm_rtable_delete_instance_4(Table_Args_4 *, _DtCm_Connection *);
extern Table_Res_4 * _DtCm_rtable_delete_instance_4_svc(Table_Args_4 *, struct svc_req *);
#define rtable_change ((unsigned long)(9))
extern Table_Res_4 * _DtCm_rtable_change_4(Table_Args_4 *, _DtCm_Connection *);
extern Table_Res_4 * _DtCm_rtable_change_4_svc(Table_Args_4 *, struct svc_req *);
#define rtable_change_instance ((unsigned long)(10))
extern Table_Res_4 * _DtCm_rtable_change_instance_4(Table_Args_4 *, _DtCm_Connection *);
extern Table_Res_4 * _DtCm_rtable_change_instance_4_svc(Table_Args_4 *, struct svc_req *);
#define rtable_lookup_next_reminder ((unsigned long)(11))
extern Table_Res_4 * _DtCm_rtable_lookup_next_reminder_4(Table_Args_4 *, _DtCm_Connection *);
extern Table_Res_4 * _DtCm_rtable_lookup_next_reminder_4_svc(Table_Args_4 *, struct svc_req *);
#define rtable_check ((unsigned long)(12))
extern Table_Status_4 * _DtCm_rtable_check_4(Table_Args_4 *, _DtCm_Connection *);
extern Table_Status_4 * _DtCm_rtable_check_4_svc(Table_Args_4 *, struct svc_req *);
#define rtable_flush_table ((unsigned long)(13))
extern Table_Status_4 * _DtCm_rtable_flush_table_4(Table_Args_4 *, _DtCm_Connection *);
extern Table_Status_4 * _DtCm_rtable_flush_table_4_svc(Table_Args_4 *, struct svc_req *);
#define rtable_size ((unsigned long)(14))
extern int * _DtCm_rtable_size_4(Table_Args_4 *, _DtCm_Connection *);
extern int * _DtCm_rtable_size_4_svc(Table_Args_4 *, struct svc_req *);
#define register_callback ((unsigned long)(15))
extern Registration_Status_4 * _DtCm_register_callback_4(Registration_4 *, _DtCm_Connection *);
extern Registration_Status_4 * _DtCm_register_callback_4_svc(Registration_4 *, struct svc_req *);
#define deregister_callback ((unsigned long)(16))
extern Registration_Status_4 * _DtCm_deregister_callback_4(Registration_4 *, _DtCm_Connection *);
extern Registration_Status_4 * _DtCm_deregister_callback_4_svc(Registration_4 *, struct svc_req *);
#define rtable_set_access ((unsigned long)(17))
extern Access_Status_4 * _DtCm_rtable_set_access_4(Access_Args_4 *, _DtCm_Connection *);
extern Access_Status_4 * _DtCm_rtable_set_access_4_svc(Access_Args_4 *, struct svc_req *);
#define rtable_get_access ((unsigned long)(18))
extern Access_Args_4 * _DtCm_rtable_get_access_4(Access_Args_4 *, _DtCm_Connection *);
extern Access_Args_4 * _DtCm_rtable_get_access_4_svc(Access_Args_4 *, struct svc_req *);
#define rtable_abbreviated_lookup_key_range ((unsigned long)(19))
extern Table_Res_4 * _DtCm_rtable_abbreviated_lookup_key_range_4(Table_Args_4 *, _DtCm_Connection *);
extern Table_Res_4 * _DtCm_rtable_abbreviated_lookup_key_range_4_svc(Table_Args_4 *, struct svc_req *);
#define rtable_gmtoff ((unsigned long)(20))
extern long * _DtCm_rtable_gmtoff_4(void *, _DtCm_Connection *);
extern long * _DtCm_rtable_gmtoff_4_svc(void *, struct svc_req *);
#define rtable_create ((unsigned long)(21))
extern Table_Status_4 * _DtCm_rtable_create_4(Table_Op_Args_4 *, _DtCm_Connection *);
extern Table_Status_4 * _DtCm_rtable_create_4_svc(Table_Op_Args_4 *, struct svc_req *);
#define rtable_remove ((unsigned long)(22))
extern Table_Status_4 * _DtCm_rtable_remove_4(Table_Op_Args_4 *, _DtCm_Connection *);
extern Table_Status_4 * _DtCm_rtable_remove_4_svc(Table_Op_Args_4 *, struct svc_req *);
#define rtable_rename ((unsigned long)(23))
extern Table_Status_4 * _DtCm_rtable_rename_4(Table_Op_Args_4 *, _DtCm_Connection *);
extern Table_Status_4 * _DtCm_rtable_rename_4_svc(Table_Op_Args_4 *, struct svc_req *);
extern int tableprog_4_freeresult(SVCXPRT *, xdrproc_t, caddr_t);
#else /* K&R C */
#define rtable_ping ((unsigned long)(0))
extern void * _DtCm_rtable_ping_4();
extern void * _DtCm_rtable_ping_4_svc();
#define rtable_lookup ((unsigned long)(1))
extern Table_Res_4 * _DtCm_rtable_lookup_4();
extern Table_Res_4 * _DtCm_rtable_lookup_4_svc();
#define rtable_lookup_next_larger ((unsigned long)(2))
extern Table_Res_4 * _DtCm_rtable_lookup_next_larger_4();
extern Table_Res_4 * _DtCm_rtable_lookup_next_larger_4_svc();
#define rtable_lookup_next_smaller ((unsigned long)(3))
extern Table_Res_4 * _DtCm_rtable_lookup_next_smaller_4();
extern Table_Res_4 * _DtCm_rtable_lookup_next_smaller_4_svc();
#define rtable_lookup_range ((unsigned long)(4))
extern Table_Res_4 * _DtCm_rtable_lookup_range_4();
extern Table_Res_4 * _DtCm_rtable_lookup_range_4_svc();
#define rtable_abbreviated_lookup_range ((unsigned long)(5))
extern Table_Res_4 * _DtCm_rtable_abbreviated_lookup_range_4();
extern Table_Res_4 * _DtCm_rtable_abbreviated_lookup_range_4_svc();
#define rtable_insert ((unsigned long)(6))
extern Table_Res_4 * _DtCm_rtable_insert_4();
extern Table_Res_4 * _DtCm_rtable_insert_4_svc();
#define rtable_delete ((unsigned long)(7))
extern Table_Res_4 * _DtCm_rtable_delete_4();
extern Table_Res_4 * _DtCm_rtable_delete_4_svc();
#define rtable_delete_instance ((unsigned long)(8))
extern Table_Res_4 * _DtCm_rtable_delete_instance_4();
extern Table_Res_4 * _DtCm_rtable_delete_instance_4_svc();
#define rtable_change ((unsigned long)(9))
extern Table_Res_4 * _DtCm_rtable_change_4();
extern Table_Res_4 * _DtCm_rtable_change_4_svc();
#define rtable_change_instance ((unsigned long)(10))
extern Table_Res_4 * _DtCm_rtable_change_instance_4();
extern Table_Res_4 * _DtCm_rtable_change_instance_4_svc();
#define rtable_lookup_next_reminder ((unsigned long)(11))
extern Table_Res_4 * _DtCm_rtable_lookup_next_reminder_4();
extern Table_Res_4 * _DtCm_rtable_lookup_next_reminder_4_svc();
#define rtable_check ((unsigned long)(12))
extern Table_Status_4 * _DtCm_rtable_check_4();
extern Table_Status_4 * _DtCm_rtable_check_4_svc();
#define rtable_flush_table ((unsigned long)(13))
extern Table_Status_4 * _DtCm_rtable_flush_table_4();
extern Table_Status_4 * _DtCm_rtable_flush_table_4_svc();
#define rtable_size ((unsigned long)(14))
extern int * _DtCm_rtable_size_4();
extern int * _DtCm_rtable_size_4_svc();
#define register_callback ((unsigned long)(15))
extern Registration_Status_4 * _DtCm_register_callback_4();
extern Registration_Status_4 * _DtCm_register_callback_4_svc();
#define deregister_callback ((unsigned long)(16))
extern Registration_Status_4 * _DtCm_deregister_callback_4();
extern Registration_Status_4 * _DtCm_deregister_callback_4_svc();
#define rtable_set_access ((unsigned long)(17))
extern Access_Status_4 * _DtCm_rtable_set_access_4();
extern Access_Status_4 * _DtCm_rtable_set_access_4_svc();
#define rtable_get_access ((unsigned long)(18))
extern Access_Args_4 * _DtCm_rtable_get_access_4();
extern Access_Args_4 * _DtCm_rtable_get_access_4_svc();
#define rtable_abbreviated_lookup_key_range ((unsigned long)(19))
extern Table_Res_4 * _DtCm_rtable_abbreviated_lookup_key_range_4();
extern Table_Res_4 * _DtCm_rtable_abbreviated_lookup_key_range_4_svc();
#define rtable_gmtoff ((unsigned long)(20))
extern long * _DtCm_rtable_gmtoff_4();
extern long * _DtCm_rtable_gmtoff_4_svc();
#define rtable_create ((unsigned long)(21))
extern Table_Status_4 * _DtCm_rtable_create_4();
extern Table_Status_4 * _DtCm_rtable_create_4_svc();
#define rtable_remove ((unsigned long)(22))
extern Table_Status_4 * _DtCm_rtable_remove_4();
extern Table_Status_4 * _DtCm_rtable_remove_4_svc();
#define rtable_rename ((unsigned long)(23))
extern Table_Status_4 * _DtCm_rtable_rename_4();
extern Table_Status_4 * _DtCm_rtable_rename_4_svc();
extern int tableprog_4_freeresult();
#endif /* K&R C */
/* the xdr functions */
#if defined(__STDC__) || defined(__cplusplus)
extern bool_t _DtCm_xdr_Buffer_4(XDR *, Buffer_4*);
extern bool_t _DtCm_xdr_Interval_4(XDR *, Interval_4*);
extern bool_t _DtCm_xdr_Period_4(XDR *, Period_4*);
extern bool_t _DtCm_xdr_Event_Type_4(XDR *, Event_Type_4*);
extern bool_t _DtCm_xdr_Options_4(XDR *, Options_4*);
extern bool_t _DtCm_xdr_Tag_4(XDR *, Tag_4*);
extern bool_t _DtCm_xdr_Privacy_Level_4(XDR *, Privacy_Level_4*);
extern bool_t _DtCm_xdr_Attribute_4(XDR *, Attribute_4*);
extern bool_t _DtCm_xdr_Attr_4(XDR *, Attr_4*);
extern bool_t _DtCm_xdr_Except_4(XDR *, Except_4*);
extern bool_t _DtCm_xdr_Exception_4(XDR *, Exception_4*);
extern bool_t _DtCm_xdr_Id_4(XDR *, Id_4*);
extern bool_t _DtCm_xdr_Uid_4(XDR *, Uid_4*);
extern bool_t _DtCm_xdr_Appt_Status_4(XDR *, Appt_Status_4*);
extern bool_t _DtCm_xdr_Appt_4(XDR *, Appt_4*);
extern bool_t _DtCm_xdr_Abb_Appt_4(XDR *, Abb_Appt_4*);
extern bool_t _DtCm_xdr_Apptid_4(XDR *, Apptid_4*);
extern bool_t _DtCm_xdr_Reminder_4(XDR *, Reminder_4*);
extern bool_t _DtCm_xdr_Table_Res_Type_4(XDR *, Table_Res_Type_4*);
extern bool_t _DtCm_xdr_Table_Res_List_4(XDR *, Table_Res_List_4*);
extern bool_t _DtCm_xdr_Access_Status_4(XDR *, Access_Status_4*);
extern bool_t _DtCm_xdr_Table_Res_4(XDR *, Table_Res_4*);
extern bool_t _DtCm_xdr_Access_Entry_4(XDR *, Access_Entry_4*);
extern bool_t _DtCm_xdr_Access_Args_4(XDR *, Access_Args_4*);
extern bool_t _DtCm_xdr_Range_4(XDR *, Range_4*);
extern bool_t _DtCm_xdr_Keyrange_4(XDR *, Keyrange_4*);
extern bool_t _DtCm_xdr_Uidopt_4(XDR *, Uidopt_4*);
extern bool_t _DtCm_xdr_Table_Args_Type_4(XDR *, Table_Args_Type_4*);
extern bool_t _DtCm_xdr_Args_4(XDR *, Args_4*);
extern bool_t _DtCm_xdr_Table_Args_4(XDR *, Table_Args_4*);
extern bool_t _DtCm_xdr_Registration_4(XDR *, Registration_4*);
extern bool_t _DtCm_xdr_Table_Op_Args_4(XDR *, Table_Op_Args_4*);
extern bool_t _DtCm_xdr_Table_Status_4(XDR *, Table_Status_4*);
extern bool_t _DtCm_xdr_Registration_Status_4(XDR *, Registration_Status_4*);
#else /* K&R C */
extern bool_t _DtCm_xdr_Buffer_4();
extern bool_t _DtCm_xdr_Interval_4();
extern bool_t _DtCm_xdr_Period_4();
extern bool_t _DtCm_xdr_Event_Type_4();
extern bool_t _DtCm_xdr_Options_4();
extern bool_t _DtCm_xdr_Tag_4();
extern bool_t _DtCm_xdr_Privacy_Level_4();
extern bool_t _DtCm_xdr_Attribute_4();
extern bool_t _DtCm_xdr_Attr_4();
extern bool_t _DtCm_xdr_Except_4();
extern bool_t _DtCm_xdr_Exception_4();
extern bool_t _DtCm_xdr_Id_4();
extern bool_t _DtCm_xdr_Uid_4();
extern bool_t _DtCm_xdr_Appt_Status_4();
extern bool_t _DtCm_xdr_Appt_4();
extern bool_t _DtCm_xdr_Abb_Appt_4();
extern bool_t _DtCm_xdr_Apptid_4();
extern bool_t _DtCm_xdr_Reminder_4();
extern bool_t _DtCm_xdr_Table_Res_Type_4();
extern bool_t _DtCm_xdr_Table_Res_List_4();
extern bool_t _DtCm_xdr_Access_Status_4();
extern bool_t _DtCm_xdr_Table_Res_4();
extern bool_t _DtCm_xdr_Access_Entry_4();
extern bool_t _DtCm_xdr_Access_Args_4();
extern bool_t _DtCm_xdr_Range_4();
extern bool_t _DtCm_xdr_Keyrange_4();
extern bool_t _DtCm_xdr_Uidopt_4();
extern bool_t _DtCm_xdr_Table_Args_Type_4();
extern bool_t _DtCm_xdr_Args_4();
extern bool_t _DtCm_xdr_Table_Args_4();
extern bool_t _DtCm_xdr_Registration_4();
extern bool_t _DtCm_xdr_Table_Op_Args_4();
extern bool_t _DtCm_xdr_Table_Status_4();
extern bool_t _DtCm_xdr_Registration_Status_4();
#endif /* K&R C */
#ifdef __cplusplus
}
#endif
#ifdef HPUX
#undef hpux
#define hpux
#endif
#endif

270
cde/lib/csa/rtable4.x Normal file
View File

@@ -0,0 +1,270 @@
/* $XConsortium: rtable4.x /main/1 1996/04/21 19:24:43 drk $ */
/*
* (c) Copyright 1996 Digital Equipment Corporation.
* (c) Copyright 1993,1994,1996 Hewlett-Packard Company.
* (c) Copyright 1993,1994,1996 International Business Machines Corp.
* (c) Copyright 1993,1994,1996 Sun Microsystems, Inc.
* (c) Copyright 1993,1994,1996 Novell, Inc.
* (c) Copyright 1996 FUJITSU LIMITED.
* (c) Copyright 1996 Hitachi.
*/
#ifdef RPC_HDR
%#include "connection.h"
%
#endif
typedef string Buffer_4<>;
enum Interval_4 {
single_4, daily_4, weekly_4, biweekly_4, monthly_4, yearly_4,
nthWeekday_4, everyNthDay_4, everyNthWeek_4,
everyNthMonth_4, otherPeriod_4,
monThruFri_4, monWedFri_4, tueThur_4, daysOfWeek_4
};
struct Period_4 {
Interval_4 period;
int nth;
time_t enddate;
};
enum Event_Type_4 {
appointment_4, reminder_4, otherTag_4, holiday_4, toDo_4
};
enum Options_4 {
do_all_4, do_one_4, do_forward_4
};
struct Tag_4 {
Event_Type_4 tag;
int showtime; /* Advisory for formatting time */
struct Tag_4 *next;
};
enum Privacy_Level_4 {
public_4, private_4, semiprivate_4
};
struct Attribute_4 {
struct Attribute_4 *next;
Buffer_4 attr;
Buffer_4 value;
Buffer_4 clientdata;
};
typedef Attribute_4 *Attr_4;
struct Except_4 {
int ordinal;
struct Except_4 *next;
};
typedef Except_4 *Exception_4;
struct Id_4 {
time_t tick; /* user specified time stored as GMT */
long key; /* system assigned id */
};
struct Uid_4 {
struct Id_4 appt_id;
struct Uid_4 *next;
};
enum Appt_Status_4 {
active_4, pendingAdd_4, pendingDelete_4, committed_4,
cancelled_4, completed_4
};
struct Appt_4 {
struct Id_4 appt_id; /* appointment/repeater id */
struct Tag_4 *tag; /* event type & advisory time display */
int duration; /* appt duration in seconds */
int ntimes; /* n repeat times (0 .. forever) */
Buffer_4 what; /* text of appointment */
struct Period_4 period; /* periodicity of event: single default */
Buffer_4 author; /* user who inserted the appt */
Buffer_4 client_data; /* TBD. */
struct Except_4 *exception; /* list of exceptions to repeating events */
struct Attribute_4 *attr; /* list of reminder attributes */
Appt_Status_4 appt_status;
Privacy_Level_4 privacy;
struct Appt_4 *next; /* next appointment */
};
struct Abb_Appt_4 {
struct Id_4 appt_id;
struct Tag_4 *tag;
Buffer_4 what;
int duration;
struct Period_4 period;
struct Abb_Appt_4 *next;
Appt_Status_4 appt_status;
Privacy_Level_4 privacy;
};
struct Apptid_4 {
struct Id_4 *oid; /* old appt key */
struct Appt_4 *new_appt; /* new appt */
Options_4 option;
};
struct Reminder_4 {
struct Id_4 appt_id; /* actual appt. key */
time_t tick; /* the happening tick */
Attribute_4 attr; /* (attr, value) */
struct Reminder_4 *next;
};
enum Table_Res_Type_4 {AP_4, RM_4, AB_4, ID_4};
union Table_Res_List_4 switch (Table_Res_Type_4 tag) {
case AP_4:
Appt_4 *a;
case RM_4:
Reminder_4 *r;
case AB_4:
Abb_Appt_4 *b;
case ID_4:
Uid_4 *i;
default:
void;
};
enum Access_Status_4 {
access_ok_4,
access_added_4,
access_removed_4,
access_failed_4,
access_exists_4,
access_partial_4,
access_other_4,
access_notable_4,
access_notsupported_4,
access_incomplete_4
};
struct Table_Res_4 {
Access_Status_4 status;
Table_Res_List_4 res;
};
%#define access_none_4 0x0 /* owner only */
%#define access_read_4 0x1
%#define access_write_4 0x2
%#define access_delete_4 0x4
%#define access_exec_4 0x8 /* execution permission is a hack! */
%#define WORLD "world" /* special user */
struct Access_Entry_4 {
Buffer_4 who;
int access_type; /* Bit mask from access_read,write,delete */
Access_Entry_4 *next;
};
struct Access_Args_4 {
Buffer_4 target;
Access_Entry_4 *access_list;
};
struct Range_4 {
long key1; /* lower bound tick */
long key2; /* upper bound tick */
struct Range_4 *next;
};
struct Keyrange_4 {
long key; /* key of appt */
time_t tick1; /* lower bound tick */
time_t tick2; /* upper bound tick */
struct Keyrange_4 *next;
};
struct Uidopt_4 {
struct Id_4 appt_id;
Options_4 option;
struct Uidopt_4 *next;
};
enum Table_Args_Type_4 {TICK_4, APPTID_4, UID_4, APPT_4, RANGE_4,
KEYRANGE_4, UIDOPT_4};
union Args_4 switch (Table_Args_Type_4 tag) {
case TICK_4:
time_t tick;
case APPTID_4:
Apptid_4 apptid;
case UID_4:
Uid_4 *key;
case APPT_4:
Appt_4 *appt;
case RANGE_4:
Range_4 *range;
case KEYRANGE_4:
Keyrange_4 *keyrange;
case UIDOPT_4:
Uidopt_4 *uidopt;
};
struct Table_Args_4 {
Buffer_4 target;
Args_4 args;
int pid;
};
struct Registration_4 {
Buffer_4 target;
u_long prognum;
u_long versnum;
u_long procnum;
struct Registration_4 *next;
int pid;
};
struct Table_Op_Args_4 {
Buffer_4 target;
Buffer_4 new_target;
};
enum Table_Status_4 {ok_4, duplicate_4, badtable_4, notable_4, denied_4,
other_4, tbl_not_owner_4, tbl_exist_4, tbl_notsupported_4};
enum Registration_Status_4 {registered_4, failed_4, deregistered_4,
confused_4, reg_notable_4};
%
%/*
% * rtable_delete and rtable_change take over the functionality of
% * rtable_delete_instance and rtable_change_instance repectively.
% * rtable_delete_instance and rtable_change_instance are now dummy
% * routines exist for backward compatibility purpose and return
% * access_notsupported.
% */
program TABLEPROG {
version TABLEVERS_4 {
void rtable_ping(void)=0;
Table_Res_4 rtable_lookup(Table_Args_4) = 1;
Table_Res_4 rtable_lookup_next_larger(Table_Args_4) = 2;
Table_Res_4 rtable_lookup_next_smaller(Table_Args_4) = 3;
Table_Res_4 rtable_lookup_range(Table_Args_4) = 4;
Table_Res_4 rtable_abbreviated_lookup_range(Table_Args_4) = 5;
Table_Res_4 rtable_insert(Table_Args_4) = 6;
Table_Res_4 rtable_delete(Table_Args_4) = 7;
Table_Res_4 rtable_delete_instance(Table_Args_4) = 8;
Table_Res_4 rtable_change(Table_Args_4) = 9;
Table_Res_4 rtable_change_instance(Table_Args_4) = 10;
Table_Res_4 rtable_lookup_next_reminder(Table_Args_4) = 11;
Table_Status_4 rtable_check(Table_Args_4) = 12;
Table_Status_4 rtable_flush_table(Table_Args_4) = 13;
int rtable_size(Table_Args_4) = 14;
Registration_Status_4 register_callback(Registration_4) = 15;
Registration_Status_4 deregister_callback(Registration_4) = 16;
Access_Status_4 rtable_set_access(Access_Args_4) = 17;
Access_Args_4 rtable_get_access(Access_Args_4) = 18;
Table_Res_4 rtable_abbreviated_lookup_key_range(Table_Args_4) = 19;
long rtable_gmtoff(void) = 20;
Table_Status_4 rtable_create(Table_Op_Args_4) = 21;
Table_Status_4 rtable_remove(Table_Op_Args_4) = 22;
Table_Status_4 rtable_rename(Table_Op_Args_4) = 23;
} = 4;
} = 100068;

1412
cde/lib/csa/table.c Normal file

File diff suppressed because it is too large Load Diff

106
cde/lib/csa/table.h Normal file
View File

@@ -0,0 +1,106 @@
/* $XConsortium: table.h /main/1 1996/04/21 19:24:49 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#ifndef _TABLE_H
#define _TABLE_H
#include <EUSCompat.h>
#include "ansi_c.h"
#include "cm.h"
#include "rtable4.h"
#include "entry.h"
#include "connection.h"
/*
* Interface to rpc calls of version 2-4
*/
extern CSA_return_code _DtCm_table_create P((Calendar *cal));
extern CSA_return_code _DtCm_table_get_access P((
Calendar *cal,
cms_access_entry **acclist));
extern CSA_return_code _DtCm_table_set_access P((
Calendar *cal,
CSA_access_list alist));
extern CSA_return_code _DtCm_table_lookup_reminder P((
Calendar *cal,
CSA_uint32 num_names,
char **reminder_names,
CSA_uint32 *num_rems,
CSA_reminder_reference **rems));
extern CSA_return_code _DtCm_table_lookup_range P((
Calendar *cal,
long start1,
long start2,
boolean_t no_end_time_range,
long end1,
long end2,
long id,
uint num_attrs,
cms_attribute *attrs,
CSA_enum *ops,
_DtCm_libentry **appts));
extern CSA_return_code _DtCm_table_lookup P((
Calendar *cal,
_DtCm_libentry *entry));
/*
* This routine looks up events of a repeating sequence.
* The caller either specifies entry and elist_r or
* id and key.
* If entry is specified, events are converted to cms_entry structures
* and returned in elist_r, otherwise; the caller is interested only
* in the key of the first entry which will be returned in the cms_key
* structure pointed to by key.
*/
extern CSA_return_code _DtCm_table_lookup_key_range P((
Calendar *cal,
_DtCm_libentry *entry,
long id,
time_t start,
time_t end,
cms_key *key,
_DtCm_libentry **elist_r));
extern CSA_return_code _DtCm_table_insert P((
Calendar *cal,
uint num_attrs,
CSA_attribute * attrs,
_DtCm_libentry **entries));
extern CSA_return_code _DtCm_table_delete P((
Calendar *cal,
_DtCm_libentry *entry,
CSA_enum scope));
extern CSA_return_code _DtCm_table_update P((
Calendar *cal,
_DtCm_libentry *oentry,
uint num_attrs,
CSA_attribute * attrs,
CSA_enum scope,
_DtCm_libentry **nentry));
extern CSA_return_code _DtCm_table_size P((
Calendar *cal,
int *size));
extern CSA_return_code _DtCm_table_unregister_target P((
_DtCm_Connection *conn,
char *cal));
extern CSA_return_code _DtCm_table_register_target P((
_DtCm_Connection *conn,
char *cal));
#endif

417
cde/lib/csa/updateattrs.c Normal file
View File

@@ -0,0 +1,417 @@
/* $XConsortium: updateattrs.c /main/1 1996/04/21 19:24:52 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#include <EUSCompat.h>
#include <stdlib.h>
#include <string.h>
#include "updateattrs.h"
#include "cmsdata.h"
#include "nametbl.h"
#include "attr.h"
/*****************************************************************************
* extern functions used in the library
*****************************************************************************/
/*
* need to copy original attributes and roll back if update fails
*/
extern CSA_return_code
_DtCmUpdateAttributes(
uint numsrc,
cms_attribute *srcattrs,
uint *numdst,
cms_attribute **dstattrs,
_DtCmNameTable **tbl,
boolean_t caltbl,
int **types,
boolean_t makecopy)
{
CSA_return_code stat = CSA_SUCCESS;
uint i, oldnum = 0;
cms_attribute *oldattrs;
int index;
/* copy original attributes for rollback if update fails */
if (makecopy && *numdst > 0 && (stat = _DtCm_copy_cms_attributes(
*numdst, *dstattrs, &oldnum, &oldattrs)) != CSA_SUCCESS)
return (stat);
for (i = 0; i < numsrc && stat == CSA_SUCCESS; i++) {
if (srcattrs[i].name.name == NULL)
continue;
if (srcattrs[i].name.num <= 0)
srcattrs[i].name.num = _DtCm_get_index_from_table(*tbl,
srcattrs[i].name.name);
index = srcattrs[i].name.num;
if (index < 0 || index > (*tbl)->size) {
if (index < 0)
srcattrs[i].name.num = 0;
if ((stat = _DtCmExtendNameTable(srcattrs[i].name.name,
index > 0 ? index : 0, srcattrs[i].value->type,
(caltbl == B_TRUE ? _DtCm_cal_name_tbl :
_DtCm_entry_name_tbl),
(caltbl == B_TRUE ? _DtCM_DEFINED_CAL_ATTR_SIZE :
_DtCM_DEFINED_ENTRY_ATTR_SIZE),
(caltbl == B_TRUE ? _CSA_calendar_attribute_names :
_CSA_entry_attribute_names), tbl, types))
== CSA_SUCCESS) {
if (index <= 0)
srcattrs[i].name.num = (*tbl)->size;
stat = _DtCmGrowAttrArray(numdst,
dstattrs, &srcattrs[i]);
}
} else {
if ((*tbl)->names[index] == NULL) {
/* fill in the missing hole */
if ((stat = _DtCm_add_name_to_table(*tbl,
index, srcattrs[i].name.name))
!= CSA_SUCCESS)
break;
if (types && srcattrs[i].value)
(*types)[index] =
srcattrs[i].value->type;
}
if (types && srcattrs[i].value &&
srcattrs[i].value->type != (*types)[index])
stat = CSA_E_INVALID_ATTRIBUTE_VALUE;
else if (index > *numdst)
stat = _DtCmGrowAttrArray(numdst, dstattrs,
&srcattrs[i]);
else
stat = _DtCmUpdateAttribute(&srcattrs[i],
&(*dstattrs)[index]);
}
}
if (makecopy && oldnum > 0) {
if (stat != CSA_SUCCESS) {
_DtCm_free_cms_attributes(*numdst + 1, *dstattrs);
free(*dstattrs);
*numdst = oldnum;
*dstattrs = oldattrs;
} else {
_DtCm_free_cms_attributes(oldnum + 1, oldattrs);
free(oldattrs);
}
}
return (stat);
}
extern CSA_return_code
_DtCmUpdateAttribute(
cms_attribute *from,
cms_attribute *to)
{
CSA_return_code stat = CSA_SUCCESS;
if (to->name.name == NULL) {
to->name.num = from->name.num;
if ((to->name.name = strdup(from->name.name)) == NULL)
return (CSA_E_INSUFFICIENT_MEMORY);
}
if (from->value && to->value && from->value->type != to->value->type)
return (CSA_E_INVALID_ATTRIBUTE_VALUE);
if (from->value) {
switch (from->value->type) {
case CSA_VALUE_BOOLEAN:
case CSA_VALUE_ENUMERATED:
case CSA_VALUE_FLAGS:
case CSA_VALUE_SINT32:
case CSA_VALUE_UINT32:
stat = _DtCmUpdateSint32AttrVal(from->value,
&to->value);
break;
case CSA_VALUE_STRING:
case CSA_VALUE_CALENDAR_USER:
case CSA_VALUE_DATE_TIME:
case CSA_VALUE_DATE_TIME_RANGE:
case CSA_VALUE_TIME_DURATION:
stat = _DtCmUpdateStringAttrVal(from->value,
&to->value);
break;
case CSA_VALUE_REMINDER:
stat = _DtCmUpdateReminderAttrVal(from->value,
&to->value);
break;
case CSA_VALUE_ACCESS_LIST:
stat = _DtCmUpdateAccessListAttrVal(from->value,
&to->value);
break;
case CSA_VALUE_DATE_TIME_LIST:
stat = _DtCmUpdateDateTimeListAttrVal(from->value,
&to->value);
break;
case CSA_VALUE_OPAQUE_DATA:
stat = _DtCmUpdateOpaqueDataAttrVal(from->value,
&to->value);
break;
default:
stat = CSA_E_INVALID_ATTRIBUTE_VALUE;
}
} else {
_DtCm_free_cms_attribute_value(to->value);
to->value = NULL;
}
return (stat);
}
extern CSA_return_code
_DtCmUpdateAccessListAttrVal(
cms_attribute_value *newval,
cms_attribute_value **attrval)
{
cms_attribute_value *val;
cms_access_entry *newlist = NULL;
if (newval && newval->item.access_list_value &&
(newlist = _DtCm_copy_cms_access_list(
newval->item.access_list_value)) == NULL)
return (CSA_E_INSUFFICIENT_MEMORY);
if (*attrval == NULL) {
if ((val = (cms_attribute_value *)malloc(
sizeof(cms_attribute_value))) == NULL) {
if (newlist)
_DtCm_free_cms_access_entry(newlist);
return (CSA_E_INSUFFICIENT_MEMORY);
}
val->type = CSA_VALUE_ACCESS_LIST;
} else {
val = *attrval;
_DtCm_free_cms_access_entry(
(cms_access_entry *)val->item.access_list_value);
}
val->item.access_list_value = newlist;
*attrval = val;
return (CSA_SUCCESS);
}
extern CSA_return_code
_DtCmUpdateSint32AttrVal(
cms_attribute_value *newval,
cms_attribute_value **attrval)
{
cms_attribute_value *val;
if (newval) {
if (*attrval == NULL) {
if ((val = (cms_attribute_value *)malloc(
sizeof(cms_attribute_value))) == NULL) {
return (CSA_E_INSUFFICIENT_MEMORY);
}
val->type = newval->type;
*attrval = val;
}
(*attrval)->item.sint32_value = newval->item.sint32_value;
} else if (*attrval) {
free(*attrval);
*attrval = NULL;
}
return (CSA_SUCCESS);
}
extern CSA_return_code
_DtCmUpdateStringAttrVal(
cms_attribute_value *newval,
cms_attribute_value **attrval)
{
cms_attribute_value *val;
char *newstring = NULL;
if (newval) {
if (newval->item.string_value &&
(newstring = strdup(newval->item.string_value)) == NULL)
return (CSA_E_INSUFFICIENT_MEMORY);
if (*attrval == NULL) {
if ((val = (cms_attribute_value *)malloc(
sizeof(cms_attribute_value))) == NULL) {
if (newstring)
free(newstring);
return (CSA_E_INSUFFICIENT_MEMORY);
}
val->type = newval->type;
} else {
val = *attrval;
if (val->item.string_value)
free(val->item.string_value);
}
val->item.string_value = newstring;
*attrval = val;
} else if (*attrval) {
free((*attrval)->item.string_value);
free(*attrval);
*attrval = NULL;
}
return (CSA_SUCCESS);
}
extern CSA_return_code
_DtCmUpdateReminderAttrVal(
cms_attribute_value *newval,
cms_attribute_value **attrval)
{
CSA_return_code stat;
cms_attribute_value *val;
CSA_reminder *rem = NULL;
if (newval && newval->item.reminder_value) {
if ((stat = _DtCm_copy_reminder(newval->item.reminder_value,
&rem)) != CSA_SUCCESS)
return (CSA_E_INSUFFICIENT_MEMORY);
if (*attrval == NULL) {
if ((val = (cms_attribute_value *)malloc(
sizeof(cms_attribute_value))) == NULL) {
if (rem)
_DtCm_free_reminder(rem);
return (CSA_E_INSUFFICIENT_MEMORY);
}
val->type = newval->type;
} else {
val = *attrval;
if (val->item.reminder_value)
_DtCm_free_reminder(val->item.reminder_value);
}
val->item.reminder_value = rem;
*attrval = val;
} else if (*attrval) {
_DtCm_free_reminder((*attrval)->item.reminder_value);
free(*attrval);
*attrval = NULL;
}
return (CSA_SUCCESS);
}
extern CSA_return_code
_DtCmUpdateDateTimeListAttrVal(
cms_attribute_value *newval,
cms_attribute_value **attrval)
{
cms_attribute_value *val;
CSA_date_time_list dtlist = NULL;
if (newval && newval->item.date_time_list_value) {
if ((dtlist = _DtCm_copy_date_time_list(
newval->item.date_time_list_value)) == NULL)
return (CSA_E_INSUFFICIENT_MEMORY);
if (*attrval == NULL) {
if ((val = (cms_attribute_value *)malloc(
sizeof(cms_attribute_value))) == NULL) {
if (dtlist)
_DtCm_free_date_time_list(dtlist);
return (CSA_E_INSUFFICIENT_MEMORY);
}
val->type = newval->type;
} else {
val = *attrval;
if (val->item.date_time_list_value)
_DtCm_free_date_time_list(
val->item.date_time_list_value);
}
val->item.date_time_list_value = dtlist;
*attrval = val;
} else if (*attrval) {
_DtCm_free_date_time_list((*attrval)->item.date_time_list_value);
free(*attrval);
*attrval = NULL;
}
return (CSA_SUCCESS);
}
extern CSA_return_code
_DtCmUpdateOpaqueDataAttrVal(
cms_attribute_value *newval,
cms_attribute_value **attrval)
{
CSA_return_code stat;
cms_attribute_value *val;
CSA_opaque_data *opq = NULL;
if (newval && newval->item.opaque_data_value) {
if ((stat = _DtCm_copy_opaque_data(
newval->item.opaque_data_value, &opq)) != CSA_SUCCESS)
return (CSA_E_INSUFFICIENT_MEMORY);
if (*attrval == NULL) {
if ((val = (cms_attribute_value *)malloc(
sizeof(cms_attribute_value))) == NULL) {
if (opq) _DtCm_free_opaque_data(opq);
return (CSA_E_INSUFFICIENT_MEMORY);
}
val->type = newval->type;
} else {
val = *attrval;
if (val->item.opaque_data_value)
_DtCm_free_opaque_data(
val->item.opaque_data_value);
}
val->item.opaque_data_value = opq;
*attrval = val;
} else if (*attrval) {
_DtCm_free_opaque_data((*attrval)->item.opaque_data_value);
free(*attrval);
*attrval = NULL;
}
return (CSA_SUCCESS);
}

56
cde/lib/csa/updateattrs.h Normal file
View File

@@ -0,0 +1,56 @@
/* $XConsortium: updateattrs.h /main/1 1996/04/21 19:24:55 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#ifndef _UPDATEATTRS_H
#define _UPDATEATTRS_H
#include <EUSCompat.h>
#include "ansi_c.h"
#include "csa.h"
#include "cm.h"
#include "nametbl.h"
extern CSA_return_code _DtCmUpdateAttributes P((
uint numsrc,
cms_attribute *srcattrs,
uint *numdst,
cms_attribute **dstattrs,
_DtCmNameTable **tbl,
boolean_t caltbl,
int **types,
boolean_t makecopy));
extern CSA_return_code _DtCmUpdateAttribute P((
cms_attribute *from,
cms_attribute *to));
extern CSA_return_code _DtCmUpdateAccessListAttrVal P((
cms_attribute_value *newval,
cms_attribute_value **attrval));
extern CSA_return_code _DtCmUpdateSint32AttrVal P((
cms_attribute_value *newval,
cms_attribute_value **attrval));
extern CSA_return_code _DtCmUpdateStringAttrVal P((
cms_attribute_value *newval,
cms_attribute_value **attrval));
extern CSA_return_code _DtCmUpdateReminderAttrVal P((
cms_attribute_value *newval,
cms_attribute_value **attrval));
extern CSA_return_code _DtCmUpdateDateTimeListAttrVal P((
cms_attribute_value *newval,
cms_attribute_value **attrval));
extern CSA_return_code _DtCmUpdateOpaqueDataAttrVal P((
cms_attribute_value *newval,
cms_attribute_value **attrval));
#endif

118
cde/lib/csa/xtclient.c Normal file
View File

@@ -0,0 +1,118 @@
/* $XConsortium: xtclient.c /main/1 1996/04/21 19:24:58 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#include <EUSCompat.h>
#include <stdlib.h>
#include <X11/Intrinsic.h>
#include <rpc/rpc.h>
#include "debug.h"
typedef struct _appctlist {
XtAppContext appct;
struct _appctlist *next;
} AppCtList;
static AppCtList *registered_appct = NULL;
/*****************************************************************************
* forward declaration of static functions
*****************************************************************************/
static void xtcallback(XtPointer data, int *fid, XtInputId *id);
static boolean_t new_appct(XtAppContext apptct);
/*****************************************************************************
* extern functions used in the library
*****************************************************************************/
/*
* register callback for all file descriptors that's set
* (since we don't know which one is ours).
*/
extern void
_DtCm_register_xtcallback(XtAppContext appct)
{
XtInputId id;
int i, j;
fd_mask fmask, *bits;
fd_set fdset = svc_fdset;
DP(("xtclient.c: _DtCm_register_xtcallback()\n"));
if (new_appct(appct) == B_FALSE)
return;
/* assuming only 1 bit is set */
bits = fdset.fds_bits;
for (i = 0; i < FD_SETSIZE; i += NFDBITS) {
fmask = *bits;
for (j = 0; fmask != 0; j++, fmask >>= 1) {
if (fmask & 0x1) {
if ((i + j) >= FD_SETSIZE)
break;
/* register callback with XtAppAddInput
* for rpc input
*/
id = XtAppAddInput(appct, ((i *NFDBITS) + j),
(XtPointer)XtInputReadMask,
xtcallback, NULL);
DP(("xtclient.c: id %d for input at fd %d\n",
id, ((i * NFDBITS) + j)));
}
}
bits++;
}
}
/*****************************************************************************
* static functions used within the file
*****************************************************************************/
/*
* callback for rpc events
*/
static void
xtcallback(XtPointer data, int *fid, XtInputId *id)
{
fd_set rpc_bits;
DP(("xtcallback called\n"));
FD_ZERO(&rpc_bits);
FD_SET(*fid, &rpc_bits);
svc_getreqset(&rpc_bits);
}
/*
* need to lock registered_appct
*/
static boolean_t
new_appct(XtAppContext appct)
{
AppCtList *lptr;
boolean_t newappct = B_TRUE;
for (lptr = registered_appct; lptr != NULL; lptr = lptr->next) {
if (lptr->appct == appct) {
newappct = B_FALSE;
break;
}
}
if (newappct == B_TRUE) {
lptr = (AppCtList *)calloc(1, sizeof(AppCtList));
lptr->appct = appct;
lptr->next = registered_appct;
registered_appct = lptr;
}
return (newappct);
}

17
cde/lib/csa/xtclient.h Normal file
View File

@@ -0,0 +1,17 @@
/* $XConsortium: xtclient.h /main/1 1996/04/21 19:25:01 drk $ */
/*
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Novell, Inc.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
*/
#ifndef _XTCLIENT_H
#define _XTCLIENT_H
#include <X11/Intrinsic.h>
#include "ansi_c.h"
extern void _DtCm_register_xtcallback P((XtAppContext appct));
#endif /* _XTCLIENT_H */