Main Page | Modules | Namespace List | Class Hierarchy | Data Structures | Directories | File List | Namespace Members | Data Fields | Globals

notify_mgr_server_prv.h

Go to the documentation of this file.
00001 /********************************************************************
00002 
00003 Copyright 2006, ACCESS Systems Americas, Inc. All rights reserved.
00004 
00005 The contents of this file are subject to the Mozilla Public License Version
00006 1.1 (the "License"); you may not use this file except in compliance with
00007 the License. You may obtain a copy of the License at
00008 http://www.mozilla.org/MPL/
00009 
00010 Software distributed under the License is distributed on an "AS IS" basis,
00011 WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012 for the specific language governing rights and limitations under the
00013 License.
00014 
00015 The Original Code is the entire contents of this file.
00016 
00017 The Initial Developer of the Original Code is ACCESS Systems Americas, Inc.
00018 
00019 Portions created by ACCESS Systems Americas, Inc. are Copyright © 2006. All
00020 Rights Reserved.
00021 
00022 Contributor(s): none.
00023 
00024 ********************************************************************/
00025 #ifndef NOTIFY_MGR_SERVER_PRV_H
00026 #define NOTIFY_MGR_SERVER_PRV_H
00027 
00028 #include <pthread.h>
00029 #include <time.h>
00030 #include <hiker/ipc.h>
00031 
00033 #define ALP_NOTIFY_MAX_BROADCASTS 100
00034 
00036 #define ALP_NOTIFY_MAX_REGISTRATIONS 5000
00037 
00038 // internal structures for registrations
00039 
00040 typedef struct _AlpNotifyRegisterEntry AlpNotifyRegisterEntry;
00041 struct _AlpNotifyRegisterEntry {
00042         char * notifyType;
00043         char * appID;
00044         void * callback;
00045         void * userData;        
00046         int priority;
00047         int flags;
00048         int pid;
00049         struct _AlpNotifyRegisterEntry * next;
00050 };
00051 
00052 typedef struct _AlpNotifyRegisterHead AlpNotifyRegisterHead;
00053 struct _AlpNotifyRegisterHead {
00054         int hash;
00055         AlpNotifyRegisterEntry * entry;
00056         struct _AlpNotifyRegisterHead * next;
00057 };
00058 
00059 // internal structures for broadcasts
00060 
00061 typedef struct _AlpNotifyNotificationEntry AlpNotifyNotificationEntry;
00062 struct _AlpNotifyNotificationEntry {
00063         char * notifyType;
00064         char * details;
00065         char * appID;
00066         int length;
00067         int queue;
00068         int flags;
00069         int busy;
00070         int handled;
00071         int pid;
00072         pthread_t thread;
00073         AlpConnection * connect;
00074         AlpNotifyRegisterEntry * entry;
00075         struct _AlpNotifyNotificationEntry * next;
00076 };
00077 
00078 // internal structure for server connections
00079 
00080 typedef struct _AlpNotifyConnectionEntry AlpNotifyConnectionEntry;
00081 struct _AlpNotifyConnectionEntry {
00082         AlpConnection * connect;
00083         char * appID;
00084         struct _AlpNotifyConnectionEntry * next;
00085 };
00086 
00087 // internal structure for active broadcasts
00088 
00089 typedef struct _AlpNotifyBroadcastEntry AlpNotifyBroadcastEntry;
00090 struct _AlpNotifyBroadcastEntry {
00091         int pid;
00092         time_t seconds;
00093         char * appID;
00094         struct _AlpNotifyBroadcastEntry * next;
00095 };
00096 
00097 // internal structure for active package installs
00098 
00099 typedef struct _AlpNotifyPackageEntry AlpNotifyPackageEntry;
00100 struct _AlpNotifyPackageEntry {
00101         int count;
00102         char * appID;
00103         struct _AlpNotifyPackageEntry * next;
00104 };
00105 
00106 // register
00107 extern int alp_notify_register_add(AlpNotifyCmdRegister * request, int pid);
00108 extern AlpNotifyRegisterHead * alp_notify_register_get(const char * notifyType);
00109 extern void alp_notify_register_cleanup(void);
00110 extern int alp_notify_register_remove(AlpNotifyCmdUnregister * request);
00111 extern int alp_notify_register_remove_all(const char * appID, int server);
00112 extern int alp_notify_register_is_defined(const char * notifyType, const char * appID);
00113 
00114 // broadcast
00115 extern int alp_notify_broadcast_get_pending(void);
00116 extern int alp_notify_broadcast_add(AlpNotifyCmdBroadcast * request, AlpConnection * connect);
00117 extern int alp_notify_broadcast_done(AlpNotifyCmdNotificationDone * done);
00118 extern void alp_notify_broadcast_do_pending(void);
00119 extern void alp_notify_broadcast_fixup(AlpNotifyRegisterEntry * old, AlpNotifyRegisterEntry * new);
00120 extern void alp_notify_broadcast_cleanup(void);
00121 extern int alp_notify_broadcast_is_active(AlpNotifyRegisterEntry * entry);
00122 extern void alp_notify_broadcast_set_inactive(const char * appID);
00123 extern void alp_notify_broadcast_cancel_sync(AlpConnection * connect);
00124 
00125 
00126 // active notification
00127 extern int alp_notify_add(const char * appID, int pid);
00128 extern void alp_notify_remove(const char * appID);
00129 extern int alp_notify_get_pid(const char * appID);
00130 extern void alp_notify_cleanup(void);
00131 
00132 // ipc
00133 extern int alp_notify_ipc_send(const char * appID, void * buf, int length);
00134 extern void alp_notify_ipc_start_timer(void);
00135 extern void alp_notify_ipc_init(void);
00136 
00137 // base64
00138 extern void alp_notify_base64_encode(unsigned char src[], unsigned char dst[], int length);
00139 extern int alp_notify_base64_encode_size(int length);
00140 
00141 // package
00142 extern int alp_notify_package_install(const char * appID);
00143 extern int alp_notify_package_uninstall(const char * appID);
00144 extern int alp_notify_package_cleanup(const char * notifyType);
00145 extern void alp_notify_package_remove(const char * appID);
00146 extern void alp_notify_package_init(void);
00147 
00148 // database
00149 extern int alp_notify_database_init(void);
00150 extern int alp_notify_database_add(AlpNotifyRegisterEntry * entry);
00151 extern int alp_notify_database_remove(AlpNotifyRegisterEntry * entry);
00152 extern int alp_notify_database_restore(void);
00153 
00154 #endif

Generated on Sat Dec 16 20:29:47 2006 for hiker-0.9 by  doxygen 1.4.4