| 1 | /********************************************************************** |
|---|
| 2 | * Copyright (c) 2005-2008 David Carter <dcarter@arm4.org> and others. |
|---|
| 3 | * All rights reserved. This program and the accompanying materials |
|---|
| 4 | * are made available under the terms of the Eclipse Public License v1.0 |
|---|
| 5 | * which accompanies this distribution, and is available at |
|---|
| 6 | * http://www.eclipse.org/legal/epl-v10.html |
|---|
| 7 | * |
|---|
| 8 | * Contributors: |
|---|
| 9 | * David Carter - Initial API and implementation |
|---|
| 10 | **********************************************************************/ |
|---|
| 11 | |
|---|
| 12 | #ifndef ARM4DBDAEMONSHAREDMEMORY_H |
|---|
| 13 | #define ARM4DBDAEMONSHAREDMEMORY_H 1 |
|---|
| 14 | |
|---|
| 15 | #include "arm4_shm.h" |
|---|
| 16 | #include "Arm4dbSharedMemory.h" |
|---|
| 17 | |
|---|
| 18 | class Arm4dbDaemonSharedMemory : |
|---|
| 19 | public Arm4dbSharedMemory |
|---|
| 20 | { |
|---|
| 21 | |
|---|
| 22 | public: |
|---|
| 23 | // Constructors |
|---|
| 24 | Arm4dbDaemonSharedMemory (); |
|---|
| 25 | |
|---|
| 26 | // Destructors |
|---|
| 27 | virtual ~Arm4dbDaemonSharedMemory (); |
|---|
| 28 | |
|---|
| 29 | // Accessors |
|---|
| 30 | |
|---|
| 31 | // Mutators |
|---|
| 32 | |
|---|
| 33 | // Operations |
|---|
| 34 | static void *shmCreate (arm_boolean_t start_as_null); |
|---|
| 35 | static void shmDestroy (void); |
|---|
| 36 | |
|---|
| 37 | static void setUmask (int umask); |
|---|
| 38 | static pid_t setDaemon (arm_boolean_t force); |
|---|
| 39 | static pid_t getActiveDaemon (void); |
|---|
| 40 | static pid_t clearDaemon (void); |
|---|
| 41 | |
|---|
| 42 | // Application instance queue |
|---|
| 43 | static int getAppInstances (arm4_shm_application_instance_t *app_instance_ptr); |
|---|
| 44 | static int getAppGroup (arm4_shm_property_t *app_group_ptr); |
|---|
| 45 | static int getAppInstanceId (arm4_shm_property_t *property_ptr); |
|---|
| 46 | static int getAppContext (arm4_shm_context_property_t *property_ptr); |
|---|
| 47 | static int getAppAddress (arm4_shm_address_t *address_ptr); |
|---|
| 48 | |
|---|
| 49 | // Transaction instance queue |
|---|
| 50 | static int getTranInstances (arm4_shm_transaction_instance_t *tran_instance_ptr); |
|---|
| 51 | static int getTranContext (arm4_shm_context_property_t *property_ptr); |
|---|
| 52 | static int getTranUri (arm4_shm_uri_t *uri_ptr); |
|---|
| 53 | static int getTranMetricValues (arm4_shm_metric_value_t *metric_ptr); |
|---|
| 54 | static int getTranUser (arm4_shm_user_t *user_ptr); |
|---|
| 55 | static int getTranDiag (arm4_shm_diag_t *diag_ptr); |
|---|
| 56 | |
|---|
| 57 | // Correlator queue |
|---|
| 58 | static int getCorellators (arm4_shm_correlator_t *correlator_ptr); |
|---|
| 59 | |
|---|
| 60 | // Sequence queue |
|---|
| 61 | static int getSequence (arm4_shm_db_sequence_t *sequence_ptr); |
|---|
| 62 | |
|---|
| 63 | // Application registration |
|---|
| 64 | static int getRegisterApplication (arm4_shm_register_application_t *message_ptr); |
|---|
| 65 | static void registerApplicationReturn (int application_index, arm_id_t appid, arm_boolean_t is_new); |
|---|
| 66 | static int getRegisterApplicationIdentity (arm4_shm_register_application_identity_t *message_ptr); |
|---|
| 67 | static int getRegisterApplicationContext (arm4_shm_register_application_context_t *message_ptr); |
|---|
| 68 | |
|---|
| 69 | // Transaction registration |
|---|
| 70 | static int getRegisterTransaction (arm4_shm_register_transaction_t *message_ptr); |
|---|
| 71 | static void registerTransactionReturn (int transaction_index, arm_id_t tran_id, arm_boolean_t is_new); |
|---|
| 72 | static int getRegisterTransactionIdentity (arm4_shm_register_application_identity_t *message_ptr); |
|---|
| 73 | static int getRegisterTransactionContext (arm4_shm_register_application_context_t *message_ptr); |
|---|
| 74 | static int getRegisterTransactionUri (arm4_shm_register_transaction_uri_t *message_ptr); |
|---|
| 75 | static int getRegisterTransactionMetricBinding (arm4_shm_register_transaction_metric_t *message_ptr); |
|---|
| 76 | |
|---|
| 77 | // Metric registration |
|---|
| 78 | static int getRegisterMetric (arm4_shm_register_metric_t *message_ptr); |
|---|
| 79 | static void registerMetricReturn (int metric_index, arm_id_t metric_id); |
|---|
| 80 | |
|---|
| 81 | static void getStats (arm4_shm_stats_t *stats_ptr); |
|---|
| 82 | static void sampleFlush (void); |
|---|
| 83 | |
|---|
| 84 | // Utility commands |
|---|
| 85 | static void utilityCommand (long command); |
|---|
| 86 | static int getUtilityCommand (arm4_shm_utility_t *message_ptr); |
|---|
| 87 | |
|---|
| 88 | static int waitingMessageCount (void); |
|---|
| 89 | |
|---|
| 90 | // Operators |
|---|
| 91 | |
|---|
| 92 | private: |
|---|
| 93 | |
|---|
| 94 | static int getMessage (void *buffer_ptr, int buffer_size, long type); |
|---|
| 95 | |
|---|
| 96 | static void create_semaphores (void); |
|---|
| 97 | static void destroy_semaphores (void); |
|---|
| 98 | }; |
|---|
| 99 | |
|---|
| 100 | #endif /* ARM4DBDAEMONSHAREDMEMORY_H */ |
|---|