blob: 61012b1b06f1720508271c923ddf31b6ade1014e [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
Rajeswara Raof6b4e6c2017-08-31 17:26:27 +053017#include "bal_msg_type.grpc-c.h"
18#include "bal_osmsg.grpc-c.h"
19#include "bal_model_ids.grpc-c.h"
20#include "bal_obj.grpc-c.h"
21#include "bal_model_types.grpc-c.h"
22#include "bal_errno.grpc-c.h"
23#include "bal_indications.grpc-c.h"
24#include "bal.grpc-c.h"
25
suhasgrao76e8f8c2017-07-12 16:24:33 +053026/* Global definations */
27pthread_cond_t cv;
28pthread_mutex_t lock;
29
30#define IND_USR_DAT_LEN 8
31#define IND_USR_DAT_VAL "brcmOLT"
32#define BALCLIENT "bal_client"
33#define BALSERVER "bal_server"
suhasgrao4b31f402017-07-31 00:01:54 +053034#define BAL_DEVICE_STR_LEN 20
suhasgrao76e8f8c2017-07-12 16:24:33 +053035
Rajeswara Raof6b4e6c2017-08-31 17:26:27 +053036typedef struct BalCoreIpInfo
37{
38 char bal_core_arg1[4];
39 char bal_core_ip_port[24];
40 char bal_core_arg2[4];
41 char bal_shared_lib_ip_port[24];
42}balCoreIpInfo;
43
suhasgrao76e8f8c2017-07-12 16:24:33 +053044/* A linked list (LL) node to store a queue entry */
45struct QNode
46{
suhasgrao4b31f402017-07-31 00:01:54 +053047 int obj_type;
48 char device_id[BAL_DEVICE_STR_LEN];
49 int status;
50 int intf_id;
51 int onu_id;
Rajeswara Raof6b4e6c2017-08-31 17:26:27 +053052 char vendor_id[BAL_DEVICE_STR_LEN];
53 char vendor_specific[BAL_DEVICE_STR_LEN];
suhasgrao4b31f402017-07-31 00:01:54 +053054 struct QNode *next;
suhasgrao76e8f8c2017-07-12 16:24:33 +053055};
56
suhasgrao4b31f402017-07-31 00:01:54 +053057
suhasgrao76e8f8c2017-07-12 16:24:33 +053058/* The queue, front stores the front node of LL and rear stores ths
suhasgrao4b31f402017-07-31 00:01:54 +053059 last node of LL */
suhasgrao76e8f8c2017-07-12 16:24:33 +053060typedef struct Queue
61{
suhasgrao4b31f402017-07-31 00:01:54 +053062 struct QNode *front, *rear;
suhasgrao76e8f8c2017-07-12 16:24:33 +053063}bal_queue;
64
65/* shared queue */
66bal_queue *shared_queue;
67
68void create_stub_thread();
69bal_queue *createQueue();
suhasgrao4b31f402017-07-31 00:01:54 +053070struct QNode* newNode(int objKey, int status, char *device_id);
71void enQueue(int objKey, struct QNode *temp);
suhasgrao76e8f8c2017-07-12 16:24:33 +053072struct QNode *deQueue();
Rajeswara Raof6b4e6c2017-08-31 17:26:27 +053073grpc_c_client_t *client;
74void stub_bal_init(BalInit *bal_init);