suhasgrao | 76e8f8c | 2017-07-12 16:24:33 +0530 | [diff] [blame] | 1 | |
| 2 | /* Global definations */ |
| 3 | pthread_cond_t cv; |
| 4 | pthread_mutex_t lock; |
| 5 | |
| 6 | #define IND_USR_DAT_LEN 8 |
| 7 | #define IND_USR_DAT_VAL "brcmOLT" |
| 8 | #define BALCLIENT "bal_client" |
| 9 | #define BALSERVER "bal_server" |
suhasgrao | 4b31f40 | 2017-07-31 00:01:54 +0530 | [diff] [blame^] | 10 | #define BAL_DEVICE_STR_LEN 20 |
suhasgrao | 76e8f8c | 2017-07-12 16:24:33 +0530 | [diff] [blame] | 11 | |
| 12 | /* A linked list (LL) node to store a queue entry */ |
| 13 | struct QNode |
| 14 | { |
suhasgrao | 4b31f40 | 2017-07-31 00:01:54 +0530 | [diff] [blame^] | 15 | int obj_type; |
| 16 | char device_id[BAL_DEVICE_STR_LEN]; |
| 17 | int status; |
| 18 | int intf_id; |
| 19 | int onu_id; |
| 20 | struct QNode *next; |
suhasgrao | 76e8f8c | 2017-07-12 16:24:33 +0530 | [diff] [blame] | 21 | }; |
| 22 | |
suhasgrao | 4b31f40 | 2017-07-31 00:01:54 +0530 | [diff] [blame^] | 23 | |
suhasgrao | 76e8f8c | 2017-07-12 16:24:33 +0530 | [diff] [blame] | 24 | /* The queue, front stores the front node of LL and rear stores ths |
suhasgrao | 4b31f40 | 2017-07-31 00:01:54 +0530 | [diff] [blame^] | 25 | last node of LL */ |
suhasgrao | 76e8f8c | 2017-07-12 16:24:33 +0530 | [diff] [blame] | 26 | typedef struct Queue |
| 27 | { |
suhasgrao | 4b31f40 | 2017-07-31 00:01:54 +0530 | [diff] [blame^] | 28 | struct QNode *front, *rear; |
suhasgrao | 76e8f8c | 2017-07-12 16:24:33 +0530 | [diff] [blame] | 29 | }bal_queue; |
| 30 | |
| 31 | /* shared queue */ |
| 32 | bal_queue *shared_queue; |
| 33 | |
| 34 | void create_stub_thread(); |
| 35 | bal_queue *createQueue(); |
suhasgrao | 4b31f40 | 2017-07-31 00:01:54 +0530 | [diff] [blame^] | 36 | struct QNode* newNode(int objKey, int status, char *device_id); |
| 37 | void enQueue(int objKey, struct QNode *temp); |
suhasgrao | 76e8f8c | 2017-07-12 16:24:33 +0530 | [diff] [blame] | 38 | struct QNode *deQueue(); |