rymanluk commented on a change in pull request #279: BLE Host - Policy for SM 
key overflow
URL: 
https://github.com/apache/incubator-mynewt-core/pull/279#discussion_r123452152
 
 

 ##########
 File path: net/nimble/host/include/host/ble_store.h
 ##########
 @@ -131,6 +137,40 @@ union ble_store_value {
     struct ble_store_value_cccd cccd;
 };
 
+struct ble_store_status_event {
+    /**
+     * The type of object that failed to persist; one of the
+     * BLE_STORE_OBJ_TYPE_[...] codes.
+     */
+    int obj_type;
+
+    /**
+     * The type of event being reported; one of the BLE_STORE_EVENT_TYPE_[...]
+     * codes.
+     */
+    int event_code;
+
+    /**
+     * Additional data related to the event; the valid field is inferred from
+     * the obj_type,event_code pair.
+     */
+    union {
+        /**
+         * The record that failed to be written.  Valid for the following event
+         * types:
+         *     o BLE_STORE_EVENT_OVERFLOW
 
 Review comment:
   Hmm, I'm sorry but for me it still not clear from API point of view.
   
   So maybe we should do something similar to e.g. struct ble_gap_event
   
   Event type always defines valid union type.
   
   What would you say about that?
   
   > struct ble_store_status_event {
   >     /**
   >      * The type of event being reported; one of the 
BLE_STORE_EVENT_TYPE_[...]
   >      * codes.
   >      */
   >     int event_code;
   > 
   >     /**
   >      * Additional data related to the event; the valid field is inferred 
from
   >      * the obj_type,event_code pair.
   >      */
   >     union {
   >         /**
   >          * Represent storage object which could not be written. Valid for 
the following event
   >          * types:
   >          *     o BLE_STORE_EVENT_OVERFLOW
   >          */
   >         struct {
   >            /* Object type which failed to be written */
   >             int obj_type;
   >            
   >             /* The record that failed to be written.*/
   >             const union ble_store_value *value;
   >         } overflow ;
   > 
   >         /**
   >          * Represents element which might be written but storage is full.  
Valid for the following event
   >          * types:
   >          *     o BLE_STORE_EVENT_STORAGE_FULL
   >          */
   > 
   >         struct {
   >            /* Object type which could not be written due to storage full*/
   >             int obj_type;
   > 
   >             /* conn handle used for:
   >              * BLE_STORE_OBJ_TYPE_OUR_SEC
   >              * BLE_STORE_OBJ_TYPE_PEER_SEC
   >              */
   >             uint16_t conn_handle;
   > 
   >             // We can add fieds for other types or create union if needed.
   >         } storage_full;
   >     };
   > };
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to