1 /* $Id$ */ 2 /**************************************************************************** 3 * 4 * Copyright (C) 2014-2021 Cisco and/or its affiliates. All rights reserved. 5 * Copyright (C) 2011-2013 Sourcefire, Inc. 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License Version 2 as 9 * published by the Free Software Foundation. You may not use, modify or 10 * distribute this program under any other version of the GNU General 11 * Public License. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 * 22 ****************************************************************************/ 23 24 // @file shmem_datamgmt.h 25 // @author Pramod Chandrashekar <pramod@sourcefire.com> 26 27 #ifndef _SHMEM_DMGMT_H_ 28 #define _SHMEM_DMGMT_H_ 29 30 #include <stdint.h> 31 #include <stdbool.h> 32 33 #define SF_SUCCESS 0 34 35 #define SF_EINVAL 1 // Invalid argument 36 #define SF_ENOMEM 2 // Not enough space 37 #define SF_EEXIST 3 // File exists 38 #define SF_ENOSPC 4 // No space 39 #define SF_ENOENT 5 // No such file or directory 40 41 #define MAX_NAME 1024 42 #define FILE_LIST_BUCKET_SIZE 64 43 #define MAX_NUM_ZONES 1052 44 #define MAX_MANIFEST_LINE_LENGTH (8*MAX_NUM_ZONES) 45 #define MAX_LIST_ID UINT32_MAX 46 #define MAX_IPLIST_FILES 256 47 48 struct _ShmemDataFile { 49 char* filename; 50 int filetype; 51 uint32_t listid; 52 bool zones[MAX_NUM_ZONES]; 53 }; 54 55 typedef struct _ShmemDataFile ShmemDataFileList; 56 57 extern ShmemDataFileList** filelist_ptr; 58 extern int filelist_count; 59 60 /* Functions ****************************************************************/ 61 int GetSortedListOfShmemDataFiles(void); 62 int GetLatestShmemDataSetVersionOnDisk(uint32_t*); 63 void FreeShmemDataFileList(void); 64 65 #ifdef DEBUG_MSGS 66 void PrintDataFiles(void); 67 void PrintListInfo(bool*, uint32_t); 68 #endif /* DEBUG_MSGS */ 69 #endif /* _SHMEM_DMGMT_H_ */ 70