Kim Kempf | 72cb33e | 2017-08-30 12:53:35 -0700 | [diff] [blame^] | 1 | /* |
| 2 | ** Copyright 2017-present Open Networking Foundation |
| 3 | ** |
| 4 | ** Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | ** you may not use this file except in compliance with the License. |
| 6 | ** You may obtain a copy of the License at |
| 7 | ** |
| 8 | ** http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | ** |
| 10 | ** Unless required by applicable law or agreed to in writing, software |
| 11 | ** distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | ** See the License for the specific language governing permissions and |
| 14 | ** limitations under the License. |
| 15 | */ |
suhasgrao | 76e8f8c | 2017-07-12 16:24:33 +0530 | [diff] [blame] | 16 | |
| 17 | /* Global definations */ |
| 18 | pthread_cond_t cv; |
| 19 | pthread_mutex_t lock; |
| 20 | |
| 21 | #define IND_USR_DAT_LEN 8 |
| 22 | #define IND_USR_DAT_VAL "brcmOLT" |
| 23 | #define BALCLIENT "bal_client" |
| 24 | #define BALSERVER "bal_server" |
suhasgrao | 4b31f40 | 2017-07-31 00:01:54 +0530 | [diff] [blame] | 25 | #define BAL_DEVICE_STR_LEN 20 |
suhasgrao | 76e8f8c | 2017-07-12 16:24:33 +0530 | [diff] [blame] | 26 | |
| 27 | /* A linked list (LL) node to store a queue entry */ |
| 28 | struct QNode |
| 29 | { |
suhasgrao | 4b31f40 | 2017-07-31 00:01:54 +0530 | [diff] [blame] | 30 | int obj_type; |
| 31 | char device_id[BAL_DEVICE_STR_LEN]; |
| 32 | int status; |
| 33 | int intf_id; |
| 34 | int onu_id; |
| 35 | struct QNode *next; |
suhasgrao | 76e8f8c | 2017-07-12 16:24:33 +0530 | [diff] [blame] | 36 | }; |
| 37 | |
suhasgrao | 4b31f40 | 2017-07-31 00:01:54 +0530 | [diff] [blame] | 38 | |
suhasgrao | 76e8f8c | 2017-07-12 16:24:33 +0530 | [diff] [blame] | 39 | /* The queue, front stores the front node of LL and rear stores ths |
suhasgrao | 4b31f40 | 2017-07-31 00:01:54 +0530 | [diff] [blame] | 40 | last node of LL */ |
suhasgrao | 76e8f8c | 2017-07-12 16:24:33 +0530 | [diff] [blame] | 41 | typedef struct Queue |
| 42 | { |
suhasgrao | 4b31f40 | 2017-07-31 00:01:54 +0530 | [diff] [blame] | 43 | struct QNode *front, *rear; |
suhasgrao | 76e8f8c | 2017-07-12 16:24:33 +0530 | [diff] [blame] | 44 | }bal_queue; |
| 45 | |
| 46 | /* shared queue */ |
| 47 | bal_queue *shared_queue; |
| 48 | |
| 49 | void create_stub_thread(); |
| 50 | bal_queue *createQueue(); |
suhasgrao | 4b31f40 | 2017-07-31 00:01:54 +0530 | [diff] [blame] | 51 | struct QNode* newNode(int objKey, int status, char *device_id); |
| 52 | void enQueue(int objKey, struct QNode *temp); |
suhasgrao | 76e8f8c | 2017-07-12 16:24:33 +0530 | [diff] [blame] | 53 | struct QNode *deQueue(); |