blob: dda776ac447c83c9607b14e2ec9e6924efc2e047 [file] [log] [blame]
Kim Kempf72cb33e2017-08-30 12:53:35 -07001/*
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*/
suhasgrao76e8f8c2017-07-12 16:24:33 +053016
17/* Global definations */
18pthread_cond_t cv;
19pthread_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"
suhasgrao4b31f402017-07-31 00:01:54 +053025#define BAL_DEVICE_STR_LEN 20
suhasgrao76e8f8c2017-07-12 16:24:33 +053026
27/* A linked list (LL) node to store a queue entry */
28struct QNode
29{
suhasgrao4b31f402017-07-31 00:01:54 +053030 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;
suhasgrao76e8f8c2017-07-12 16:24:33 +053036};
37
suhasgrao4b31f402017-07-31 00:01:54 +053038
suhasgrao76e8f8c2017-07-12 16:24:33 +053039/* The queue, front stores the front node of LL and rear stores ths
suhasgrao4b31f402017-07-31 00:01:54 +053040 last node of LL */
suhasgrao76e8f8c2017-07-12 16:24:33 +053041typedef struct Queue
42{
suhasgrao4b31f402017-07-31 00:01:54 +053043 struct QNode *front, *rear;
suhasgrao76e8f8c2017-07-12 16:24:33 +053044}bal_queue;
45
46/* shared queue */
47bal_queue *shared_queue;
48
49void create_stub_thread();
50bal_queue *createQueue();
suhasgrao4b31f402017-07-31 00:01:54 +053051struct QNode* newNode(int objKey, int status, char *device_id);
52void enQueue(int objKey, struct QNode *temp);
suhasgrao76e8f8c2017-07-12 16:24:33 +053053struct QNode *deQueue();