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 | |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 17 | #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 | |
suhasgrao | 76e8f8c | 2017-07-12 16:24:33 +0530 | [diff] [blame] | 26 | /* Global definations */ |
| 27 | pthread_cond_t cv; |
| 28 | pthread_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" |
suhasgrao | 4b31f40 | 2017-07-31 00:01:54 +0530 | [diff] [blame] | 34 | #define BAL_DEVICE_STR_LEN 20 |
suhasgrao | 76e8f8c | 2017-07-12 16:24:33 +0530 | [diff] [blame] | 35 | |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 36 | typedef 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 | |
suhasgrao | 76e8f8c | 2017-07-12 16:24:33 +0530 | [diff] [blame] | 44 | /* A linked list (LL) node to store a queue entry */ |
| 45 | struct QNode |
| 46 | { |
suhasgrao | 4b31f40 | 2017-07-31 00:01:54 +0530 | [diff] [blame] | 47 | int obj_type; |
| 48 | char device_id[BAL_DEVICE_STR_LEN]; |
| 49 | int status; |
| 50 | int intf_id; |
| 51 | int onu_id; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 52 | char vendor_id[BAL_DEVICE_STR_LEN]; |
| 53 | char vendor_specific[BAL_DEVICE_STR_LEN]; |
suhasgrao | 4b31f40 | 2017-07-31 00:01:54 +0530 | [diff] [blame] | 54 | struct QNode *next; |
suhasgrao | 76e8f8c | 2017-07-12 16:24:33 +0530 | [diff] [blame] | 55 | }; |
| 56 | |
suhasgrao | 4b31f40 | 2017-07-31 00:01:54 +0530 | [diff] [blame] | 57 | |
suhasgrao | 76e8f8c | 2017-07-12 16:24:33 +0530 | [diff] [blame] | 58 | /* The queue, front stores the front node of LL and rear stores ths |
suhasgrao | 4b31f40 | 2017-07-31 00:01:54 +0530 | [diff] [blame] | 59 | last node of LL */ |
suhasgrao | 76e8f8c | 2017-07-12 16:24:33 +0530 | [diff] [blame] | 60 | typedef struct Queue |
| 61 | { |
suhasgrao | 4b31f40 | 2017-07-31 00:01:54 +0530 | [diff] [blame] | 62 | struct QNode *front, *rear; |
suhasgrao | 76e8f8c | 2017-07-12 16:24:33 +0530 | [diff] [blame] | 63 | }bal_queue; |
| 64 | |
| 65 | /* shared queue */ |
| 66 | bal_queue *shared_queue; |
| 67 | |
| 68 | void create_stub_thread(); |
| 69 | bal_queue *createQueue(); |
suhasgrao | 4b31f40 | 2017-07-31 00:01:54 +0530 | [diff] [blame] | 70 | struct QNode* newNode(int objKey, int status, char *device_id); |
| 71 | void enQueue(int objKey, struct QNode *temp); |
suhasgrao | 76e8f8c | 2017-07-12 16:24:33 +0530 | [diff] [blame] | 72 | struct QNode *deQueue(); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 73 | grpc_c_client_t *client; |
| 74 | void stub_bal_init(BalInit *bal_init); |