diff --git a/inc/sainat.h b/inc/sainat.h index b2ad864d7..c2a5b37aa 100644 --- a/inc/sainat.h +++ b/inc/sainat.h @@ -209,6 +209,17 @@ typedef enum _sai_nat_entry_attr_t */ SAI_NAT_ENTRY_ATTR_HIT_BIT, + /** + * @brief NAT entry aging time in seconds + * + * Zero means aging is disabled. + * + * @type sai_uint32_t + * @flags CREATE_AND_SET + * @default 0 + */ + SAI_NAT_ENTRY_ATTR_AGING_TIME, + /** * @brief End of NAT Entry attributes */ @@ -334,6 +345,34 @@ typedef struct _sai_nat_entry_t } sai_nat_entry_t; +/** + * @brief NAT event type + */ +typedef enum _sai_nat_event_t +{ + /** NAT entry event none */ + SAI_NAT_EVENT_NONE, + + /** NAT entry event aged */ + SAI_NAT_EVENT_AGED, + +} sai_nat_event_t; + +/** + * @brief Notification data format received from SAI NAT callback + * + * @count attr[attr_count] + */ +typedef struct _sai_nat_event_notification_data_t +{ + /** Event type */ + sai_nat_event_t event_type; + + /** NAT entry */ + sai_nat_entry_t nat_entry; + +} sai_nat_event_notification_data_t; + /** * @brief Create and return a NAT object * @@ -384,6 +423,18 @@ typedef sai_status_t (*sai_get_nat_entry_attribute_fn)( _In_ uint32_t attr_count, _Inout_ sai_attribute_t *attr_list); +/** + * @brief NAT notifications + * + * @count data[count] + * + * @param[in] count Number of notifications + * @param[in] data Pointer to NAT event notification data array + */ +typedef void (*sai_nat_event_notification_fn)( + _In_ uint32_t count, + _In_ const sai_nat_event_notification_data_t *data); + /** * @brief Bulk create NAT entry * diff --git a/inc/saiswitch.h b/inc/saiswitch.h index 553ee7480..037cc9b1e 100644 --- a/inc/saiswitch.h +++ b/inc/saiswitch.h @@ -2695,6 +2695,17 @@ typedef enum _sai_switch_attr_t */ SAI_SWITCH_ATTR_IPSEC_SA_STATUS_CHANGE_NOTIFY, + /** + * @brief NAT event notification callback function passed to the adapter. + * + * Use sai_nat_event_notification_fn as notification function. + * + * @type sai_pointer_t sai_nat_event_notification_fn + * @flags CREATE_AND_SET + * @default NULL + */ + SAI_SWITCH_ATTR_NAT_EVENT_NOTIFY, + /** * @brief End of attributes */ diff --git a/meta/parse.pl b/meta/parse.pl index f2ff0f396..e5c5f5c39 100755 --- a/meta/parse.pl +++ b/meta/parse.pl @@ -2520,6 +2520,7 @@ sub ProcessStructValueType return "SAI_ATTR_VALUE_TYPE_INT32" if defined $SAI_ENUMS{$type}; # enum return "-1" if $type eq "sai_fdb_entry_t"; + return "-1" if $type eq "sai_nat_entry_t"; return "-1" if $type eq "sai_attribute_t*"; LogError "invalid struct member value type $type";