From 3c65854251abbb3aa9005b918d658241f8574b27 Mon Sep 17 00:00:00 2001 From: seladb Date: Sun, 1 Dec 2024 11:35:45 -0800 Subject: [PATCH 01/11] Auto OUI Database Update (#1649) Co-authored-by: GitHub --- 3rdParty/OUIDataset/PCPP_OUIDataset.json | 512 ++++++++++++++++++++++- 1 file changed, 502 insertions(+), 10 deletions(-) diff --git a/3rdParty/OUIDataset/PCPP_OUIDataset.json b/3rdParty/OUIDataset/PCPP_OUIDataset.json index e592c63596..889e2e2e1d 100644 --- a/3rdParty/OUIDataset/PCPP_OUIDataset.json +++ b/3rdParty/OUIDataset/PCPP_OUIDataset.json @@ -35373,7 +35373,7 @@ "vendor": "Ntt It Co., Ltd." }, "41029": { - "vendor": "PHOENIX CONTACT Electronics GmbH" + "vendor": "Phoenix Contact GmbH & Co. KG" }, "41030": { "vendor": "Scitex Corp. Ltd." @@ -36236,6 +36236,9 @@ "48112": { "vendor": "Ungermann-Bass Inc." }, + "48175": { + "vendor": "Actiontec Electronics Inc." + }, "48224": { "vendor": "Cisco Systems, Inc" }, @@ -39293,6 +39296,9 @@ "280362": { "vendor": "Palo Alto Networks" }, + "280522": { + "vendor": "Gree Electric Appliances, Inc. Of Zhuhai" + }, "280730": { "vendor": "Apple, Inc." }, @@ -39557,6 +39563,9 @@ "295342": { "vendor": "Clack Corporation" }, + "295688": { + "vendor": "Espressif Inc." + }, "296074": { "vendor": "7Inova Technology Limited" }, @@ -39599,6 +39608,9 @@ "299137": { "vendor": "Pensando Systems, Inc." }, + "299200": { + "vendor": "Forvia" + }, "299362": { "vendor": "Microchip Technology Inc." }, @@ -39713,6 +39725,9 @@ "306887": { "vendor": "Marquardt" }, + "307302": { + "vendor": "Private" + }, "307431": { "vendor": "Huawei Technologies Co.,Ltd" }, @@ -40118,6 +40133,9 @@ "326275": { "vendor": "Qingdao Haier Technology Co.,Ltd" }, + "327144": { + "vendor": "Technoalpin" + }, "327217": { "vendor": "Samsung Electronics Co.,Ltd" }, @@ -40862,6 +40880,9 @@ "542294": { "vendor": "Veo-Labs" }, + "542347": { + "vendor": "Guangdong NanGuang Photo & Video Systems Co., Ltd" + }, "542407": { "vendor": "Fiberhome Telecommunication Technologies Co.,LTD" }, @@ -41435,6 +41456,9 @@ "578666": { "vendor": "LG Electronics (Mobile Communications)" }, + "578963": { + "vendor": "Texas Instruments" + }, "578973": { "vendor": "Sagemcom Broadband SAS" }, @@ -41870,6 +41894,9 @@ "803833": { "vendor": "Amazon Technologies Inc." }, + "804032": { + "vendor": "zte corporation" + }, "804282": { "vendor": "Huawei Technologies Co.,Ltd" }, @@ -42221,6 +42248,9 @@ "824207": { "vendor": "Guangdong Oppo Mobile Telecommunications Corp.,Ltd" }, + "824229": { + "vendor": "eero inc." + }, "824315": { "vendor": "BNS Solutions" }, @@ -42605,6 +42635,9 @@ "846989": { "vendor": "Motorola Mobility LLC, a Lenovo Company" }, + "847217": { + "vendor": "Extreme Networks Headquarters" + }, "847304": { "vendor": "Xiaomi Communications Co Ltd" }, @@ -44378,6 +44411,9 @@ "1343438": { "vendor": "Apple, Inc." }, + "1343692": { + "vendor": "Quectel Wireless Solutions Co.,Ltd." + }, "1344091": { "vendor": "Hefei Radio Communication Technology Co., Ltd" }, @@ -44792,6 +44828,9 @@ "1370546": { "vendor": "Fiberhome Telecommunication Technologies Co.,LTD" }, + "1370785": { + "vendor": "Micronet union Technology (chengdu) co., Ltd" + }, "1370888": { "vendor": "Huawei Technologies Co.,Ltd" }, @@ -45371,6 +45410,9 @@ "1600129": { "vendor": "Sagemcom Broadband SAS" }, + "1600482": { + "vendor": "Lylink Limited" + }, "1600921": { "vendor": "Adanis Inc." }, @@ -45830,6 +45872,9 @@ "1629911": { "vendor": "Huawei Technologies Co.,Ltd" }, + "1629990": { + "vendor": "Ingram Micro Services" + }, "1630132": { "vendor": "Bosung Powertec Co.,Ltd." }, @@ -46013,6 +46058,9 @@ "1837906": { "vendor": "Epicom S.A" }, + "1837963": { + "vendor": "Ubiquiti Inc" + }, "1838461": { "vendor": "Apple, Inc." }, @@ -46163,6 +46211,9 @@ "1847202": { "vendor": "Guangzhou Shiyuan Electronic Technology Company Limited" }, + "1847299": { + "vendor": "Hewlett Packard Enterprise" + }, "1847304": { "vendor": "Hui Zhou Gaoshengda Technology Co.,LTD" }, @@ -46322,6 +46373,9 @@ "1854857": { "vendor": "Hangzhou Huacheng Network Technology Co.,Ltd" }, + "1855138": { + "vendor": "Shenzhen V-Link Technology CO., LTD." + }, "1855518": { "vendor": "Sunplus Technology Co., Ltd." }, @@ -46526,6 +46580,9 @@ "1865785": { "vendor": "Shenzhen Tencent Computer System Co., Ltd." }, + "1865803": { + "vendor": "Bouffalo Lab (Nanjing) Co., Ltd." + }, "1865806": { "vendor": "China Mobile Iot Limited company" }, @@ -46637,6 +46694,9 @@ "1872836": { "vendor": "Amazon Technologies Inc." }, + "1873000": { + "vendor": "New H3C Technologies Co., Ltd" + }, "1873042": { "vendor": "RUAG Schweiz AG" }, @@ -47378,6 +47438,9 @@ "2118531": { "vendor": "Huawei Technologies Co.,Ltd" }, + "2118541": { + "vendor": "Hon Hai Precision Industry Co., Ltd." + }, "2118602": { "vendor": "Risk Technology Ltd" }, @@ -47414,6 +47477,9 @@ "2120221": { "vendor": "zte corporation" }, + "2120335": { + "vendor": "Shenzhen Hikeen Technology Co.,LTD" + }, "2120490": { "vendor": "Private" }, @@ -47657,6 +47723,9 @@ "2136301": { "vendor": "AltoBeam Inc." }, + "2136402": { + "vendor": "Xiaomi Communications Co Ltd" + }, "2136701": { "vendor": "Sagemcom Broadband SAS" }, @@ -48371,6 +48440,9 @@ "2377797": { "vendor": "Hangzhou Hikvision Digital Technology Co.,Ltd." }, + "2377861": { + "vendor": "Huawei Device Co., Ltd." + }, "2378107": { "vendor": "Innovative Converged Devices Inc" }, @@ -49451,6 +49523,9 @@ "2640103": { "vendor": "Huawei Device Co., Ltd." }, + "2640274": { + "vendor": "Luminator Technology Group Global LLC" + }, "2640979": { "vendor": "Intune Networks" }, @@ -49458,7 +49533,7 @@ "vendor": "zte corporation" }, "2641298": { - "vendor": "Luminator" + "vendor": "Luminator Technology Group Global LLC" }, "2641476": { "vendor": "Huawei Technologies Co.,Ltd" @@ -50063,6 +50138,9 @@ "2677671": { "vendor": "Silicon Laboratories" }, + "2678300": { + "vendor": "Samsung Electronics Co.,Ltd" + }, "2678361": { "vendor": "Domus NTW CORP." }, @@ -50747,6 +50825,9 @@ "2909869": { "vendor": "NimbleTech Digital Inc." }, + "2909941": { + "vendor": "Shenzhen Electrical Appliances Co." + }, "2910104": { "vendor": "InTalTech Ltd." }, @@ -51236,6 +51317,9 @@ "2940393": { "vendor": "Arista Networks" }, + "2940902": { + "vendor": "Raisecom Technology CO., LTD" + }, "2940978": { "vendor": "TCL King Electrical Appliances(Huizhou)Co.,Ltd" }, @@ -51359,6 +51443,9 @@ "3145980": { "vendor": "Nokia" }, + "3146159": { + "vendor": "Cisco Systems, Inc" + }, "3146696": { "vendor": "Cloud Network Technology Singapore Pte. Ltd." }, @@ -52262,6 +52349,9 @@ "3204238": { "vendor": "Vodafone UK" }, + "3204312": { + "vendor": "Huawei Device Co., Ltd." + }, "3204315": { "vendor": "Cisco Systems, Inc" }, @@ -52277,6 +52367,9 @@ "3205670": { "vendor": "Sycada BV" }, + "3205909": { + "vendor": "Huawei Device Co., Ltd." + }, "3205919": { "vendor": "Skylab M&C Technology Co.,Ltd" }, @@ -52640,6 +52733,9 @@ "3423684": { "vendor": "Buffalo.Inc" }, + "3423781": { + "vendor": "Ohsung" + }, "3423908": { "vendor": "Ring LLC" }, @@ -52871,6 +52967,9 @@ "3436525": { "vendor": "Enovation Controls" }, + "3436649": { + "vendor": "Cisco Systems, Inc" + }, "3436870": { "vendor": "Huawei Device Co., Ltd." }, @@ -52976,6 +53075,9 @@ "3442269": { "vendor": "Espressif Inc." }, + "3442394": { + "vendor": "Honor Device Co., Ltd." + }, "3442493": { "vendor": "Quectel Wireless Solutions Co.,Ltd." }, @@ -53486,6 +53588,9 @@ "3470235": { "vendor": "WizLAN Ltd." }, + "3470807": { + "vendor": "Huawei Device Co., Ltd." + }, "3470893": { "vendor": "SHARP Corporation" }, @@ -53675,6 +53780,9 @@ "3676129": { "vendor": "Vantiva USA LLC" }, + "3676203": { + "vendor": "Espressif Inc." + }, "3676236": { "vendor": "Sony Home Entertainment&Sound Products Inc" }, @@ -53723,6 +53831,9 @@ "3678663": { "vendor": "Hewlett Packard Enterprise" }, + "3678760": { + "vendor": "Telink Micro LLC" + }, "3678877": { "vendor": "ADB Broadband Italia" }, @@ -53888,6 +53999,9 @@ "3689616": { "vendor": "Commscope" }, + "3689938": { + "vendor": "Huawei Device Co., Ltd." + }, "3690313": { "vendor": "Juniper Networks" }, @@ -54152,6 +54266,9 @@ "3707438": { "vendor": "ArrayComm" }, + "3707441": { + "vendor": "Tecno Mobile Limited" + }, "3708001": { "vendor": "Renesas Electronics (Penang) Sdn. Bhd." }, @@ -55451,6 +55568,9 @@ "3975446": { "vendor": "Huawei Device Co., Ltd." }, + "3975595": { + "vendor": "Nintendo Co.,Ltd" + }, "3975668": { "vendor": "Intel Corporate" }, @@ -55703,6 +55823,9 @@ "3991588": { "vendor": "Huawei Technologies Co.,Ltd" }, + "3991662": { + "vendor": "Hewlett Packard Enterprise" + }, "3991822": { "vendor": "Espressif Inc." }, @@ -57140,6 +57263,9 @@ "4472327": { "vendor": "Electrolux" }, + "4472458": { + "vendor": "Texas Instruments" + }, "4472498": { "vendor": "DEOTRON Co., LTD." }, @@ -57587,6 +57713,9 @@ "4500213": { "vendor": "Commscope" }, + "4500613": { + "vendor": "eero inc." + }, "4500761": { "vendor": "Xingfei (H.K)Limited" }, @@ -57914,6 +58043,9 @@ "4519143": { "vendor": "Cohesity Inc" }, + "4519230": { + "vendor": "Earda Technologies co Ltd" + }, "4519792": { "vendor": "Beijing Xiaomi Mobile Software Co., Ltd" }, @@ -58748,6 +58880,9 @@ "4766286": { "vendor": "Hewlett Packard" }, + "4766734": { + "vendor": "Sichuan AI-Link Technology Co., Ltd." + }, "4766886": { "vendor": "​ASUNG TECHNO CO.,Ltd" }, @@ -59999,6 +60134,9 @@ "5036484": { "vendor": "Magneti Marelli Automotive Electronics (Guangzhou) Co. Ltd" }, + "5036600": { + "vendor": "Texas Instruments" + }, "5037069": { "vendor": "Coral Telecom Limited" }, @@ -60119,6 +60257,9 @@ "5044573": { "vendor": "Huawei Technologies Co.,Ltd" }, + "5044890": { + "vendor": "Shenzhen Quanxing Technology Co., Ltd" + }, "5044938": { "vendor": "Cambridge Industries(Group) Co.,Ltd." }, @@ -61154,6 +61295,9 @@ "5300357": { "vendor": "Intel Corporate" }, + "5300377": { + "vendor": "HangZhou Atuo Future Technology Co., Ltd" + }, "5300423": { "vendor": "TurControlSystme AG" }, @@ -61493,6 +61637,9 @@ "5515038": { "vendor": "AzureWave Technology Inc." }, + "5515042": { + "vendor": "Lacroix" + }, "5515096": { "vendor": "Motorola (Wuhan) Mobility Technologies Communication Co., Ltd." }, @@ -61850,6 +61997,9 @@ "5537229": { "vendor": "Texas Instruments" }, + "5537306": { + "vendor": "Kaon Group Co., Ltd." + }, "5537620": { "vendor": "Ingenico" }, @@ -61874,6 +62024,9 @@ "5538618": { "vendor": "Zyxel Communications Corporation" }, + "5538896": { + "vendor": "Tiinlab Corporation" + }, "5538939": { "vendor": "Digital Devices GmbH" }, @@ -62408,6 +62561,9 @@ "5769940": { "vendor": "Apple, Inc." }, + "5770509": { + "vendor": "Gree Electric Appliances, Inc. Of Zhuhai" + }, "5771313": { "vendor": "Hon Hai Precision IND.CO.,LTD" }, @@ -62849,6 +63005,9 @@ "5802995": { "vendor": "Zyxel Communications Corporation" }, + "5803137": { + "vendor": "Espressif Inc." + }, "5803273": { "vendor": "Cisco Systems, Inc" }, @@ -63149,6 +63308,9 @@ "5821806": { "vendor": "D-Link International" }, + "5821983": { + "vendor": "Ubiquiti Inc" + }, "5822074": { "vendor": "TCPlink" }, @@ -63182,6 +63344,9 @@ "5823597": { "vendor": "Exceptional Innovation, Inc." }, + "5824345": { + "vendor": "Cisco Systems, Inc" + }, "5824556": { "vendor": "Micro Technic A/S" }, @@ -63281,6 +63446,9 @@ "5831054": { "vendor": "SECUDOS GmbH" }, + "5831486": { + "vendor": "Huawei Device Co., Ltd." + }, "5831556": { "vendor": "Intel Corporate" }, @@ -64013,6 +64181,9 @@ "6071275": { "vendor": "SKODA DIGITAL s.r.o." }, + "6071350": { + "vendor": "Shenzhen G-world Technology Incorporated Company" + }, "6071421": { "vendor": "Hewlett Packard Enterprise" }, @@ -65144,6 +65315,9 @@ "6333309": { "vendor": "Apple, Inc." }, + "6333411": { + "vendor": "Tp-Link Technologies Co.,Ltd." + }, "6333475": { "vendor": "Silicon Laboratories" }, @@ -65990,6 +66164,9 @@ "6578826": { "vendor": "evon GmbH" }, + "6578950": { + "vendor": "Xiaomi Communications Co Ltd" + }, "6579274": { "vendor": "Beijing Xiaomi Mobile Software Co., Ltd" }, @@ -66977,6 +67154,9 @@ "6836317": { "vendor": "Halo Technologies" }, + "6836364": { + "vendor": "Shanghai Sunmi Technology Co.,Ltd." + }, "6836532": { "vendor": "Hewlett Packard Enterprise" }, @@ -67025,6 +67205,9 @@ "6838289": { "vendor": "Fiberhome Telecommunication Technologies Co.,LTD" }, + "6838432": { + "vendor": "Honor Device Co., Ltd." + }, "6838469": { "vendor": "ZF TRW Automotive" }, @@ -67265,6 +67448,9 @@ "6853706": { "vendor": "zte corporation" }, + "6854005": { + "vendor": "Zhejiang Bodyguard Electronic Co., Ltd" + }, "6854190": { "vendor": "Huawei Technologies Co.,Ltd" }, @@ -67295,6 +67481,9 @@ "6855351": { "vendor": "Atelier Vision Corporation" }, + "6855491": { + "vendor": "Huawei Device Co., Ltd." + }, "6855774": { "vendor": "AcSiP Technology Corp." }, @@ -67895,6 +68084,9 @@ "7086763": { "vendor": "Ainsworth Game Technology" }, + "7086839": { + "vendor": "Nokia Shanghai Bell Co., Ltd." + }, "7086870": { "vendor": "TATUNG Technology Inc.," }, @@ -68198,6 +68390,9 @@ "7103388": { "vendor": "Commscope" }, + "7103480": { + "vendor": "Ubiquiti Inc" + }, "7103514": { "vendor": "Penguin Computing" }, @@ -68387,6 +68582,9 @@ "7117213": { "vendor": "Amazon Technologies Inc." }, + "7117492": { + "vendor": "Brodersen A/S" + }, "7117513": { "vendor": "Valentine Research, Inc." }, @@ -68411,6 +68609,9 @@ "7119104": { "vendor": "Intel Corporate" }, + "7119646": { + "vendor": "Itel Mobile Limited" + }, "7119719": { "vendor": "Avlinkpro" }, @@ -70133,6 +70334,9 @@ "7612786": { "vendor": "Juniper Networks" }, + "7612801": { + "vendor": "Texas Instruments" + }, "7612847": { "vendor": "Hon Hai Precision Ind. Co.,Ltd." }, @@ -71351,6 +71555,9 @@ "7873965": { "vendor": "Samsung Electronics Co.,Ltd" }, + "7874214": { + "vendor": "zte corporation" + }, "7874762": { "vendor": "Sonos, Inc." }, @@ -71939,6 +72146,9 @@ "7906276": { "vendor": "Apple, Inc." }, + "7906490": { + "vendor": "Marquardt India Pvt Ltd" + }, "7906564": { "vendor": "Texas Instruments" }, @@ -73178,6 +73388,9 @@ "8173435": { "vendor": "Paradigm Electronics Inc" }, + "8173798": { + "vendor": "Gree Electric Appliances, Inc. Of Zhuhai" + }, "8173900": { "vendor": "Bouffalo Lab (Nanjing) Co., Ltd." }, @@ -73200,7 +73413,7 @@ "vendor": "AE REFUsol" }, "8175479": { - "vendor": "Speedtech Corp." + "vendor": "Speedtech Corp. Jio" }, "8175496": { "vendor": "Mobilicom LTD" @@ -73730,6 +73943,9 @@ "8400579": { "vendor": "Huawei Technologies Co.,Ltd" }, + "8400606": { + "vendor": "Huawei Device Co., Ltd." + }, "8400862": { "vendor": "Zurich Instruments AG" }, @@ -73805,6 +74021,9 @@ "8404552": { "vendor": "Shenzhen Gongjin Electronics Co.,Lt" }, + "8404559": { + "vendor": "GD Midea Air-Conditioning Equipment Co.,Ltd." + }, "8404829": { "vendor": "Winstars Technology Ltd" }, @@ -74054,6 +74273,9 @@ "8419441": { "vendor": "Askey Computer Corp" }, + "8419635": { + "vendor": "Aigentec Technology(Zhejiang) Co., Ltd." + }, "8419677": { "vendor": "Infinix mobility limited" }, @@ -74906,6 +75128,9 @@ "8670197": { "vendor": "Hon Hai Precision Ind. Co.,Ltd." }, + "8670540": { + "vendor": "Adtran Inc" + }, "8670654": { "vendor": "Fiberhome Telecommunication Technologies Co.,LTD" }, @@ -75965,6 +76190,9 @@ "8930550": { "vendor": "Nokia Corporation" }, + "8930800": { + "vendor": "Guangdong Genius Technology Co., Ltd." + }, "8930820": { "vendor": "Xiaomi Communications Co Ltd" }, @@ -76562,6 +76790,9 @@ "8966040": { "vendor": "Huawei Technologies Co.,Ltd" }, + "8966093": { + "vendor": "Texas Instruments" + }, "8966201": { "vendor": "Tonly Technology Co. Ltd" }, @@ -79235,6 +79466,9 @@ "9713655": { "vendor": "Huawei Device Co., Ltd." }, + "9713834": { + "vendor": "Technology Innovation Institute" + }, "9714149": { "vendor": "Hon Hai Precision Ind. Co.,Ltd." }, @@ -79628,6 +79862,9 @@ "9740413": { "vendor": "Huawei Device Co., Ltd." }, + "9740417": { + "vendor": "Silicon Laboratories" + }, "9740706": { "vendor": "AMPAK Technology, Inc." }, @@ -80264,6 +80501,9 @@ "9969177": { "vendor": "Sagemcom Broadband SAS" }, + "9969289": { + "vendor": "Tianyi Telecom Terminals Company Limited" + }, "9969585": { "vendor": "Shenzhen Lemon Network Technology Co.,Ltd" }, @@ -80768,6 +81008,9 @@ "10003470": { "vendor": "Snap, Inc." }, + "10003534": { + "vendor": "IEC Technologies S. de R.L de C.V." + }, "10003961": { "vendor": "Apple, Inc." }, @@ -80786,6 +81029,9 @@ "10004802": { "vendor": "Guangzhou Tozed Kangwei Intelligent Technology Co., LTD" }, + "10004837": { + "vendor": "AVM Audiovisuelles Marketing und Computersysteme GmbH" + }, "10005052": { "vendor": "Will i-tech Co., Ltd." }, @@ -80843,6 +81089,9 @@ "10009145": { "vendor": "Doro AB" }, + "10009183": { + "vendor": "TP-Link Systems Inc." + }, "10009374": { "vendor": "BYD Precision Manufacture Company Ltd." }, @@ -81041,6 +81290,9 @@ "10022540": { "vendor": "zte corporation" }, + "10022548": { + "vendor": "Xiaomi Communications Co Ltd" + }, "10022603": { "vendor": "Wistron Infocomm (Zhongshan) Corporation" }, @@ -81443,6 +81695,9 @@ "10241520": { "vendor": "Skylark Electronics Pvt Ltd" }, + "10241922": { + "vendor": "Tp-Link Technologies Co.,Ltd." + }, "10242036": { "vendor": "Nokia" }, @@ -81992,6 +82247,9 @@ "10270900": { "vendor": "AMPAK Technology,Inc." }, + "10271433": { + "vendor": "Telit Communication s.p.a" + }, "10271640": { "vendor": "Shen Zhen RND Electronic Co.,LTD" }, @@ -82187,6 +82445,9 @@ "10283292": { "vendor": "zte corporation" }, + "10283294": { + "vendor": "Tejas Networks Ltd" + }, "10283345": { "vendor": "Shenzhen Sang Fei Consumer Communications Ltd., Co." }, @@ -82334,6 +82595,9 @@ "10488993": { "vendor": "SKTB SKiT" }, + "10489058": { + "vendor": "Shenzhen Shokz Co., Ltd." + }, "10489496": { "vendor": "Huawei Technologies Co.,Ltd" }, @@ -82865,6 +83129,9 @@ "10521060": { "vendor": "Skyworth Digital Technology(Shenzhen) Co.,Ltd" }, + "10521094": { + "vendor": "Askey Computer Corp" + }, "10521223": { "vendor": "HuiZhou KaiYue Electronic Co.,Ltd" }, @@ -83915,6 +84182,9 @@ "10779849": { "vendor": "Huawei Technologies Co.,Ltd" }, + "10780024": { + "vendor": "Edgecore Americas Networking Corporation" + }, "10780063": { "vendor": "Shenzhen iComm Semiconductor CO.,LTD" }, @@ -84209,6 +84479,9 @@ "10797879": { "vendor": "Apple, Inc." }, + "10797902": { + "vendor": "Texas Instruments" + }, "10797921": { "vendor": "Apple, Inc." }, @@ -84395,6 +84668,9 @@ "10807268": { "vendor": "Connex GmbH" }, + "10807437": { + "vendor": "FN-LINK TECHNOLOGY Ltd." + }, "10807459": { "vendor": "Fujian Newland Auto-ID Tech Co.,Ltd." }, @@ -84701,6 +84977,9 @@ "11026557": { "vendor": "GD Midea Air-Conditioning Equipment Co.,Ltd." }, + "11026680": { + "vendor": "Humax Networks" + }, "11026722": { "vendor": "China Mobile (Hangzhou) Information Technology Co.,Ltd." }, @@ -84942,7 +85221,7 @@ "vendor": "Idt, Inc." }, "11039773": { - "vendor": "PHOENIX CONTACT Electronics GmbH" + "vendor": "Phoenix Contact GmbH & Co. KG" }, "11039876": { "vendor": "zte corporation" @@ -85049,6 +85328,9 @@ "11046436": { "vendor": "Apple, Inc." }, + "11046809": { + "vendor": "Arista Networks" + }, "11046873": { "vendor": "Apple, Inc." }, @@ -85412,6 +85694,9 @@ "11070065": { "vendor": "Fiberhome Telecommunication Technologies Co.,LTD" }, + "11070180": { + "vendor": "Weiser" + }, "11071085": { "vendor": "Fine Point-High Export" }, @@ -85517,6 +85802,9 @@ "11162763": { "vendor": "Tintri" }, + "11172003": { + "vendor": "Dongguan Yiertek Co., Ltd" + }, "11197511": { "vendor": "Cachengo, Inc." }, @@ -87992,6 +88280,9 @@ "11811377": { "vendor": "Silicon Laboratories" }, + "11811397": { + "vendor": "Espressif Inc." + }, "11811554": { "vendor": "Huawei Technologies Co.,Ltd" }, @@ -88538,6 +88829,9 @@ "11848121": { "vendor": "Sichuan AI-Link Technology Co., Ltd." }, + "11848413": { + "vendor": "Cisco Systems, Inc" + }, "11848535": { "vendor": "Guangdong Oppo Mobile Telecommunications Corp.,Ltd" }, @@ -88679,6 +88973,9 @@ "11855938": { "vendor": "Hong Kong Bouffalo Lab Limited" }, + "11855964": { + "vendor": "fünfeinhalb Funksysteme GmbH" + }, "11856073": { "vendor": "XADA Technologies" }, @@ -89675,6 +89972,9 @@ "12113127": { "vendor": "Hewlett Packard Enterprise" }, + "12113143": { + "vendor": "New H3C Technologies Co., Ltd" + }, "12113163": { "vendor": "Sunitec Enterprise Co.,Ltd" }, @@ -90728,6 +91028,9 @@ "12369310": { "vendor": "Itel Mobile Limited" }, + "12369659": { + "vendor": "ASL Xiamen Technology CO., LTD" + }, "12369935": { "vendor": "Fiberhome Telecommunication Technologies Co.,LTD" }, @@ -90917,6 +91220,9 @@ "12382895": { "vendor": "devolo AG" }, + "12382949": { + "vendor": "Powerful Devices" + }, "12382992": { "vendor": "Extreme Networks Headquarters" }, @@ -91133,6 +91439,12 @@ "12594298": { "vendor": "Shenzhen Horn Audio Co.,Ltd." }, + "12594413": { + "vendor": "Silicon Laboratories" + }, + "12594478": { + "vendor": "China Mobile Group Device Co.,Ltd." + }, "12594670": { "vendor": "Cuff" }, @@ -91304,6 +91616,9 @@ "12603774": { "vendor": "Hangzhou Hikvision Digital Technology Co.,Ltd." }, + "12603891": { + "vendor": "Cig Shanghai Co Ltd" + }, "12603956": { "vendor": "Huawei Technologies Co.,Ltd" }, @@ -91946,6 +92261,9 @@ "12646439": { "vendor": "Rapidmax Technology Corporation" }, + "12646483": { + "vendor": "Tuya Smart Inc." + }, "12646527": { "vendor": "Cisco Systems, Inc" }, @@ -93473,6 +93791,9 @@ "13128289": { "vendor": "Commscope" }, + "13128457": { + "vendor": "LCFC(Hefei) Electronics Technology co., ltd" + }, "13128673": { "vendor": "Beijing Bytedance Network Technology Co., Ltd" }, @@ -94205,6 +94526,9 @@ "13171494": { "vendor": "Cisco SPVTG" }, + "13171540": { + "vendor": "iMin Technology Pte. Ltd." + }, "13171993": { "vendor": "Texas Instruments" }, @@ -94343,6 +94667,9 @@ "13373786": { "vendor": "Apple, Inc." }, + "13373992": { + "vendor": "Hisense Visual Technology Co.,Ltd" + }, "13374630": { "vendor": "Yichun MyEnergy Domain, Inc" }, @@ -94385,6 +94712,9 @@ "13377676": { "vendor": "Huawei Technologies Co.,Ltd" }, + "13377708": { + "vendor": "Samsung Electronics Co.,Ltd" + }, "13377768": { "vendor": "Apple, Inc." }, @@ -94874,6 +95204,9 @@ "13404669": { "vendor": "Nokia Corporation" }, + "13404804": { + "vendor": "Huawei Device Co., Ltd." + }, "13405207": { "vendor": "Itel Mobile Limited" }, @@ -95154,7 +95487,7 @@ "vendor": "Silicon Laboratories" }, "13421802": { - "vendor": "PHOENIX CONTACT Electronics GmbH" + "vendor": "Phoenix Contact GmbH & Co. KG" }, "13421924": { "vendor": "SM-Electronic GmbH" @@ -95222,6 +95555,9 @@ "13425184": { "vendor": "Beijing Xiaomi Mobile Software Co., Ltd" }, + "13425333": { + "vendor": "Texas Instruments" + }, "13425412": { "vendor": "DataRemote Inc." }, @@ -96548,6 +96884,9 @@ "13904085": { "vendor": "TCT mobile ltd" }, + "13904295": { + "vendor": "Infinix mobility limited" + }, "13904362": { "vendor": "Zimory GmbH" }, @@ -97421,6 +97760,9 @@ "13951807": { "vendor": "Nokia" }, + "13951941": { + "vendor": "zte corporation" + }, "13952695": { "vendor": "Samsung Electronics Co.,Ltd" }, @@ -97704,7 +98046,7 @@ "vendor": "Avnet Silica" }, "14164960": { - "vendor": "Speedtech Corp." + "vendor": "Speedtech Corp. Jio" }, "14165111": { "vendor": "Universal Electric Corporation" @@ -97889,6 +98231,9 @@ "14174511": { "vendor": "Canon Inc." }, + "14174655": { + "vendor": "Celestica Inc." + }, "14174763": { "vendor": "zte corporation" }, @@ -98429,6 +98774,9 @@ "14206920": { "vendor": "Hewlett Packard Enterprise" }, + "14206988": { + "vendor": "Tuya Smart Inc." + }, "14207209": { "vendor": "Phicomm (Shanghai) Co., Ltd." }, @@ -98615,6 +98963,9 @@ "14217563": { "vendor": "Espressif Inc." }, + "14217688": { + "vendor": "Oi Electric Co.,Ltd" + }, "14217712": { "vendor": "Pepxim International Limited" }, @@ -98984,6 +99335,9 @@ "14434789": { "vendor": "Shenzhen Zhixin Data Service Co., Ltd." }, + "14435016": { + "vendor": "Huawei Device Co., Ltd." + }, "14435437": { "vendor": "Allwinner Technology Co., Ltd" }, @@ -99920,6 +100274,9 @@ "14688770": { "vendor": "Commscope" }, + "14688929": { + "vendor": "AltoBeam Inc." + }, "14689239": { "vendor": "Sleep Number" }, @@ -100043,6 +100400,9 @@ "14696061": { "vendor": "data-complex GmbH" }, + "14696139": { + "vendor": "Qingdao Intelligent&Precise Electronics Co.,Ltd." + }, "14696265": { "vendor": "ASUSTek COMPUTER INC." }, @@ -100736,6 +101096,9 @@ "14737833": { "vendor": "Shenzhen Four Seas Global Link Network Technology Co., Ltd." }, + "14738129": { + "vendor": "Beijing Netswift Technology Co.,Ltd." + }, "14738150": { "vendor": "Espressif Inc." }, @@ -101198,6 +101561,9 @@ "14966071": { "vendor": "Juniper Networks" }, + "14966073": { + "vendor": "Texas Instruments" + }, "14966097": { "vendor": "Sfr" }, @@ -101237,6 +101603,9 @@ "14967492": { "vendor": "Cisco Systems, Inc" }, + "14967879": { + "vendor": "EM Microelectronic" + }, "14967881": { "vendor": "Commscope" }, @@ -101834,6 +102203,9 @@ "15007045": { "vendor": "Intel Corporate" }, + "15007116": { + "vendor": "Extreme Networks Headquarters" + }, "15007137": { "vendor": "Huawei Technologies Co.,Ltd" }, @@ -102719,6 +103091,9 @@ "15257094": { "vendor": "SkyHawke Technologies, LLC." }, + "15257475": { + "vendor": "Dell Inc." + }, "15257660": { "vendor": "Shenzhen Jingxun Software Telecommunication Technology Co.,Ltd" }, @@ -103508,6 +103883,9 @@ "15496407": { "vendor": "Grandstream Networks Inc" }, + "15496460": { + "vendor": "TP-Link Systems Inc." + }, "15496510": { "vendor": "Huawei Technologies Co.,Ltd" }, @@ -106214,6 +106592,9 @@ "16254236": { "vendor": "DRS Imaging and Targeting Solutions" }, + "16254340": { + "vendor": "EM Microelectronic" + }, "16254813": { "vendor": "Huawei Device Co., Ltd." }, @@ -106286,6 +106667,9 @@ "16258375": { "vendor": "Avaya Inc" }, + "16258528": { + "vendor": "Siemens Canada" + }, "16258572": { "vendor": "Shenzhen iComm Semiconductor CO.,LTD" }, @@ -106868,6 +107252,9 @@ "16290090": { "vendor": "GLP German Light Products GmbH" }, + "16290159": { + "vendor": "Texas Instruments" + }, "16290163": { "vendor": "Aedle Sas" }, @@ -107144,6 +107531,9 @@ "16303736": { "vendor": "Carefusion" }, + "16304387": { + "vendor": "Tp-Link Technologies Co.,Ltd." + }, "16304492": { "vendor": "Fiberhome Telecommunication Technologies Co.,LTD" }, @@ -107165,6 +107555,9 @@ "16305671": { "vendor": "Zhejiang Dahua Technologyco.,Ltd" }, + "16305697": { + "vendor": "Tp-Link Technologies Co.,Ltd." + }, "16305778": { "vendor": "Wistron Corporation" }, @@ -107342,6 +107735,9 @@ "16314970": { "vendor": "G-Lab GmbH" }, + "16315347": { + "vendor": "Shenzhen Gotron electronic CO.,LTD" + }, "16315492": { "vendor": "Rawe Electonic GmbH" }, @@ -108257,6 +108653,9 @@ "16561382": { "vendor": "Askey Computer Corp" }, + "16561527": { + "vendor": "Cortex Security Inc" + }, "16561541": { "vendor": "Shenzhen Water World Information Co.,Ltd." }, @@ -108314,6 +108713,9 @@ "16564958": { "vendor": "Murata Manufacturing Co., Ltd." }, + "16564965": { + "vendor": "Holowits Technologies Co.,Ltd" + }, "16566068": { "vendor": "Samsung Electronics Co.,Ltd" }, @@ -108844,7 +109246,21 @@ { "mask": 28, "vendors": { - "13501917560832": "Digital Telemedia Technology Private Limited" + "13501917560832": "Digital Telemedia Technology Private Limited", + "13501918609408": "Shanghai BST Electric Co.,ltd", + "13501919657984": "Annapurna labs", + "13501920706560": "Hongkong Stoneoim Technology Limited", + "13501921755136": "Private", + "13501922803712": "Everon Co., Ltd.", + "13501923852288": "Shenzhen Hahappylife Innovations Electronics Technology Co.,Ltd", + "13501924900864": "Annapurna labs", + "13501925949440": "Honest Networks LLC", + "13501926998016": "Shanghai Sigen New Energy Technology Co., Ltd", + "13501928046592": "Lens Technology (Xiangtan) Co.,Ltd", + "13501929095168": "Shenzhen Hebang Electronic Co., Ltd", + "13501930143744": "Annapurna labs", + "13501931192320": "Dig_Link", + "13501932240896": "BGResearch" } } ] @@ -109871,7 +110287,7 @@ "39986087854080": "Torgovyy Dom Tehnologiy Llc", "39986088902656": "Tata Sky Limited", "39986089951232": "Only", - "39986090999808": "Senix Corporation", + "39986090999808": "Senix", "39986092048384": "Hunan Honestone lntelligence Technology Co.,Ltd", "39986093096960": "Dodge" } @@ -110215,7 +110631,7 @@ "48829970776064": "Katek Se", "48829971824640": "Abode Systems Inc", "48829972873216": "Sunsa, Inc", - "48829973921792": "Speedtech Corp.", + "48829973921792": "Speedtech Corp. Jio", "48829974970368": "LG Electronics Inc.", "48829976018944": "Carnegie Robotics", "48829977067520": "Shenzhen Gigalight Technology Co., Ltd", @@ -114028,6 +114444,25 @@ } ] }, + "9472169": { + "vendor": "", + "maskedFilters": [ + { + "mask": 28, + "vendors": { + "158916625301504": "shenzhen zovoton electronic co.,ltd", + "158916627398656": "合肥乾盾智能科技有限公司", + "158916629495808": "asmote ltd.", + "158916630544384": "Shortcut Labs AB", + "158916631592960": "Skysolid Information Security Systems(Shenzhen) Co., Ltd", + "158916633690112": "Samway Electronic SRL", + "158916635787264": "Yi Tunnel(beijing) Technology Co.,Ltd", + "158916636835840": "UXV Technologies ApS", + "158916638932992": "Remowireless Communication International Co.,Limited" + } + } + ] + }, "9480695": { "vendor": "", "maskedFilters": [ @@ -117120,6 +117555,31 @@ } ] }, + "15496397": { + "vendor": "", + "maskedFilters": [ + { + "mask": 28, + "vendors": { + "259986399690752": "Nexxus Networks Pte Ltd", + "259986400739328": "Shenzhen C & D Electronics Co., Ltd.", + "259986401787904": "L.T.H. Electronics Limited", + "259986402836480": "iSolution Technologies Co.,Ltd.", + "259986403885056": "Vialis BV", + "259986404933632": "Standard Backhaul Communications", + "259986405982208": "Platypus", + "259986407030784": "KONČAR - Electrical Engineering Institute Ltd.", + "259986408079360": "Trans Audio Video Srl", + "259986409127936": "Sound Health Systems", + "259986410176512": "Bosch (zhuhai) Security Systems Company, Ltd.", + "259986411225088": "Hitachi Rail GTS Austria GmbH", + "259986412273664": "Smart Data (Shenzhen) Intelligent System Co., Ltd.", + "259986413322240": "Shenzhen Ting-Shine Technology Co., Ltd.", + "259986414370816": "Shenzhen Eweat Technology Co.,Ltd" + } + } + ] + }, "15505932": { "vendor": "", "maskedFilters": [ @@ -124787,7 +125247,7 @@ "123917684031488": "IHI Rotating Machinery Engineering Co.,Ltd.", "123917684035584": "e-Matix Corporation", "123917684039680": "Innovative Control Systems, LP", - "123917684043776": "Levelup Holding, Inc.", + "123917684043776": "Level Up Holding Co., Inc.", "123917684047872": "Dm Radiocom", "123917684051968": "Tiama", "123917684056064": "Winners Digital Corporation", @@ -126853,16 +127313,19 @@ "154066450976768": "Gogo Business Aviation", "154066450989056": "Flextronics International Kft", "154066450993152": "Slat", + "154066451009536": "Mediana Co., Ltd.", "154066451013632": "ASHIDA Electronics Pvt. Ltd", "154066451021824": "Tron Future Tech Inc.", "154066451025920": "Nhoa Energy Srl", "154066451030016": "Dynomotion, Inc", "154066451054592": "Revo - Tec GmbH", "154066451062784": "Hikari Alphax Inc.", + "154066451075072": "Creative Telecom Pvt. Ltd.", "154066451083264": "TKR Spezialwerkzeuge GmbH", "154066451091456": "Xiamen Rgblink Science & Technology Co., Ltd.", "154066451095552": "Benchmark Electronics BV", "154066451103744": "Fracarro Radioindustrie Srl", + "154066451124224": "Wuhan YiValley Opto-electric technology Co.,Ltd", "154066451132416": "Emcom Systems", "154066451140608": "Agrowtek Inc.", "154066451148800": "Bavaria Digital Technik GmbH", @@ -126893,6 +127356,7 @@ "154066451394560": "Rax-Tech International", "154066451402752": "D.T.S Illuminazione Srl", "154066451410944": "Renwei Electronics Technology (Shenzhen) Co.,LTD.", + "154066451415040": "Transit Solutions, LLC.", "154066451419136": "Dorlet Sau", "154066451423232": "Mideum Eng", "154066451427328": "Ossia Inc", @@ -126926,6 +127390,7 @@ "154066451697664": "Hiwin Mikrosystem Corp.", "154066451705856": "ENTOSS Co.,Ltd", "154066451709952": "castcore", + "154066451718144": "Kryfs Technologies Private Limited", "154066451726336": "Sichuan AnSphere Technology Co. Ltd.", "154066451742720": "Shanghai Stairmed Technology Co.,ltd", "154066451746816": "Grossenbacher Systeme AG", @@ -126969,6 +127434,7 @@ "154066452119552": "Astro Machine Corporation", "154066452144128": "Koizumi Lighting Technology Corp.", "154066452152320": "Xi‘an Hangguang Satellite and Control Technology Co.,Ltd", + "154066452160512": "Comminent Pvt Ltd", "154066452164608": "Distran AG", "154066452168704": "Invixium Access Inc", "154066452197376": "Oriux", @@ -126985,6 +127451,7 @@ "154066452299776": "nanoTRONIX Computing Inc.", "154066452307968": "Roog zhi tong Technology(Beijing) Co.,Ltd", "154066452316160": "Megger Germany GmbH", + "154066452320256": "Integer.pl S.A.", "154066452328448": "TT electronics integrated manufacturing services (Suzhou) Limited", "154066452344832": "Nagtech Llc", "154066452348928": "Connected Development", @@ -127023,6 +127490,7 @@ "154066452623360": "Erba Lachema s.r.o.", "154066452631552": "GS Elektromedizinsiche Geräte G. Stemple GmbH", "154066452643840": "Sonora Network Solutions", + "154066452668416": "Qualitrol LLC", "154066452672512": "Invisense AB", "154066452676608": "Switch Science, Inc.", "154066452680704": "DEUTA Werke GmbH", @@ -127116,6 +127584,7 @@ "154066453336064": "Cpc (Uk)", "154066453340160": "mmc kommunikationstechnologie gmbh", "154066453344256": "Gre System Inc.", + "154066453348352": "Ceranext Ltd", "154066453352448": "Beijing Ceresdata Technology Co., LTD", "154066453360640": "Intel Corporate", "154066453364736": "Software Systems Plus", @@ -127135,6 +127604,7 @@ "154066453487616": "Tex Computer Srl", "154066453491712": "Ai-Blox", "154066453495808": "Hubris Technologies Private Limited", + "154066453504000": "Mitsubishi Electric India Pvt. Ltd.", "154066453508096": "Clausal Computing Oy", "154066453516288": "Oriux", "154066453528576": "Snek", @@ -127179,6 +127649,7 @@ "154066453872640": "INSEVIS GmbH", "154066453884928": "Fracarro srl", "154066453893120": "Naval Group", + "154066453901312": "Energy Power Products Limited", "154066453905408": "KSE GmbH", "154066453909504": "Aspen Spectra Sdn Bhd", "154066453913600": "Linxpeed Limited", @@ -127198,6 +127669,7 @@ "154066454061056": "Potter Electric Signal Co LLC", "154066454073344": "Figment Design Laboratories", "154066454093824": "Onbitel", + "154066454106112": "Design and Manufacturing Vista Electronics Pvt.Ltd.", "154066454110208": "GVA Lighting, Inc.", "154066454114304": "RealD, Inc.", "154066454122496": "Guan Show Technologe Co., Ltd.", @@ -127313,6 +127785,7 @@ "154066455085056": "Filgis Elektronik", "154066455089152": "Nexcontech", "154066455097344": "Velvac Incorporated", + "154066455101440": "Enclavamientos y Señalización Ferroviaria Enyse S.A.", "154066455109632": "Landis+Gyr Equipamentos de Medição Ltda", "154066455117824": "Tinkerbee Innovations Private Limited", "154066455134208": "Beijing Congyun Technology Co.,Ltd", @@ -127373,6 +127846,7 @@ "154066455576576": "Axion Lighting", "154066455588864": "Vortex Sp. z o.o.", "154066455597056": "ViewSonic Corp", + "154066455601152": "Connectcom System Co., Ltd", "154066455609344": "Heitec Ag", "154066455613440": "MPT-Service project", "154066455617536": "Benchmark Electronics BV", @@ -127454,6 +127928,7 @@ "154066456268800": "Action Streamer LLC", "154066456276992": "Astrometric Instruments, Inc.", "154066456281088": "Llc Ntpc", + "154066456285184": "Spyder Controls Corp.", "154066456289280": "Suzhou Leamore Optronics Co., Ltd.", "154066456293376": "mal-tech Technological Solutions Ltd/CRISP", "154066456297472": "Thermoeye Inc", @@ -127569,6 +128044,7 @@ "154066457235456": "Tiama", "154066457243648": "AR Modular RF", "154066457255936": "OpenPark Technologies Kft", + "154066457268224": "CITSA Technologies Private Limited", "154066457284608": "Flextronics International Kft", "154066457288704": "Star Systems International Limited", "154066457300992": "Systel Inc", @@ -127576,6 +128052,7 @@ "154066457325568": "ASTRACOM Co. Ltd", "154066457329664": "Q-Light AS", "154066457337856": "Support Professionals B.V.", + "154066457341952": "Anduril Imaging", "154066457346048": "nanoTRONIX Computing Inc.", "154066457350144": "Micro Electroninc Products", "154066457358336": "CAES Systems LLC", @@ -127596,6 +128073,7 @@ "154066457460736": "HME Co.,ltd", "154066457468928": "Atm Llc", "154066457489408": "Tabology", + "154066457497600": "DEUTA Werke GmbH", "154066457522176": "Connection Systems", "154066457538560": "Aditec GmbH", "154066457554944": "Alban Giacomo S.p.a.", @@ -127655,8 +128133,10 @@ "154066457968640": "Mitsubishi Electric Klimat Transportation Systems S.p.A.", "154066457985024": "Shenzhen SDG Telecom Equipment Co.,Ltd.", "154066457989120": "Zhejiang Laolan Information Technology Co., Ltd", + "154066457993216": "Daiichi Electric Industry Co., Ltd", "154066457997312": "MOSCA Elektronik und Antriebstechnik GmbH", "154066458001408": "EA Elektro-Automatik", + "154066458009600": "Matrixspace", "154066458013696": "Giordano Controls Spa", "154066458034176": "Thermify Holdings Ltd", "154066458042368": "TxWireless Limited", @@ -127801,6 +128281,7 @@ "154066459205632": "Thermo Onix Ltd", "154066459217920": "IVOR Intelligent Electrical Appliance Co., Ltd", "154066459234304": "Noptel Oy", + "154066459250688": "Breas Medical AB", "154066459254784": "Jiangsu Eman Electronic Technology Co., Ltd", "154066459258880": "H2Ok Innovations", "154066459267072": "SPIT Technology, Inc", @@ -127859,6 +128340,7 @@ "154066459762688": "Emerson Rosemount Analytical", "154066459766784": "Böckelt GmbH", "154066459779072": "GS Elektromedizinsiche Geräte G. Stemple GmbH", + "154066459787264": "Makel Elektrik Malzemeleri A.Ş.", "154066459791360": "Quercus Technologies, S.L.", "154066459795456": "Wintus System", "154066459807744": "Atm Solutions", @@ -127885,6 +128367,7 @@ "154066459975680": "MB connect line GmbH Fernwartungssysteme", "154066459979776": "MicroPilot Inc.", "154066459983872": "GHM Messtechnik GmbH", + "154066459992064": "MSolutions", "154066460000256": "Specialized Communications Corp.", "154066460016640": "ePlant, Inc.", "154066460020736": "Skymira", @@ -127955,6 +128438,7 @@ "154066460631040": "Global Design Tech(ZS) Co.,Ltd", "154066460635136": "Morgen Technology", "154066460643328": "Mitsubishi Electric India Pvt. Ltd.", + "154066460655616": "Elektronik Art", "154066460672000": "DSGio Global Pte Ltd", "154066460676096": "Infinitive Group Limited", "154066460680192": "Agrology, PBC", @@ -128094,11 +128578,13 @@ "154066461831168": "Ycn", "154066461839360": "Jemac Sweden AB", "154066461843456": "Tieline Research Pty Ltd", + "154066461851648": "Shanghai Sansi Electronic Engineering Co., Ltd.", "154066461855744": "Transit Solutions, LLC.", "154066461859840": "Grupo Epelsa S.L.", "154066461863936": "Zaruc Tecnologia LTDA", "154066461868032": "HIGH RIGHT CO.,Ltd", "154066461880320": "Jiangxi Lv C-Chong Charging Technology Co.Ltd", + "154066461884416": "ezDOOR, LLC", "154066461888512": "SmartD Technologies Inc", "154066461900800": "Liberator Pty Ltd", "154066461908992": "AirScan, Inc. dba HemaTechnologies", @@ -128189,6 +128675,7 @@ "154066462543872": "Tunstall A/S", "154066462560256": "Alfa Proxima d.o.o.", "154066462564352": "YUYAMA MFG Co.,Ltd", + "154066462572544": "Intelligent Security Systems (ISS)", "154066462576640": "Beijing Ceresdate Technology Co.,LTD", "154066462580736": "GMI Ltd", "154066462588928": "Ajeco Oy", @@ -128346,6 +128833,7 @@ "154066463977472": "Lambda Systems Inc.", "154066463985664": "Ermes Elettronica s.r.l.", "154066463989760": "Electronic Equipment Company Pvt. Ltd.", + "154066463993856": "Würth Elektronik ICS GmbH & Co. KG", "154066464002048": "Giordano Controls Spa", "154066464010240": "Rugged Controls", "154066464014336": "Pigs Can Fly Labs LLC", @@ -128439,6 +128927,7 @@ "154066464784384": "Ashinne Technology Co., Ltd", "154066464800768": "Power Electronics Espana, S.L.", "154066464825344": "ComVetia AG", + "154066464833536": "SiFive Inc", "154066464837632": "PADL Software Pty Ltd", "154066464841728": "Changzhou MITO electronics Technology Co;LTD", "154066464845824": "Televic Rail GmbH", @@ -128494,6 +128983,7 @@ "154066465398784": "CAITRON GmbH", "154066465402880": "ACS Motion Control", "154066465406976": "Elektrosil GmbH", + "154066465427456": "Hurry-tech", "154066465435648": "Nextep Co.,Ltd.", "154066465439744": "Rigel Engineering, LLC", "154066465443840": "MB connect line GmbH Fernwartungssysteme", @@ -128539,6 +129029,7 @@ "154066465751040": "YUYAMA MFG Co.,Ltd", "154066465767424": "Sonatronic", "154066465771520": "Ophir Manufacturing Solutions Pte Ltd", + "154066465779712": "Motion Impossible Ltd", "154066465783808": "Vision Systems Safety Tech", "154066465792000": "Contrader", "154066465800192": "GE AVIC Civil Avionics Systems Company Limited", @@ -128592,6 +129083,7 @@ "154066466205696": "Beijing Yahong Century Technology Co., Ltd", "154066466217984": "Arkham Technology", "154066466226176": "Nuphoton Technologies", + "154066466238464": "Potter Electric Signal Company", "154066466242560": "Potter Electric Signal Company", "154066466250752": "VUV Analytics, Inc.", "154066466254848": "Power Electronics Espana, S.L.", From 82f064b6a390035c95691b09f6b8e0d5b156454f Mon Sep 17 00:00:00 2001 From: seladb Date: Sun, 1 Dec 2024 13:51:56 -0800 Subject: [PATCH 02/11] Auto precommit update (#1650) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Auto pre-commit update * Update README.md * Update dirent.h --------- Co-authored-by: GitHub Co-authored-by: Ege Çetin <64282645+egecetin@users.noreply.github.com> --- .pre-commit-config.yaml | 6 +++--- Examples/PcapSearch/README.md | 2 +- .../PcapSearch/dirent-for-Visual-Studio/include/dirent.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6471f09781..7968bad2f9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,7 +22,7 @@ repos: args: ['--fix=lf'] - id: trailing-whitespace - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.7.1 + rev: v0.8.1 hooks: - id: ruff # Run the linter. types_or: [ python ] @@ -38,7 +38,7 @@ repos: - id: cppcheck args: ["--std=c++11", "--language=c++", "--suppressions-list=cppcheckSuppressions.txt", "--inline-suppr", "--force"] - repo: https://github.com/BlankSpruce/gersemi - rev: 0.17.0 + rev: 0.17.1 hooks: - id: gersemi - repo: https://github.com/codespell-project/codespell @@ -47,7 +47,7 @@ repos: - id: codespell pass_filenames: false - repo: https://github.com/crate-ci/typos - rev: v1.26.8 + rev: v1.28.1 hooks: - id: typos args: ['--config=typos-config.toml'] diff --git a/Examples/PcapSearch/README.md b/Examples/PcapSearch/README.md index 564c99476e..8f5ffdff9b 100644 --- a/Examples/PcapSearch/README.md +++ b/Examples/PcapSearch/README.md @@ -33,6 +33,6 @@ Using the utility -s search_criteria : Criteria to search in Berkeley Packet Filter (BPF) syntax (http://biot.com/capstats/bpf.html) i.e: 'ip net 1.1.1.1' -r file_name : Write a detailed search report to a file -e extension_list : Set file extensions to search. The default is searching '.pcap' and '.pcapng' files. - extnesions_list should be a comma-separated list of extensions, for example: pcap,net,dmp + extension_list should be a comma-separated list of extensions, for example: pcap,net,dmp -v : Displays the current version and exists -h : Displays this help message and exits diff --git a/Examples/PcapSearch/dirent-for-Visual-Studio/include/dirent.h b/Examples/PcapSearch/dirent-for-Visual-Studio/include/dirent.h index 6adbbfdfa5..6bcd8059ab 100644 --- a/Examples/PcapSearch/dirent-for-Visual-Studio/include/dirent.h +++ b/Examples/PcapSearch/dirent-for-Visual-Studio/include/dirent.h @@ -846,7 +846,7 @@ extern "C" wcstr[n] = 0; } - /* Length of resuting multi-byte string WITH zero terminator */ + /* Length of resulting multi-byte string WITH zero terminator */ if (pReturnValue) { *pReturnValue = n + 1; From 871cbad5b4842ba5ef0e72958f25bf6b6b2b523c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 1 Dec 2024 15:44:51 -0800 Subject: [PATCH 03/11] Bump the pip-dependencies group across 2 directories with 2 updates (#1651) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Bump the pip-dependencies group across 2 directories with 2 updates Bumps the pip-dependencies group with 2 updates in the /Tests/ExamplesTest directory: [pyparsing](https://github.com/pyparsing/pyparsing) and [scapy](https://github.com/secdev/scapy). Bumps the pip-dependencies group with 1 update in the /ci/run_tests directory: [scapy](https://github.com/secdev/scapy). Updates `pyparsing` from 3.1.4 to 3.2.0 - [Release notes](https://github.com/pyparsing/pyparsing/releases) - [Changelog](https://github.com/pyparsing/pyparsing/blob/master/CHANGES) - [Commits](https://github.com/pyparsing/pyparsing/compare/3.1.4...3.2.0) Updates `scapy` from 2.6.0 to 2.6.1 - [Release notes](https://github.com/secdev/scapy/releases) - [Commits](https://github.com/secdev/scapy/compare/v2.6.0...v2.6.1) Updates `scapy` from 2.6.0 to 2.6.1 - [Release notes](https://github.com/secdev/scapy/releases) - [Commits](https://github.com/secdev/scapy/compare/v2.6.0...v2.6.1) --- updated-dependencies: - dependency-name: pyparsing dependency-type: direct:production update-type: version-update:semver-minor dependency-group: pip-dependencies - dependency-name: scapy dependency-type: direct:production update-type: version-update:semver-patch dependency-group: pip-dependencies - dependency-name: scapy dependency-type: direct:production update-type: version-update:semver-patch dependency-group: pip-dependencies ... Signed-off-by: dependabot[bot] * Update pyparsing version in requirements.txt since ubuntu 20.04 not supports --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ege Çetin <64282645+egecetin@users.noreply.github.com> --- Tests/ExamplesTest/requirements.txt | 2 +- ci/run_tests/requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Tests/ExamplesTest/requirements.txt b/Tests/ExamplesTest/requirements.txt index e3c641046f..65b26b5092 100644 --- a/Tests/ExamplesTest/requirements.txt +++ b/Tests/ExamplesTest/requirements.txt @@ -3,5 +3,5 @@ iniconfig==2.0.0 py==1.11.0 pyparsing==3.1.4 pytest==8.3.3 -scapy==2.6.0 +scapy==2.6.1 toml==0.10.2 diff --git a/ci/run_tests/requirements.txt b/ci/run_tests/requirements.txt index 5f8a78b51a..ffc5bb660a 100644 --- a/ci/run_tests/requirements.txt +++ b/ci/run_tests/requirements.txt @@ -1 +1 @@ -scapy==2.6.0 +scapy==2.6.1 From 6ae4d2d809d91313392153e1f79ef1ab3fa0d0ba Mon Sep 17 00:00:00 2001 From: Dimitar Krastev Date: Mon, 2 Dec 2024 21:26:02 +0200 Subject: [PATCH 04/11] Moved ostream << operators for IPAddress and MacAddress inside pcpp namespace to ensure argument dependent lookup. (#1648) --- Common++/header/IpAddress.h | 63 ++++++++++++++++++------------------ Common++/header/MacAddress.h | 12 +++---- 2 files changed, 38 insertions(+), 37 deletions(-) diff --git a/Common++/header/IpAddress.h b/Common++/header/IpAddress.h index 243dae0ef9..a156e8aace 100644 --- a/Common++/header/IpAddress.h +++ b/Common++/header/IpAddress.h @@ -1082,40 +1082,41 @@ namespace pcpp std::unique_ptr m_IPv4Network; std::unique_ptr m_IPv6Network; }; -} // namespace pcpp -inline std::ostream& operator<<(std::ostream& os, const pcpp::IPv4Address& ipv4Address) -{ - os << ipv4Address.toString(); - return os; -} + inline std::ostream& operator<<(std::ostream& os, const pcpp::IPv4Address& ipv4Address) + { + os << ipv4Address.toString(); + return os; + } -inline std::ostream& operator<<(std::ostream& os, const pcpp::IPv6Address& ipv6Address) -{ - os << ipv6Address.toString(); - return os; -} + inline std::ostream& operator<<(std::ostream& os, const pcpp::IPv6Address& ipv6Address) + { + os << ipv6Address.toString(); + return os; + } -inline std::ostream& operator<<(std::ostream& os, const pcpp::IPAddress& ipAddress) -{ - os << ipAddress.toString(); - return os; -} + inline std::ostream& operator<<(std::ostream& os, const pcpp::IPAddress& ipAddress) + { + os << ipAddress.toString(); + return os; + } -inline std::ostream& operator<<(std::ostream& os, const pcpp::IPv4Network& network) -{ - os << network.toString(); - return os; -} + inline std::ostream& operator<<(std::ostream& os, const pcpp::IPv4Network& network) + { + os << network.toString(); + return os; + } -inline std::ostream& operator<<(std::ostream& os, const pcpp::IPv6Network& network) -{ - os << network.toString(); - return os; -} + inline std::ostream& operator<<(std::ostream& os, const pcpp::IPv6Network& network) + { + os << network.toString(); + return os; + } -inline std::ostream& operator<<(std::ostream& os, const pcpp::IPNetwork& network) -{ - os << network.toString(); - return os; -} + inline std::ostream& operator<<(std::ostream& os, const pcpp::IPNetwork& network) + { + os << network.toString(); + return os; + } + +} // namespace pcpp diff --git a/Common++/header/MacAddress.h b/Common++/header/MacAddress.h index 29333aa02d..8b59f7d53c 100644 --- a/Common++/header/MacAddress.h +++ b/Common++/header/MacAddress.h @@ -173,10 +173,10 @@ namespace pcpp private: uint8_t m_Address[6] = { 0 }; }; -} // namespace pcpp -inline std::ostream& operator<<(std::ostream& os, const pcpp::MacAddress& macAddress) -{ - os << macAddress.toString(); - return os; -} + inline std::ostream& operator<<(std::ostream& os, const pcpp::MacAddress& macAddress) + { + os << macAddress.toString(); + return os; + } +} // namespace pcpp From 04bde0d36599218429f4743ad5124d3c818136f9 Mon Sep 17 00:00:00 2001 From: seladb Date: Tue, 3 Dec 2024 09:51:42 -0800 Subject: [PATCH 05/11] Use `bind()` instead of `setsockopt()` for binding raw sockets on Linux (#1646) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update to `bind()` * Remove the `struct` keyword --------- Co-authored-by: Ege Çetin <64282645+egecetin@users.noreply.github.com> --- Pcap++/src/RawSocketDevice.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Pcap++/src/RawSocketDevice.cpp b/Pcap++/src/RawSocketDevice.cpp index 816d10b76c..40da2331e7 100644 --- a/Pcap++/src/RawSocketDevice.cpp +++ b/Pcap++/src/RawSocketDevice.cpp @@ -456,7 +456,7 @@ namespace pcpp int fd = socket(AF_PACKET, SOCK_RAW, htobe16(ETH_P_ALL)); if (fd < 0) { - PCPP_LOG_ERROR("Failed to create raw socket. Error code was " << errno); + PCPP_LOG_ERROR("Failed to create raw socket. Error code was " << strerror(errno)); return false; } @@ -505,12 +505,15 @@ namespace pcpp } // bind raw socket to interface - struct ifreq ifr; - memset(&ifr, 0, sizeof(ifr)); - snprintf(ifr.ifr_name, sizeof(ifr.ifr_name), "%s", ifaceName.c_str()); - if (setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, (void*)&ifr, sizeof(ifr)) == -1) + sockaddr_ll saddr; + memset(&saddr, 0, sizeof(saddr)); + saddr.sll_family = AF_PACKET; + saddr.sll_protocol = htons(ETH_P_ALL); + saddr.sll_ifindex = if_nametoindex(ifaceName.c_str()); + + if (bind(fd, reinterpret_cast(&saddr), sizeof(saddr)) < 0) { - PCPP_LOG_ERROR("Cannot bind raw socket to interface '" << ifaceName << "'"); + PCPP_LOG_ERROR("Cannot bind raw socket to interface '" << ifaceName << "': " << strerror(errno)); ::close(fd); return false; } From eb6127cf7c3c660101060662acbc036618a3bd54 Mon Sep 17 00:00:00 2001 From: seladb Date: Wed, 4 Dec 2024 08:23:36 -0800 Subject: [PATCH 06/11] Bump Android CI macOS version (#1653) --- .github/workflows/build_and_test.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 135b855209..cffea8db0b 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -630,11 +630,11 @@ jobs: - run-on-os: ubuntu-20.04 target: x86 api-version: 30 - - run-on-os: macos-12 + - run-on-os: macos-15 target: arm64-v8a cmake_configure: "-DCMAKE_OSX_ARCHITECTURES=arm64" api-version: 30 - - run-on-os: macos-12 + - run-on-os: macos-15 target: x86_64 cmake_configure: "-DCMAKE_OSX_ARCHITECTURES=x86_64" api-version: 30 @@ -679,6 +679,12 @@ jobs: mv ${TOYVPN_PCAPPLUSPLUS}/lib/*.a ${PCAPPLUSPLUS_LIBS_PATH}/ mv ${TOYVPN_PCAPPLUSPLUS}/include/pcapplusplus/*.h ${PCAPPLUSPLUS_INCLUDE_PATH}/ + - name: Set up JDK 8 + uses: actions/setup-java@v4 + with: + java-version: "8" + distribution: "zulu" + - name: Build ToyVpn-PcapPlusPlus working-directory: ./ToyVpn-PcapPlusPlus run: | From 3d0717b9a2093daab11203aba62ed0eab100c0b3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 4 Dec 2024 18:38:33 +0200 Subject: [PATCH 07/11] Bump the actions-dependencies group with 5 updates (#1652) * Bump the actions-dependencies group with 5 updates Bumps the actions-dependencies group with 5 updates: | Package | From | To | | --- | --- | --- | | [codecov/codecov-action](https://github.com/codecov/codecov-action) | `4.6.0` | `5.0.7` | | [msys2/setup-msys2](https://github.com/msys2/setup-msys2) | `2.24.1` | `2.25.0` | | [vmactions/freebsd-vm](https://github.com/vmactions/freebsd-vm) | `1.1.4` | `1.1.5` | | [github/codeql-action](https://github.com/github/codeql-action) | `3.27.0` | `3.27.5` | | [actions/attest-build-provenance](https://github.com/actions/attest-build-provenance) | `1.4.3` | `1.4.4` | Updates `codecov/codecov-action` from 4.6.0 to 5.0.7 - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238...015f24e6818733317a2da2edd6290ab26238649a) Updates `msys2/setup-msys2` from 2.24.1 to 2.25.0 - [Release notes](https://github.com/msys2/setup-msys2/releases) - [Changelog](https://github.com/msys2/setup-msys2/blob/main/CHANGELOG.md) - [Commits](https://github.com/msys2/setup-msys2/compare/ddf331adaebd714795f1042345e6ca57bd66cea8...c52d1fa9c7492275e60fe763540fb601f5f232a1) Updates `vmactions/freebsd-vm` from 1.1.4 to 1.1.5 - [Release notes](https://github.com/vmactions/freebsd-vm/releases) - [Commits](https://github.com/vmactions/freebsd-vm/compare/c96341966a3954a757e6ea41692f7c7b32312a0c...debf37ca7b7fa40e19c542ef7ba30d6054a706a4) Updates `github/codeql-action` from 3.27.0 to 3.27.5 - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/662472033e021d55d94146f66f6058822b0b39fd...f09c1c0a94de965c15400f5634aa42fac8fb8f88) Updates `actions/attest-build-provenance` from 1.4.3 to 1.4.4 - [Release notes](https://github.com/actions/attest-build-provenance/releases) - [Changelog](https://github.com/actions/attest-build-provenance/blob/main/RELEASE.md) - [Commits](https://github.com/actions/attest-build-provenance/compare/1c608d11d69870c2092266b3f9a6f3abbf17002c...ef244123eb79f2f7a7e75d99086184180e6d0018) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions-dependencies - dependency-name: msys2/setup-msys2 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: actions-dependencies - dependency-name: vmactions/freebsd-vm dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions-dependencies - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions-dependencies - dependency-name: actions/attest-build-provenance dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions-dependencies ... Signed-off-by: dependabot[bot] * Remove xcode 14.x since not supported --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: egecetin --- .github/workflows/build_and_test.yml | 14 +++++++------- .github/workflows/codeql.yml | 4 ++-- .github/workflows/package.yml | 22 ++++++++-------------- .github/workflows/scorecards.yml | 2 +- 4 files changed, 18 insertions(+), 24 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index cffea8db0b..c28480d3a9 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -146,7 +146,7 @@ jobs: gcovr -v -r . ${{ matrix.additional-gcov-flags }} $GCOVR_FLAGS -o coverage.xml - name: Upload Coverage Results - uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0 + uses: codecov/codecov-action@015f24e6818733317a2da2edd6290ab26238649a # v5.0.7 with: files: ./coverage.xml flags: ${{ matrix.image }},unittest @@ -394,7 +394,7 @@ jobs: gcovr -v -r . $GCOVR_FLAGS -o coverage.xml - name: Upload Coverage Results - uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0 + uses: codecov/codecov-action@015f24e6818733317a2da2edd6290ab26238649a # v5.0.7 if: ${{ matrix.host-arch == matrix.arch }} with: files: ./coverage.xml @@ -425,7 +425,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Setup MSYS2 - uses: msys2/setup-msys2@ddf331adaebd714795f1042345e6ca57bd66cea8 # v2.24.1 + uses: msys2/setup-msys2@c52d1fa9c7492275e60fe763540fb601f5f232a1 # v2.25.0 with: msystem: ${{matrix.sys}} install: >- @@ -483,7 +483,7 @@ jobs: run: gcovr -v -g -k -r . $env:GCOVR_FLAGS.split() -o coverage.xml - name: Upload Coverage Results - uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0 + uses: codecov/codecov-action@015f24e6818733317a2da2edd6290ab26238649a # v5.0.7 with: files: ./coverage.xml flags: ${{ matrix.sys }},unittest @@ -574,7 +574,7 @@ jobs: python -m pytest --root-path=../../Dist/examples_bin - name: Upload Coverage Results - uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0 + uses: codecov/codecov-action@015f24e6818733317a2da2edd6290ab26238649a # v5.0.7 with: files: ./Tests/Pcap++Test/Pcap++Coverage.xml,./Tests/Packet++Test/Packet++Coverage.xml flags: ${{ matrix.os }},unittest,${{ matrix.pcap_lib }} @@ -592,7 +592,7 @@ jobs: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Test in FreeBSD id: test - uses: vmactions/freebsd-vm@c96341966a3954a757e6ea41692f7c7b32312a0c # v1.1.4 + uses: vmactions/freebsd-vm@debf37ca7b7fa40e19c542ef7ba30d6054a706a4 # v1.1.5 with: release: ${{ matrix.version }} usesh: true @@ -743,7 +743,7 @@ jobs: gcovr -v -r . $GCOVR_FLAGS -o coverage.xml - name: Upload Coverage Results - uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0 + uses: codecov/codecov-action@015f24e6818733317a2da2edd6290ab26238649a # v5.0.7 with: files: ./coverage.xml flags: xdp,unittest diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 141cc892d9..ce610a1d98 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -29,7 +29,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@662472033e021d55d94146f66f6058822b0b39fd # v3.27.0 + uses: github/codeql-action/init@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -44,4 +44,4 @@ jobs: cmake --build build -j - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@662472033e021d55d94146f66f6058822b0b39fd # v3.27.0 + uses: github/codeql-action/analyze@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5 diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 880cd3da23..41233e85e3 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -72,7 +72,7 @@ jobs: - name: Generate artifact attestation if: github.ref_type == 'tag' - uses: actions/attest-build-provenance@1c608d11d69870c2092266b3f9a6f3abbf17002c # v1.4.3 + uses: actions/attest-build-provenance@ef244123eb79f2f7a7e75d99086184180e6d0018 # v1.4.4 with: subject-path: "${{ env.BUILD_DIR }}/*.tar.gz,${{ env.BUILD_DIR }}/*.deb,${{ env.BUILD_DIR }}/*.rpm" @@ -100,7 +100,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Test in FreeBSD - uses: vmactions/freebsd-vm@c96341966a3954a757e6ea41692f7c7b32312a0c # v1.1.4 + uses: vmactions/freebsd-vm@debf37ca7b7fa40e19c542ef7ba30d6054a706a4 # v1.1.5 with: release: ${{ matrix.version }} envs: 'BUILD_DIR' @@ -114,7 +114,7 @@ jobs: - name: Generate artifact attestation if: github.ref_type == 'tag' - uses: actions/attest-build-provenance@1c608d11d69870c2092266b3f9a6f3abbf17002c # v1.4.3 + uses: actions/attest-build-provenance@ef244123eb79f2f7a7e75d99086184180e6d0018 # v1.4.4 with: subject-path: "${{ env.BUILD_DIR }}/*.tar.gz" @@ -142,12 +142,6 @@ jobs: - os-version: macos-14 xcode-version: 15.4 arch: arm64 - - os-version: macos-14 - xcode-version: 14.3.1 - arch: x86_64 - - os-version: macos-14 - xcode-version: 14.3.1 - arch: arm64 - os-version: macos-15 xcode-version: 16.0.0 arch: x86_64 @@ -175,7 +169,7 @@ jobs: - name: Generate artifact attestation if: github.ref_type == 'tag' - uses: actions/attest-build-provenance@1c608d11d69870c2092266b3f9a6f3abbf17002c # v1.4.3 + uses: actions/attest-build-provenance@ef244123eb79f2f7a7e75d99086184180e6d0018 # v1.4.4 with: subject-path: "${{ env.BUILD_DIR }}/*.tar.gz,${{ env.BUILD_DIR }}/*.pkg" @@ -207,7 +201,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Setup MSYS2 - uses: msys2/setup-msys2@ddf331adaebd714795f1042345e6ca57bd66cea8 # v2.24.1 + uses: msys2/setup-msys2@c52d1fa9c7492275e60fe763540fb601f5f232a1 # v2.25.0 with: msystem: ${{matrix.sys}} update: true @@ -246,7 +240,7 @@ jobs: - name: Generate artifact attestation if: github.ref_type == 'tag' - uses: actions/attest-build-provenance@1c608d11d69870c2092266b3f9a6f3abbf17002c # v1.4.3 + uses: actions/attest-build-provenance@ef244123eb79f2f7a7e75d99086184180e6d0018 # v1.4.4 with: subject-path: "${{ env.BUILD_DIR }}/*.zip" @@ -296,7 +290,7 @@ jobs: - name: Generate artifact attestation if: github.ref_type == 'tag' - uses: actions/attest-build-provenance@1c608d11d69870c2092266b3f9a6f3abbf17002c # v1.4.3 + uses: actions/attest-build-provenance@ef244123eb79f2f7a7e75d99086184180e6d0018 # v1.4.4 with: subject-path: "${{ env.BUILD_DIR }}/*.zip" @@ -387,7 +381,7 @@ jobs: - name: Generate artifact attestation if: github.ref_type == 'tag' - uses: actions/attest-build-provenance@1c608d11d69870c2092266b3f9a6f3abbf17002c # v1.4.3 + uses: actions/attest-build-provenance@ef244123eb79f2f7a7e75d99086184180e6d0018 # v1.4.4 with: subject-path: "${{ env.PACKAGE_DIR }}.tar.gz" diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml index 180155b8f0..66f01c9c28 100644 --- a/.github/workflows/scorecards.yml +++ b/.github/workflows/scorecards.yml @@ -66,6 +66,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@662472033e021d55d94146f66f6058822b0b39fd # v3.27.0 + uses: github/codeql-action/upload-sarif@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5 with: sarif_file: results.sarif From f81ced259b2aea3cfc4a779c4ec1678a0aa1a0b7 Mon Sep 17 00:00:00 2001 From: Dimitar Krastev Date: Tue, 10 Dec 2024 18:11:30 +0200 Subject: [PATCH 08/11] Reformat Common++ documentation to use triple slash. (#1647) * Reformatted Common++ to use triple slash /// instead of /** for documentation. * Fixed potentially undefined `size_t`. * Fixed string include. * Reverted std::size_t to size_t. --- Common++/header/GeneralUtils.h | 80 ++- Common++/header/IpAddress.h | 804 ++++++++++---------------- Common++/header/IpAddressUtils.h | 114 ++-- Common++/header/IpUtils.h | 99 ++-- Common++/header/LRUList.h | 75 +-- Common++/header/Logger.h | 146 ++--- Common++/header/MacAddress.h | 128 ++-- Common++/header/OUILookup.h | 50 +- Common++/header/PcapPlusPlusVersion.h | 38 +- Common++/header/PointerVector.h | 245 +++----- Common++/header/SystemUtils.h | 343 ++++------- Common++/header/TablePrinter.h | 64 +- Common++/src/SystemUtils.cpp | 7 +- 13 files changed, 803 insertions(+), 1390 deletions(-) diff --git a/Common++/header/GeneralUtils.h b/Common++/header/GeneralUtils.h index acb4d93589..316ee22913 100644 --- a/Common++/header/GeneralUtils.h +++ b/Common++/header/GeneralUtils.h @@ -6,56 +6,46 @@ /// @file -/** - * \namespace pcpp - * \brief The main namespace for the PcapPlusPlus lib - */ +/// @namespace pcpp +/// @brief The main namespace for the PcapPlusPlus lib namespace pcpp { - /** - * Convert a byte array into a string of hex characters. For example: for the array { 0xaa, 0x2b, 0x10 } the string - * "aa2b10" will be returned - * @param[in] byteArr A byte array - * @param[in] byteArrSize The size of the byte array [in bytes] - * @param[in] stringSizeLimit An optional parameter that enables to limit the returned string size. If set to a - * positive integer value the returned string size will be equal or less than this value. If the string - * representation of the whole array is longer than this size then only part of the array will be read. The default - * value is -1 which means no string size limitation - * @return A string of hex characters representing the byte array - */ + /// Convert a byte array into a string of hex characters. For example: for the array { 0xaa, 0x2b, 0x10 } the string + /// "aa2b10" will be returned + /// @param[in] byteArr A byte array + /// @param[in] byteArrSize The size of the byte array [in bytes] + /// @param[in] stringSizeLimit An optional parameter that enables to limit the returned string size. If set to a + /// positive integer value the returned string size will be equal or less than this value. If the string + /// representation of the whole array is longer than this size then only part of the array will be read. The default + /// value is -1 which means no string size limitation + /// @return A string of hex characters representing the byte array std::string byteArrayToHexString(const uint8_t* byteArr, size_t byteArrSize, int stringSizeLimit = -1); - /** - * Convert a string of hex characters into a byte array. For example: for the string "aa2b10" an array of values - * { 0xaa, 0x2b, 0x10 } will be returned - * @param[in] hexString A string of hex characters - * @param[out] resultByteArr A pre-allocated byte array where the result will be written to - * @param[in] resultByteArrSize The size of the pre-allocated byte array - * @return The size of the result array. If the string represents an array that is longer than the pre-allocated - * size (resultByteArrSize) then the result array will contain only the part of the string that managed to fit into - * the array, and the returned size will be resultByteArrSize. However if the string represents an array that is - * shorter than the pre-allocated size then some of the cells will remain empty and contain zeros, and the returned - * size will be the part of the array that contain data. If the input is an illegal hex string 0 will be returned. - * Illegal hex string means odd number of characters or a string that contains non-hex characters - */ + /// Convert a string of hex characters into a byte array. For example: for the string "aa2b10" an array of values + /// { 0xaa, 0x2b, 0x10 } will be returned + /// @param[in] hexString A string of hex characters + /// @param[out] resultByteArr A pre-allocated byte array where the result will be written to + /// @param[in] resultByteArrSize The size of the pre-allocated byte array + /// @return The size of the result array. If the string represents an array that is longer than the pre-allocated + /// size (resultByteArrSize) then the result array will contain only the part of the string that managed to fit into + /// the array, and the returned size will be resultByteArrSize. However if the string represents an array that is + /// shorter than the pre-allocated size then some of the cells will remain empty and contain zeros, and the returned + /// size will be the part of the array that contain data. If the input is an illegal hex string 0 will be returned. + /// Illegal hex string means odd number of characters or a string that contains non-hex characters size_t hexStringToByteArray(const std::string& hexString, uint8_t* resultByteArr, size_t resultByteArrSize); - /** - * This is a cross platform version of memmem (https://man7.org/linux/man-pages/man3/memmem.3.html) which is not - * supported on all platforms. - * @param[in] haystack A pointer to the buffer to be searched - * @param[in] haystackLen Length of the haystack buffer - * @param[in] needle A pointer to a buffer that will be searched for - * @param[in] needleLen Length of the needle buffer - * @return A pointer to the beginning of the substring, or nullptr if the substring is not found - */ + /// This is a cross platform version of memmem (https://man7.org/linux/man-pages/man3/memmem.3.html) which is not + /// supported on all platforms. + /// @param[in] haystack A pointer to the buffer to be searched + /// @param[in] haystackLen Length of the haystack buffer + /// @param[in] needle A pointer to a buffer that will be searched for + /// @param[in] needleLen Length of the needle buffer + /// @return A pointer to the beginning of the substring, or nullptr if the substring is not found char* cross_platform_memmem(const char* haystack, size_t haystackLen, const char* needle, size_t needleLen); - /** - * Calculates alignment. - * @param[in] number Given number - * @return The aligned number - */ + /// Calculates alignment. + /// @param[in] number Given number + /// @return The aligned number template static int align(int number) { // Only works for alignment with power of 2 @@ -65,10 +55,8 @@ namespace pcpp return (number + mask) & ~mask; } - /** - * A template class to calculate enum class hash - * @tparam EnumClass - */ + /// A template class to calculate enum class hash + /// @tparam EnumClass template ::value, bool>::type = false> struct EnumClassHash { diff --git a/Common++/header/IpAddress.h b/Common++/header/IpAddress.h index a156e8aace..6cafb2ed7d 100644 --- a/Common++/header/IpAddress.h +++ b/Common++/header/IpAddress.h @@ -10,10 +10,8 @@ /// @file -/** - * \namespace pcpp - * \brief The main namespace for the PcapPlusPlus lib - */ +/// @namespace pcpp +/// @brief The main namespace for the PcapPlusPlus lib namespace pcpp { @@ -24,97 +22,70 @@ namespace pcpp // The implementation of the classes is based on document N4771 "Working Draft, C++ Extensions for Networking" // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/n4771.pdf - /** - * @class IPv4Address - * Represents an IPv4 address (of type XXX.XXX.XXX.XXX) - */ + /// @class IPv4Address + /// Represents an IPv4 address (of type XXX.XXX.XXX.XXX) class IPv4Address { public: - /** - * A default constructor that creates an instance of the class with the zero-initialized address - */ + /// A default constructor that creates an instance of the class with the zero-initialized address IPv4Address() = default; - /** - * A constructor that creates an instance of the class out of 4-byte integer value. - * @param[in] addrAsInt The address as 4-byte integer in network byte order - */ + /// A constructor that creates an instance of the class out of 4-byte integer value. + /// @param[in] addrAsInt The address as 4-byte integer in network byte order IPv4Address(const uint32_t addrAsInt) { memcpy(m_Bytes.data(), &addrAsInt, sizeof(addrAsInt)); } - /** - * A constructor that creates an instance of the class out of 4-byte array. - * @param[in] bytes The address as 4-byte array in network byte order - */ + /// A constructor that creates an instance of the class out of 4-byte array. + /// @param[in] bytes The address as 4-byte array in network byte order IPv4Address(const uint8_t bytes[4]) { memcpy(m_Bytes.data(), bytes, 4 * sizeof(uint8_t)); } - /** - * A constructor that creates an instance of the class out of a 4-byte standard array. - * @param[in] bytes The address as 4-byte standard array in network byte order - */ + /// A constructor that creates an instance of the class out of a 4-byte standard array. + /// @param[in] bytes The address as 4-byte standard array in network byte order IPv4Address(const std::array& bytes) : m_Bytes(bytes) {} - /** - * A constructor that creates an instance of the class out of std::string value. - * - * @param[in] addrAsString The std::string representation of the address - * @throws std::invalid_argument The provided string does not represent a valid IPv4 address. - */ + /// A constructor that creates an instance of the class out of std::string value. + /// @param[in] addrAsString The std::string representation of the address + /// @throws std::invalid_argument The provided string does not represent a valid IPv4 address. IPv4Address(const std::string& addrAsString); - /** - * @return A 4-byte integer in network byte order representing the IPv4 address - */ + /// @return A 4-byte integer in network byte order representing the IPv4 address inline uint32_t toInt() const; - /** - * @return A non-owning pointer to 4-byte C-style array representing the IPv4 address - */ + /// @return A non-owning pointer to 4-byte C-style array representing the IPv4 address const uint8_t* toBytes() const { return m_Bytes.data(); } - /** - * @return A reference to a 4-byte standard array representing the IPv4 address - */ + /// @return A reference to a 4-byte standard array representing the IPv4 address const std::array& toByteArray() const { return m_Bytes; } - /** - * @return A string representation of the address - */ + /// @return A string representation of the address std::string toString() const; - /** - * @return True if an address is multicast, false otherwise. - */ + /// @return True if an address is multicast, false otherwise. bool isMulticast() const; - /** - * Overload of the equal-to operator - * @param[in] rhs The object to compare with - * @return True if the addresses are equal, false otherwise - */ + /// Overload of the equal-to operator + /// @param[in] rhs The object to compare with + /// @return True if the addresses are equal, false otherwise bool operator==(const IPv4Address& rhs) const { return toInt() == rhs.toInt(); } - /** - * Overload of the less-than operator - * @param[in] rhs The object to compare with - * @return True if the address value is lower than the other address value, false otherwise - */ + /// Overload of the less-than operator + /// @param[in] rhs The object to compare with + /// @return True if the address value is lower than the other address value, false otherwise bool operator<(const IPv4Address& rhs) const { uint32_t intVal = toInt(); @@ -127,54 +98,42 @@ namespace pcpp return intVal < rhsIntVal; } - /** - * Overload of the not-equal-to operator - * @param[in] rhs The object to compare with - * @return True if the addresses are not equal, false otherwise - */ + /// Overload of the not-equal-to operator + /// @param[in] rhs The object to compare with + /// @return True if the addresses are not equal, false otherwise bool operator!=(const IPv4Address& rhs) const { return !(*this == rhs); } - /** - * Checks whether the address matches a network. - * @param network An IPv4Network network - * @return True if the address matches the network or false otherwise - */ + /// Checks whether the address matches a network. + /// @param network An IPv4Network network + /// @return True if the address matches the network or false otherwise bool matchNetwork(const IPv4Network& network) const; - /** - * Checks whether the address matches a network. - * For example: this method will return true for address 10.1.1.9 and network which is one of: - * 10.1.1.1/24, 10.1.1.1/255.255.255.0 - * Another example: this method will return false for address 11.1.1.9 and network which is one of: - * 10.1.1.1/16, 10.1.1.1/255.255.0.0 - * @param[in] network A string in one of these formats: - * - X.X.X.X/Y where X.X.X.X is a valid IP address and Y is a number between 0 and 32 - * - X.X.X.X/Y.Y.Y.Y where X.X.X.X is a valid IP address and Y.Y.Y.Y is a valid netmask - * @return True if the address matches the network or false if it doesn't or if the network is invalid - */ + /// Checks whether the address matches a network. + /// For example: this method will return true for address 10.1.1.9 and network which is one of: + /// 10.1.1.1/24, 10.1.1.1/255.255.255.0 + /// Another example: this method will return false for address 11.1.1.9 and network which is one of: + /// 10.1.1.1/16, 10.1.1.1/255.255.0.0 + /// @param[in] network A string in one of these formats: + /// - X.X.X.X/Y where X.X.X.X is a valid IP address and Y is a number between 0 and 32 + /// - X.X.X.X/Y.Y.Y.Y where X.X.X.X is a valid IP address and Y.Y.Y.Y is a valid netmask + /// @return True if the address matches the network or false if it doesn't or if the network is invalid bool matchNetwork(const std::string& network) const; - /** - * A static method that checks whether a string represents a valid IPv4 address - * @param[in] addrAsString The std::string representation of the address - * @return True if the address is valid, false otherwise - */ + /// A static method that checks whether a string represents a valid IPv4 address + /// @param[in] addrAsString The std::string representation of the address + /// @return True if the address is valid, false otherwise static bool isValidIPv4Address(const std::string& addrAsString); - /** - * A static value representing a zero value of IPv4 address, meaning address of value "0.0.0.0". - */ + /// A static value representing a zero value of IPv4 address, meaning address of value "0.0.0.0". static const IPv4Address Zero; - /** - * A static values representing the lower and upper bound of IPv4 multicast ranges. The bounds are inclusive. - * MulticastRangeLowerBound is initialized to "224.0.0.0". - * MulticastRangeUpperBound is initialized to "239.255.255.255". - * In order to check whether the address is a multicast address the isMulticast method can be used. - */ + /// A static values representing the lower and upper bound of IPv4 multicast ranges. The bounds are inclusive. + /// MulticastRangeLowerBound is initialized to "224.0.0.0". + /// MulticastRangeUpperBound is initialized to "239.255.255.255". + /// In order to check whether the address is a multicast address the isMulticast method can be used. static const IPv4Address MulticastRangeLowerBound; static const IPv4Address MulticastRangeUpperBound; @@ -191,317 +150,235 @@ namespace pcpp return addr; } - /** - * @class IPv6Address - * Represents an IPv6 address (of type xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx). - */ + /// @class IPv6Address + /// Represents an IPv6 address (of type xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx). class IPv6Address { public: - /** - * A default constructor that creates an instance of the class with the zero-initialized address. - */ + /// A default constructor that creates an instance of the class with the zero-initialized address. IPv6Address() = default; - /** - * A constructor that creates an instance of the class out of 16-byte array. - * @param[in] bytes The address as 16-byte array in network byte order - */ + /// A constructor that creates an instance of the class out of 16-byte array. + /// @param[in] bytes The address as 16-byte array in network byte order IPv6Address(const uint8_t bytes[16]) { memcpy(m_Bytes.data(), bytes, 16 * sizeof(uint8_t)); } - /** - * A constructor that creates an instance of the class out of a 16-byte standard array. - * @param[in] bytes The address as 16-byte standard array in network byte order - */ + /// A constructor that creates an instance of the class out of a 16-byte standard array. + /// @param[in] bytes The address as 16-byte standard array in network byte order IPv6Address(const std::array& bytes) : m_Bytes(bytes) {} - /** - * A constructor that creates an instance of the class out of std::string value. - * - * @param[in] addrAsString The std::string representation of the address - * @throws std::invalid_argument The provided string does not represent a valid IPv6 address. - */ + /// A constructor that creates an instance of the class out of std::string value. + /// @param[in] addrAsString The std::string representation of the address + /// @throws std::invalid_argument The provided string does not represent a valid IPv6 address. IPv6Address(const std::string& addrAsString); - /** - * Returns a view of the IPv6 address as a 16-byte raw C-style array - * @return A non-owning pointer to 16-byte array representing the IPv6 address - */ + /// Returns a view of the IPv6 address as a 16-byte raw C-style array + /// @return A non-owning pointer to 16-byte array representing the IPv6 address const uint8_t* toBytes() const { return m_Bytes.data(); } - /** - * Returns a view of the IPv6 address as a std::array of bytes - * @return A reference to a 16-byte standard array representing the IPv6 address - */ + /// Returns a view of the IPv6 address as a std::array of bytes + /// @return A reference to a 16-byte standard array representing the IPv6 address const std::array& toByteArray() const { return m_Bytes; } - /** - * Returns a std::string representation of the address - * @return A string representation of the address - */ + /// Returns a std::string representation of the address + /// @return A string representation of the address std::string toString() const; - /** - * Determine whether the address is a multicast address - * @return True if an address is multicast - */ + /// Determine whether the address is a multicast address + /// @return True if an address is multicast bool isMulticast() const; - /** - * Overload of the equal-to operator - * @param[in] rhs The object to compare with - * @return True if the addresses are equal, false otherwise - */ + /// Overload of the equal-to operator + /// @param[in] rhs The object to compare with + /// @return True if the addresses are equal, false otherwise bool operator==(const IPv6Address& rhs) const { return memcmp(toBytes(), rhs.toBytes(), sizeof(m_Bytes)) == 0; } - /** - * Overload of the less-than operator - * @param[in] rhs The object to compare with - * @return True if the address value is lower than the other address value, false otherwise - */ + /// Overload of the less-than operator + /// @param[in] rhs The object to compare with + /// @return True if the address value is lower than the other address value, false otherwise bool operator<(const IPv6Address& rhs) const { return memcmp(toBytes(), rhs.toBytes(), sizeof(m_Bytes)) < 0; } - /** - * Overload of the not-equal-to operator - * @param[in] rhs The object to compare with - * @return True if the addresses are not equal, false otherwise - */ + /// Overload of the not-equal-to operator + /// @param[in] rhs The object to compare with + /// @return True if the addresses are not equal, false otherwise bool operator!=(const IPv6Address& rhs) const { return !(*this == rhs); } - /** - * Allocates a byte array and copies address value into it. Array deallocation is user responsibility - * @param[in] arr A pointer to where array will be allocated - * @param[out] length Returns the length in bytes of the array that was allocated - */ + /// Allocates a byte array and copies address value into it. Array deallocation is user responsibility + /// @param[in] arr A pointer to where array will be allocated + /// @param[out] length Returns the length in bytes of the array that was allocated void copyTo(uint8_t** arr, size_t& length) const; - /** - * Gets a pointer to an already allocated byte array and copies the address value to it. - * This method assumes array allocated size is at least 16 (the size of an IPv6 address) - * @param[in] arr A pointer to the array which address will be copied to - */ + /// Gets a pointer to an already allocated byte array and copies the address value to it. + /// This method assumes array allocated size is at least 16 (the size of an IPv6 address) + /// @param[in] arr A pointer to the array which address will be copied to void copyTo(uint8_t* arr) const { memcpy(arr, m_Bytes.data(), m_Bytes.size() * sizeof(uint8_t)); } - /** - * Checks whether the address matches a network. - * @param network An IPv6Network network - * @return True if the address matches the network or false otherwise - */ + /// Checks whether the address matches a network. + /// @param network An IPv6Network network + /// @return True if the address matches the network or false otherwise bool matchNetwork(const IPv6Network& network) const; - /** - * Checks whether the address matches a network. - * For example: this method will return true for address d6e5:83dc:0c58:bc5d:1449:5898:: and network - * which is one of: - * d6e5:83dc:0c58:bc5d::/64, d6e5:83dc:0c58:bc5d::/ffff:ffff:ffff:ffff:: - * Another example: this method will return false for address d6e5:83dc:: and network which is one of: - * d6e5:83dc:0c58:bc5d::/64, d6e5:83dc:0c58:bc5d::/ffff:ffff:ffff:ffff:: - * @param[in] network A string in one of these formats: - * - IPV6_ADDRESS/Y where IPV6_ADDRESS is a valid IPv6 address and Y is a number between 0 and 128 - * - IPV6_ADDRESS/IPV6_NETMASK where IPV6_ADDRESS is a valid IPv6 address and IPV6_NETMASK is a valid - * IPv6 netmask - * @return True if the address matches the network or false if it doesn't or if the network is invalid - */ + /// Checks whether the address matches a network. + /// For example: this method will return true for address d6e5:83dc:0c58:bc5d:1449:5898:: and network + /// which is one of: + /// d6e5:83dc:0c58:bc5d::/64, d6e5:83dc:0c58:bc5d::/ffff:ffff:ffff:ffff:: + /// Another example: this method will return false for address d6e5:83dc:: and network which is one of: + /// d6e5:83dc:0c58:bc5d::/64, d6e5:83dc:0c58:bc5d::/ffff:ffff:ffff:ffff:: + /// @param[in] network A string in one of these formats: + /// - IPV6_ADDRESS/Y where IPV6_ADDRESS is a valid IPv6 address and Y is a number between 0 and 128 + /// - IPV6_ADDRESS/IPV6_NETMASK where IPV6_ADDRESS is a valid IPv6 address and IPV6_NETMASK is a valid + /// IPv6 netmask + /// @return True if the address matches the network or false if it doesn't or if the network is invalid bool matchNetwork(const std::string& network) const; - /** - * A static method that checks whether a string represents a valid IPv6 address - * @param[in] addrAsString The std::string representation of the address - * @return True if the address is valid, false otherwise - */ + /// A static method that checks whether a string represents a valid IPv6 address + /// @param[in] addrAsString The std::string representation of the address + /// @return True if the address is valid, false otherwise static bool isValidIPv6Address(const std::string& addrAsString); - /** - * A static value representing a zero value of IPv6 address, meaning address of value - * "0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0". - */ + /// A static value representing a zero value of IPv6 address, meaning address of value + /// "0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0". static const IPv6Address Zero; - /** - * A static value representing the lower bound of IPv6 multicast ranges. The bound is inclusive. - * MulticastRangeLowerBound is initialized to "ff00:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0". - * In order to check whether the address is a multicast address the isMulticast method can be used. - */ + /// A static value representing the lower bound of IPv6 multicast ranges. The bound is inclusive. + /// MulticastRangeLowerBound is initialized to "ff00:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0". + /// In order to check whether the address is a multicast address the isMulticast method can be used. static const IPv6Address MulticastRangeLowerBound; private: std::array m_Bytes = { 0 }; }; // class IPv6Address - /** - * @class IPAddress - * The class is a version-independent representation for an IP address - */ + /// @class IPAddress + /// The class is a version-independent representation for an IP address class IPAddress { public: - /** - * An enum representing the address type: IPv4 or IPv6 - */ + /// An enum representing the address type: IPv4 or IPv6 enum AddressType { - /** - * IPv4 address type - */ + /// IPv4 address type IPv4AddressType, - /** - * IPv6 address type - */ + /// IPv6 address type IPv6AddressType }; - /** - * A default constructor that creates an instance of the class with unspecified IPv4 address - */ + /// A default constructor that creates an instance of the class with unspecified IPv4 address IPAddress() : m_Type(IPv4AddressType) {} - /** - * A constructor that creates an instance of the class out of IPv4Address. - * @param[in] addr A const reference to instance of IPv4Address - */ + /// A constructor that creates an instance of the class out of IPv4Address. + /// @param[in] addr A const reference to instance of IPv4Address IPAddress(const IPv4Address& addr) : m_Type(IPv4AddressType), m_IPv4(addr) {} - /** - * A constructor that creates an instance of the class out of IPv6Address. - * @param[in] addr A const reference to instance of IPv6Address - */ + /// A constructor that creates an instance of the class out of IPv6Address. + /// @param[in] addr A const reference to instance of IPv6Address IPAddress(const IPv6Address& addr) : m_Type(IPv6AddressType), m_IPv6(addr) {} - /** - * A constructor that creates an instance of the class out of std::string value - * - * @param[in] addrAsString The std::string representation of the address - * @throws std::invalid_argument The provided string does not represent a valid IPv4 or IPv6 address. - */ + /// A constructor that creates an instance of the class out of std::string value + /// @param[in] addrAsString The std::string representation of the address + /// @throws std::invalid_argument The provided string does not represent a valid IPv4 or IPv6 address. IPAddress(const std::string& addrAsString); - /** - * Overload of an assignment operator. - * @param[in] addr A const reference to instance of IPv4Address - * @return A reference to the assignee - */ + /// Overload of an assignment operator. + /// @param[in] addr A const reference to instance of IPv4Address + /// @return A reference to the assignee inline IPAddress& operator=(const IPv4Address& addr); - /** - * Overload of an assignment operator. - * @param[in] addr A const reference to instance of IPv6Address - * @return A reference to the assignee - */ + /// Overload of an assignment operator. + /// @param[in] addr A const reference to instance of IPv6Address + /// @return A reference to the assignee inline IPAddress& operator=(const IPv6Address& addr); - /** - * Gets the address type: IPv4 or IPv6 - * @return The address type - */ + /// Gets the address type: IPv4 or IPv6 + /// @return The address type AddressType getType() const { return static_cast(m_Type); } - /** - * Returns a std::string representation of the address - * @return A string representation of the address - */ + /// Returns a std::string representation of the address + /// @return A string representation of the address std::string toString() const { return (getType() == IPv4AddressType) ? m_IPv4.toString() : m_IPv6.toString(); } - /** - * @return Determine whether the object contains an IP version 4 address - */ + /// @return Determine whether the object contains an IP version 4 address bool isIPv4() const { return getType() == IPv4AddressType; } - /** - * @return Determine whether the object contains an IP version 6 address - */ + /// @return Determine whether the object contains an IP version 6 address bool isIPv6() const { return getType() == IPv6AddressType; } - /** - * Determine whether the address is a multicast address - * @return True if an address is multicast - */ + /// Determine whether the address is a multicast address + /// @return True if an address is multicast bool isMulticast() const { return (getType() == IPv4AddressType) ? m_IPv4.isMulticast() : m_IPv6.isMulticast(); } - /** - * Get a reference to IPv4 address instance - * @return The const reference to IPv4Address instance - */ + /// Get a reference to IPv4 address instance + /// @return The const reference to IPv4Address instance const IPv4Address& getIPv4() const { return m_IPv4; } - /** - * Get a reference to IPv6 address instance - * @return The const reference to IPv6Address instance - */ + /// Get a reference to IPv6 address instance + /// @return The const reference to IPv6Address instance const IPv6Address& getIPv6() const { return m_IPv6; } - /** - * @return True if the address is zero, false otherwise - */ + /// @return True if the address is zero, false otherwise bool isZero() const { return (getType() == IPv4AddressType) ? m_IPv4 == IPv4Address::Zero : m_IPv6 == IPv6Address::Zero; } - /** - * Overload of the equal-to operator - * @param[in] rhs The object to compare with - * @return True if the addresses are equal, false otherwise - */ + /// Overload of the equal-to operator + /// @param[in] rhs The object to compare with + /// @return True if the addresses are equal, false otherwise inline bool operator==(const IPAddress& rhs) const; - /** - * Overload of the less-than operator - * @param[in] rhs The object to compare with - * @return True if the address value is lower than the other address value, false otherwise - */ + /// Overload of the less-than operator + /// @param[in] rhs The object to compare with + /// @return True if the address value is lower than the other address value, false otherwise inline bool operator<(const IPAddress& rhs) const; - /** - * Overload of the not-equal-to operator - * @param[in] rhs The object to compare with - * @return True if the addresses are not equal, false otherwise - */ + /// Overload of the not-equal-to operator + /// @param[in] rhs The object to compare with + /// @return True if the addresses are not equal, false otherwise bool operator!=(const IPAddress& rhs) const { return !(*this == rhs); @@ -548,112 +425,83 @@ namespace pcpp return *this; } - /** - * @class IPv4Network - * A class representing IPv4 network definition - */ + /// @class IPv4Network + /// A class representing IPv4 network definition class IPv4Network { public: - /** - * A constructor that creates an instance of the class out of an address and a full prefix length, - * essentially making a network of consisting of only 1 address. - * - * @param address An address representing the network prefix. - */ + /// A constructor that creates an instance of the class out of an address and a full prefix length, + /// essentially making a network of consisting of only 1 address. + /// @param address An address representing the network prefix. explicit IPv4Network(const IPv4Address& address) : IPv4Network(address, 32u) {} - /** - * A constructor that creates an instance of the class out of an address representing the network prefix - * and a prefix length - * @param address An address representing the network prefix. If the address is invalid std::invalid_argument - * exception is thrown - * @param prefixLen A number between 0 and 32 representing the prefix length. - * @throws std::invalid_argument Prefix length is out of acceptable range. - */ + /// A constructor that creates an instance of the class out of an address representing the network prefix + /// and a prefix length + /// @param address An address representing the network prefix. If the address is invalid std::invalid_argument + /// exception is thrown + /// @param prefixLen A number between 0 and 32 representing the prefix length. + /// @throws std::invalid_argument Prefix length is out of acceptable range. IPv4Network(const IPv4Address& address, uint8_t prefixLen); - /** - * A constructor that creates an instance of the class out of an address representing the network prefix - * and a netmask - * @param address An address representing the network prefix. If the address is invalid std::invalid_argument - * exception is thrown - * @param netmask A string representing a netmask in the format of X.X.X.X, for example: 255.255.0.0. - * Please notice that netmasks that start with zeros are invalid, for example: 0.0.255.255. The only netmask - * starting with zeros that is valid is 0.0.0.0. - * @throws std::invalid_argument The provided netmask is invalid. - */ + /// A constructor that creates an instance of the class out of an address representing the network prefix + /// and a netmask + /// @param address An address representing the network prefix. If the address is invalid std::invalid_argument + /// exception is thrown + /// @param netmask A string representing a netmask in the format of X.X.X.X, for example: 255.255.0.0. + /// Please notice that netmasks that start with zeros are invalid, for example: 0.0.255.255. The only netmask + /// starting with zeros that is valid is 0.0.0.0. + /// @throws std::invalid_argument The provided netmask is invalid. IPv4Network(const IPv4Address& address, const std::string& netmask); - /** - * A constructor that creates an instance of the class out of a string representing the network prefix and - * a prefix length or a netmask - * @param addressAndNetmask A string in one of these formats: - * - X.X.X.X/Y where X.X.X.X is a valid IPv4 address representing the network prefix and Y is a number between - * 0 and 32 representing the network prefix - * - X.X.X.X/Y.Y.Y.Y where X.X.X.X is a valid IPv4 address representing the network prefix and Y.Y.Y.Y is - * a valid netmask - * @throws std::invalid_argument The provided string does not represent a valid address and netmask format. - */ + /// A constructor that creates an instance of the class out of a string representing the network prefix and + /// a prefix length or a netmask + /// @param addressAndNetmask A string in one of these formats: + /// - X.X.X.X/Y where X.X.X.X is a valid IPv4 address representing the network prefix and Y is a number between + /// 0 and 32 representing the network prefix + /// - X.X.X.X/Y.Y.Y.Y where X.X.X.X is a valid IPv4 address representing the network prefix and Y.Y.Y.Y is + /// a valid netmask + /// @throws std::invalid_argument The provided string does not represent a valid address and netmask format. IPv4Network(const std::string& addressAndNetmask); - /** - * @return The prefix length, for example: the prefix length of 10.10.10.10/255.0.0.0 is 8 - */ + /// @return The prefix length, for example: the prefix length of 10.10.10.10/255.0.0.0 is 8 uint8_t getPrefixLen() const; - /** - * @return The netmask, for example: the netmask of 10.10.10.10/8 is 255.0.0.0 - */ + /// @return The netmask, for example: the netmask of 10.10.10.10/8 is 255.0.0.0 std::string getNetmask() const { return IPv4Address(m_Mask).toString(); } - /** - * @return The network prefix, for example: the network prefix of 10.10.10.10/16 is 10.10.0.0 - */ + /// @return The network prefix, for example: the network prefix of 10.10.10.10/16 is 10.10.0.0 IPv4Address getNetworkPrefix() const { return IPv4Address(m_NetworkPrefix); } - /** - * @return The lowest non-reserved IPv4 address in this network, for example: the lowest address - * in 10.10.10.10/16 is 10.10.0.1 - */ + /// @return The lowest non-reserved IPv4 address in this network, for example: the lowest address + /// in 10.10.10.10/16 is 10.10.0.1 IPv4Address getLowestAddress() const; - /** - * @return The highest non-reserved IPv4 address in this network, for example: the highest address - * in 10.10.10.10/16 is 10.10.255.254 - */ + /// @return The highest non-reserved IPv4 address in this network, for example: the highest address + /// in 10.10.10.10/16 is 10.10.255.254 IPv4Address getHighestAddress() const; - /** - * @return The number of addresses in this network including reserved addresses, for example: - * the number of addresses in 10.10.0.0/24 is 256 - */ + /// @return The number of addresses in this network including reserved addresses, for example: + /// the number of addresses in 10.10.0.0/24 is 256 uint64_t getTotalAddressCount() const; - /** - * @param address An IPv4 address - * @return True is the address belongs to the network, false otherwise or if the address isn't valid - */ + /// @param address An IPv4 address + /// @return True is the address belongs to the network, false otherwise or if the address isn't valid bool includes(const IPv4Address& address) const; - /** - * @param network An IPv4 network - * @return True is the input network is completely included within this network, false otherwise, for example: - * 10.10.10.10/16 includes 10.10.10.10/24 but doesn't include 10.10.10.10/8 - */ + /// @param network An IPv4 network + /// @return True is the input network is completely included within this network, false otherwise, for example: + /// 10.10.10.10/16 includes 10.10.10.10/24 but doesn't include 10.10.10.10/8 bool includes(const IPv4Network& network) const; - /** - * @return A string representation of the network in a format of NETWORK_PREFIX/PREFIX_LEN, for example: - * 192.168.0.0/16 - */ + /// @return A string representation of the network in a format of NETWORK_PREFIX/PREFIX_LEN, for example: + /// 192.168.0.0/16 std::string toString() const; private: @@ -665,112 +513,83 @@ namespace pcpp void initFromAddressAndNetmask(const IPv4Address& address, const IPv4Address& netmaskAddress); }; - /** - * @class IPv6Network - * A class representing IPv6 network definition - */ + /// @class IPv6Network + /// A class representing IPv6 network definition class IPv6Network { public: - /** - * A constructor that creates an instance of the class out of an address and a full prefix length, - * essentially making a network of consisting of only 1 address. - * - * @param address An address representing the network prefix. - */ + /// A constructor that creates an instance of the class out of an address and a full prefix length, + /// essentially making a network of consisting of only 1 address. + /// @param address An address representing the network prefix. explicit IPv6Network(const IPv6Address& address) : IPv6Network(address, 128u) {} - /** - * A constructor that creates an instance of the class out of an address representing the network prefix - * and a prefix length - * @param address An address representing the network prefix. If the address is invalid std::invalid_argument - * exception is thrown - * @param prefixLen A number between 0 and 128 representing the prefix length. - * @throws std::invalid_argument Prefix length is out of acceptable range. - */ + /// A constructor that creates an instance of the class out of an address representing the network prefix + /// and a prefix length + /// @param address An address representing the network prefix. If the address is invalid std::invalid_argument + /// exception is thrown + /// @param prefixLen A number between 0 and 128 representing the prefix length. + /// @throws std::invalid_argument Prefix length is out of acceptable range. IPv6Network(const IPv6Address& address, uint8_t prefixLen); - /** - * A constructor that creates an instance of the class out of an address representing the network prefix - * and a netmask - * @param address An address representing the network prefix. If the address is invalid std::invalid_argument - * exception is thrown - * @param netmask A string representing a netmask in valid IPv6 format, for example: ffff:ffff::. - * Please notice that netmasks that start with zeros are invalid, for example: 0:ffff::. The only netmask - * starting with zeros that is valid is all zeros (::). - * @throws std::invalid_argument The provided netmask is invalid. - */ + /// A constructor that creates an instance of the class out of an address representing the network prefix + /// and a netmask + /// @param address An address representing the network prefix. If the address is invalid std::invalid_argument + /// exception is thrown + /// @param netmask A string representing a netmask in valid IPv6 format, for example: ffff:ffff::. + /// Please notice that netmasks that start with zeros are invalid, for example: 0:ffff::. The only netmask + /// starting with zeros that is valid is all zeros (::). + /// @throws std::invalid_argument The provided netmask is invalid. IPv6Network(const IPv6Address& address, const std::string& netmask); - /** - * A constructor that creates an instance of the class out of a string representing the network prefix and - * a prefix length or a netmask - * @param addressAndNetmask A string in one of these formats: - * - IPV6_ADDRESS/Y where IPV6_ADDRESS is a valid IPv6 address representing the network prefix and Y is - * a number between 0 and 128 representing the network prefix - * - IPV6_ADDRESS/IPV6_NETMASK where IPV6_ADDRESS is a valid IPv6 address representing the network prefix - * and IPV6_NETMASK is a valid IPv6 netmask - * @throws std::invalid_argument The provided string does not represent a valid address and netmask format. - */ + /// A constructor that creates an instance of the class out of a string representing the network prefix and + /// a prefix length or a netmask + /// @param addressAndNetmask A string in one of these formats: + /// - IPV6_ADDRESS/Y where IPV6_ADDRESS is a valid IPv6 address representing the network prefix and Y is + /// a number between 0 and 128 representing the network prefix + /// - IPV6_ADDRESS/IPV6_NETMASK where IPV6_ADDRESS is a valid IPv6 address representing the network prefix + /// and IPV6_NETMASK is a valid IPv6 netmask + /// @throws std::invalid_argument The provided string does not represent a valid address and netmask format. IPv6Network(const std::string& addressAndNetmask); - /** - * @return The prefix length, for example: the prefix length of 3546::/ffff:: is 16 - */ + /// @return The prefix length, for example: the prefix length of 3546::/ffff:: is 16 uint8_t getPrefixLen() const; - /** - * @return The netmask, for example: the netmask of 3546::/16 is ffff:: - */ + /// @return The netmask, for example: the netmask of 3546::/16 is ffff:: std::string getNetmask() const { return IPv6Address(m_Mask).toString(); } - /** - * @return The network prefix, for example: the network prefix of 3546:f321::/16 is 3546:: - */ + /// @return The network prefix, for example: the network prefix of 3546:f321::/16 is 3546:: IPv6Address getNetworkPrefix() const { return IPv6Address(m_NetworkPrefix); } - /** - * @return The lowest non-reserved IPv6 address in this network, for example: the lowest address in 3546::/16 is - * 3546::1 - */ + /// @return The lowest non-reserved IPv6 address in this network, for example: the lowest address in 3546::/16 + /// is 3546::1 IPv6Address getLowestAddress() const; - /** - * @return The highest IPv6 address in this network, for example: the highest address in 3546::/16 is - * 3546:ffff:ffff:ffff:ffff:ffff:ffff:ffff - */ + /// @return The highest IPv6 address in this network, for example: the highest address in 3546::/16 is + /// 3546:ffff:ffff:ffff:ffff:ffff:ffff:ffff IPv6Address getHighestAddress() const; - /** - * @return The number of addresses in this network, for example: the number of addresses in 16ff::/120 is 256. - * If the number of addresses exceeds the size of uint64_t a std::out_of_range exception is thrown - */ + /// @return The number of addresses in this network, for example: the number of addresses in 16ff::/120 is 256. + /// If the number of addresses exceeds the size of uint64_t a std::out_of_range exception is thrown uint64_t getTotalAddressCount() const; - /** - * @param address An IPv6 address - * @return True is the address belongs to the network, false otherwise or if the address isn't valid - */ + /// @param address An IPv6 address + /// @return True is the address belongs to the network, false otherwise or if the address isn't valid bool includes(const IPv6Address& address) const; - /** - * @param network An IPv6 network - * @return True is the input network is completely included within this network, false otherwise, for example: - * 3546::/64 includes 3546::/120 but doesn't include 3546::/16 - */ + /// @param network An IPv6 network + /// @return True is the input network is completely included within this network, false otherwise, for example: + /// 3546::/64 includes 3546::/120 but doesn't include 3546::/16 bool includes(const IPv6Network& network) const; - /** - * @return A string representation of the network in a format of NETWORK_PREFIX/PREFIX_LEN, for example: - * fda7:9f81:6c23:275::/64 - */ + /// @return A string representation of the network in a format of NETWORK_PREFIX/PREFIX_LEN, for example: + /// fda7:9f81:6c23:275::/64 std::string toString() const; private: @@ -782,31 +601,24 @@ namespace pcpp void initFromAddressAndNetmask(const IPv6Address& address, const IPv6Address& netmaskAddress); }; - /** - * @class IPNetwork - * A class representing version independent IP network definition, both IPv4 and IPv6 are included - */ + /// @class IPNetwork + /// A class representing version independent IP network definition, both IPv4 and IPv6 are included class IPNetwork { public: - /** - * A constructor that creates an instance of the class out of an IP address and a full prefix length, - * essentially making a network of consisting of only 1 address. - * - * @param address An address representing the network prefix. - */ + /// A constructor that creates an instance of the class out of an IP address and a full prefix length, + /// essentially making a network of consisting of only 1 address. + /// @param address An address representing the network prefix. explicit IPNetwork(const IPAddress& address) : IPNetwork(address, address.isIPv4() ? 32u : 128u) {} - /** - * A constructor that creates an instance of the class out of an address representing the network prefix - * and a prefix length - * @param address An address representing the network prefix. If the address is invalid std::invalid_argument - * exception is thrown - * @param prefixLen A number representing the prefix length. Allowed ranges are 0 - 32 for IPv4 networks and 0 - - * 128 for IPv6 networks. - * @throws std::invalid_argument Prefix length is out of acceptable range. - */ + /// A constructor that creates an instance of the class out of an address representing the network prefix + /// and a prefix length + /// @param address An address representing the network prefix. If the address is invalid std::invalid_argument + /// exception is thrown + /// @param prefixLen A number representing the prefix length. Allowed ranges are 0 - 32 for IPv4 networks and 0 + /// - 128 for IPv6 networks. + /// @throws std::invalid_argument Prefix length is out of acceptable range. IPNetwork(const IPAddress& address, uint8_t prefixLen) { if (address.isIPv4()) @@ -819,17 +631,15 @@ namespace pcpp } } - /** - * A constructor that creates an instance of the class out of an address representing the network prefix - * and a netmask - * @param address An address representing the network prefix. If the address is invalid std::invalid_argument - * exception is thrown - * @param netmask A string representing a netmask in valid format, for example: ffff:ffff:: for IPv6 networks - * or 255.255.0.0 for IPv4 networks. - * Please notice that netmasks that start with zeros are invalid, for example: 0:ffff:: or 0.255.255.255. - * The only netmask starting with zeros that is valid is all zeros (:: or 0.0.0.0). - * @throws std::invalid_argument The provided netmask is invalid. - */ + /// A constructor that creates an instance of the class out of an address representing the network prefix + /// and a netmask + /// @param address An address representing the network prefix. If the address is invalid std::invalid_argument + /// exception is thrown + /// @param netmask A string representing a netmask in valid format, for example: ffff:ffff:: for IPv6 networks + /// or 255.255.0.0 for IPv4 networks. + /// Please notice that netmasks that start with zeros are invalid, for example: 0:ffff:: or 0.255.255.255. + /// The only netmask starting with zeros that is valid is all zeros (:: or 0.0.0.0). + /// @throws std::invalid_argument The provided netmask is invalid. IPNetwork(const IPAddress& address, const std::string& netmask) { if (address.isIPv4()) @@ -842,16 +652,14 @@ namespace pcpp } } - /** - * A constructor that creates an instance of the class out of a string representing the network prefix and - * a prefix length or a netmask - * @param addressAndNetmask A string in one of these formats: - * - IP_ADDRESS/Y where IP_ADDRESS is a valid IP address representing the network prefix and Y is - * a number representing the network prefix - * - IP_ADDRESS/NETMASK where IP_ADDRESS is a valid IP address representing the network prefix and NETMASK - * is a valid netmask for this type of network (IPv4 or IPv6 network) - * @throws std::invalid_argument The provided string does not represent a valid address and netmask format. - */ + /// A constructor that creates an instance of the class out of a string representing the network prefix and + /// a prefix length or a netmask + /// @param addressAndNetmask A string in one of these formats: + /// - IP_ADDRESS/Y where IP_ADDRESS is a valid IP address representing the network prefix and Y is + /// a number representing the network prefix + /// - IP_ADDRESS/NETMASK where IP_ADDRESS is a valid IP address representing the network prefix and NETMASK + /// is a valid netmask for this type of network (IPv4 or IPv6 network) + /// @throws std::invalid_argument The provided string does not represent a valid address and netmask format. IPNetwork(const std::string& addressAndNetmask) { try @@ -864,10 +672,8 @@ namespace pcpp } } - /** - * A copy c'tor for this class - * @param other The instance to copy from - */ + /// A copy c'tor for this class + /// @param other The instance to copy from IPNetwork(const IPNetwork& other) { if (other.m_IPv4Network) @@ -881,11 +687,9 @@ namespace pcpp } } - /** - * Overload of an assignment operator. - * @param[in] other An instance of IPNetwork to assign - * @return A reference to the assignee - */ + /// Overload of an assignment operator. + /// @param[in] other An instance of IPNetwork to assign + /// @return A reference to the assignee IPNetwork& operator=(const IPNetwork& other) { if (other.isIPv4Network()) @@ -898,11 +702,9 @@ namespace pcpp } } - /** - * Overload of an assignment operator. - * @param[in] other An instance of IPv4Network to assign - * @return A reference to the assignee - */ + /// Overload of an assignment operator. + /// @param[in] other An instance of IPv4Network to assign + /// @return A reference to the assignee IPNetwork& operator=(const IPv4Network& other) { if (m_IPv4Network) @@ -920,11 +722,9 @@ namespace pcpp return *this; } - /** - * Overload of an assignment operator. - * @param[in] other An instance of IPv6Network to assign - * @return A reference to the assignee - */ + /// Overload of an assignment operator. + /// @param[in] other An instance of IPv6Network to assign + /// @return A reference to the assignee IPNetwork& operator=(const IPv6Network& other) { if (m_IPv4Network) @@ -942,85 +742,67 @@ namespace pcpp return *this; } - /** - * @return The prefix length, for example: the prefix length of 3546::/ffff:: is 16, the prefix length of - * 10.10.10.10/255.0.0.0 is 8 - */ + /// @return The prefix length, for example: the prefix length of 3546::/ffff:: is 16, the prefix length of + /// 10.10.10.10/255.0.0.0 is 8 uint8_t getPrefixLen() const { return (m_IPv4Network != nullptr ? m_IPv4Network->getPrefixLen() : m_IPv6Network->getPrefixLen()); } - /** - * @return The netmask, for example: the netmask of 3546::/16 is ffff::, the netmask of 10.10.10.10/8 is - * 255.0.0.0 - */ + /// @return The netmask, for example: the netmask of 3546::/16 is ffff::, the netmask of 10.10.10.10/8 is + /// 255.0.0.0 std::string getNetmask() const { return (m_IPv4Network != nullptr ? m_IPv4Network->getNetmask() : m_IPv6Network->getNetmask()); } - /** - * @return The network prefix, for example: the network prefix of 3546:f321::/16 is 3546::, the network prefix - * of 10.10.10.10/16 is 10.10.0.0 - */ + /// @return The network prefix, for example: the network prefix of 3546:f321::/16 is 3546::, the network prefix + /// of 10.10.10.10/16 is 10.10.0.0 IPAddress getNetworkPrefix() const { return (m_IPv4Network != nullptr ? IPAddress(m_IPv4Network->getNetworkPrefix()) : IPAddress(m_IPv6Network->getNetworkPrefix())); } - /** - * @return The lowest non-reserved IP address in this network, for example: the lowest address in 3546::/16 is - * 3546::1, the lowest address in 10.10.10.10/16 is 10.10.0.1 - */ + /// @return The lowest non-reserved IP address in this network, for example: the lowest address in 3546::/16 is + /// 3546::1, the lowest address in 10.10.10.10/16 is 10.10.0.1 IPAddress getLowestAddress() const { return (m_IPv4Network != nullptr ? IPAddress(m_IPv4Network->getLowestAddress()) : IPAddress(m_IPv6Network->getLowestAddress())); } - /** - * @return The highest non-reserved IP address in this network, for example: the highest address in 3546::/16 is - * 3546:ffff:ffff:ffff:ffff:ffff:ffff:ffff, the highest address in 10.10.10.10/16 is 10.10.255.254 - */ + /// @return The highest non-reserved IP address in this network, for example: the highest address in 3546::/16 + /// is 3546:ffff:ffff:ffff:ffff:ffff:ffff:ffff, the highest address in 10.10.10.10/16 is 10.10.255.254 IPAddress getHighestAddress() const { return (m_IPv4Network != nullptr ? IPAddress(m_IPv4Network->getHighestAddress()) : IPAddress(m_IPv6Network->getHighestAddress())); } - /** - * @return The number of addresses in this network, for example: the number of addresses in 16ff::/120 is 256, - * the number of addresses in 10.10.0.0/24 is 256. If the number of addresses exceeds the size of uint64_t - * a std::out_of_range exception is thrown - */ + /// @return The number of addresses in this network, for example: the number of addresses in 16ff::/120 is 256, + /// the number of addresses in 10.10.0.0/24 is 256. If the number of addresses exceeds the size of uint64_t + /// a std::out_of_range exception is thrown uint64_t getTotalAddressCount() const { return (m_IPv4Network != nullptr ? m_IPv4Network->getTotalAddressCount() : m_IPv6Network->getTotalAddressCount()); } - /** - * @return True if this is an IPv4 network, false otherwise - */ + /// @return True if this is an IPv4 network, false otherwise bool isIPv4Network() const { return m_IPv4Network != nullptr; } - /** - * @return True if this is an IPv6 network, false otherwise - */ + /// @return True if this is an IPv6 network, false otherwise bool isIPv6Network() const { return m_IPv6Network != nullptr; } - /** - * @param address An IP address - * @return True is the address belongs to the network, false otherwise or if the address isn't valid - */ + /// @param address An IP address + /// @return True is the address belongs to the network, false otherwise or if the address isn't valid bool includes(const IPAddress& address) const { if (m_IPv4Network != nullptr) @@ -1043,10 +825,8 @@ namespace pcpp } } - /** - * @param network An IP network - * @return True is the input network is completely included within this network, false otherwise - */ + /// @param network An IP network + /// @return True is the input network is completely included within this network, false otherwise bool includes(const IPNetwork& network) const { if (m_IPv4Network != nullptr) @@ -1069,10 +849,8 @@ namespace pcpp } } - /** - * @return A string representation of the network in a format of NETWORK_PREFIX/PREFIX_LEN, for example: - * fda7:9f81:6c23:275::/64 or 192.168.0.0/16 - */ + /// @return A string representation of the network in a format of NETWORK_PREFIX/PREFIX_LEN, for example: + /// fda7:9f81:6c23:275::/64 or 192.168.0.0/16 std::string toString() const { return (m_IPv4Network != nullptr ? m_IPv4Network->toString() : m_IPv6Network->toString()); diff --git a/Common++/header/IpAddressUtils.h b/Common++/header/IpAddressUtils.h index a7b6ac7041..209264dfd9 100644 --- a/Common++/header/IpAddressUtils.h +++ b/Common++/header/IpAddressUtils.h @@ -6,10 +6,8 @@ struct in_addr; struct in6_addr; -/** - * \namespace pcpp - * \brief The main namespace for the PcapPlusPlus lib - */ +/// @namespace pcpp +/// @brief The main namespace for the PcapPlusPlus lib namespace pcpp { // Forward declarations @@ -17,121 +15,101 @@ namespace pcpp class IPv6Address; class IPAddress; - /** - * Overload of the equal-to operator - * @return True if the addresses are equal, false otherwise - */ + /// Overload of the equal-to operator + /// @return True if the addresses are equal, false otherwise bool operator==(const IPv4Address& lhs, const in_addr& rhs); - /** - * Overload of the not-equal-to operator - * @return True if the addresses differ, false otherwise - */ + + /// Overload of the not-equal-to operator + /// @return True if the addresses differ, false otherwise inline bool operator!=(const IPv4Address& lhs, const in_addr& rhs) { return !(lhs == rhs); } - /** - * Overload of the equal-to operator - * @return True if the addresses are equal, false otherwise - */ + + /// Overload of the equal-to operator + /// @return True if the addresses are equal, false otherwise inline bool operator==(const in_addr& lhs, const IPv4Address& rhs) { return rhs == lhs; } - /** - * Overload of the not-equal-to operator - * @return True if the addresses differ, false otherwise - */ + + /// Overload of the not-equal-to operator + /// @return True if the addresses differ, false otherwise inline bool operator!=(const in_addr& lhs, const IPv4Address& rhs) { return !(lhs == rhs); } - /** - * Overload of the equal-to operator - * @return True if the addresses are equal, false otherwise - */ + /// Overload of the equal-to operator + /// @return True if the addresses are equal, false otherwise bool operator==(const IPv6Address& lhs, const in6_addr& rhs); - /** - * Overload of the not-equal-to operator - * @return True if the addresses differ, false otherwise - */ + + /// Overload of the not-equal-to operator + /// @return True if the addresses differ, false otherwise inline bool operator!=(const IPv6Address& lhs, const in6_addr& rhs) { return !(lhs == rhs); } - /** - * Overload of the equal-to operator - * @return True if the addresses are equal, false otherwise - */ + + /// Overload of the equal-to operator + /// @return True if the addresses are equal, false otherwise inline bool operator==(const in6_addr& lhs, const IPv6Address& rhs) { return rhs == lhs; } - /** - * Overload of the not-equal-to operator - * @return True if the addresses differ, false otherwise - */ + + /// Overload of the not-equal-to operator + /// @return True if the addresses differ, false otherwise inline bool operator!=(const in6_addr& lhs, const IPv6Address& rhs) { return !(lhs == rhs); } - /** - * Overload of the equal-to operator - * @return True if the addresses are equal, false otherwise - */ + /// Overload of the equal-to operator + /// @return True if the addresses are equal, false otherwise bool operator==(const IPAddress& lhs, const in_addr& rhs); - /** - * Overload of the not-equal-to operator - * @return True if the addresses differ, false otherwise - */ + + /// Overload of the not-equal-to operator + /// @return True if the addresses differ, false otherwise inline bool operator!=(const IPAddress& lhs, const in_addr& rhs) { return !(lhs == rhs); } - /** - * Overload of the equal-to operator - * @return True if the addresses are equal, false otherwise - */ + + /// Overload of the equal-to operator + /// @return True if the addresses are equal, false otherwise inline bool operator==(const in_addr& lhs, const IPAddress& rhs) { return rhs == lhs; } - /** - * Overload of the not-equal-to operator - * @return True if the addresses differ, false otherwise - */ + + /// Overload of the not-equal-to operator + /// @return True if the addresses differ, false otherwise inline bool operator!=(const in_addr& lhs, const IPAddress& rhs) { return !(lhs == rhs); } - /** - * Overload of the equal-to operator - * @return True if the addresses are equal, false otherwise - */ + /// Overload of the equal-to operator + /// @return True if the addresses are equal, false otherwise bool operator==(const IPAddress& lhs, const in6_addr& rhs); - /** - * Overload of the not-equal-to operator - * @return True if the addresses differ, false otherwise - */ + + /// Overload of the not-equal-to operator + /// @return True if the addresses differ, false otherwise inline bool operator!=(const IPAddress& lhs, const in6_addr& rhs) { return !(lhs == rhs); } - /** - * Overload of the equal-to operator - * @return True if the addresses are equal, false otherwise - */ + + /// Overload of the equal-to operator + /// @return True if the addresses are equal, false otherwise inline bool operator==(const in6_addr& lhs, const IPAddress& rhs) { return rhs == lhs; } - /** - * Overload of the not-equal-to operator - * @return True if the addresses differ, false otherwise - */ + + /// Overload of the not-equal-to operator + /// @return True if the addresses differ, false otherwise inline bool operator!=(const in6_addr& lhs, const IPAddress& rhs) { return !(lhs == rhs); diff --git a/Common++/header/IpUtils.h b/Common++/header/IpUtils.h index 2cf9f7a00f..6dadfb5028 100644 --- a/Common++/header/IpUtils.h +++ b/Common++/header/IpUtils.h @@ -25,83 +25,66 @@ // We use "__MINGW64_VERSION_MAJOR" and not __MINGW64__ to detect MinGW-w64 compiler // because the second one is not defined for MinGW-w64 in 32bits mode #if defined(_WIN32) && !defined(_MSC_VER) && (!defined(__MINGW64_VERSION_MAJOR) || (__MINGW64_VERSION_MAJOR < 8)) -/** - * Convert a network format address to presentation format. - * @param[in] af Address family, can be either AF_INET (IPv4) or AF_INET6 (IPv6) - * @param[in] src Network address structure, can be either in_addr (IPv4) or in6_addr (IPv6) - * @param[out] dst Network address string representation - * @param[in] size 'dst' Maximum size - * @return pointer to presentation format address ('dst'), or nullptr (see errno). - */ + +/// Convert a network format address to presentation format. +/// @param[in] af Address family, can be either AF_INET (IPv4) or AF_INET6 (IPv6) +/// @param[in] src Network address structure, can be either in_addr (IPv4) or in6_addr (IPv6) +/// @param[out] dst Network address string representation +/// @param[in] size 'dst' Maximum size +/// @return pointer to presentation format address ('dst'), or nullptr (see errno). const char* inet_ntop(int af, const void* src, char* dst, size_t size); -/** - * Convert from presentation format (which usually means ASCII printable) - * to network format (which is usually some kind of binary format). - * @param[in] af Address family, can be either AF_INET (IPv4) or AF_INET6 (IPv6) - * @param[in] src Network address string representation - * @param[out] dst Network address structure result, can be either in_addr (IPv4) or in6_addr (IPv6) - * @return - * 1 if the address was valid for the specified address family; - * 0 if the address wasn't valid ('dst' is untouched in this case); - * -1 if some other error occurred ('dst' is untouched in this case, too) - */ +/// Convert from presentation format (which usually means ASCII printable) +/// to network format (which is usually some kind of binary format). +/// @param[in] af Address family, can be either AF_INET (IPv4) or AF_INET6 (IPv6) +/// @param[in] src Network address string representation +/// @param[out] dst Network address structure result, can be either in_addr (IPv4) or in6_addr (IPv6) +/// @return +/// 1 if the address was valid for the specified address family; +/// 0 if the address wasn't valid ('dst' is untouched in this case); +/// -1 if some other error occurred ('dst' is untouched in this case, too) int inet_pton(int af, const char* src, void* dst); #endif -/** - * \namespace pcpp - * \brief The main namespace for the PcapPlusPlus lib - */ +/// @namespace pcpp +/// @brief The main namespace for the PcapPlusPlus lib namespace pcpp { namespace internal { - /** - * Extract IPv4 address from sockaddr - * @param[in] sa - input sockaddr - * @return Address in in_addr format - * @throws std::invalid_argument Sockaddr family is not AF_INET or sockaddr is nullptr. - */ + /// Extract IPv4 address from sockaddr + /// @param[in] sa - input sockaddr + /// @return Address in in_addr format + /// @throws std::invalid_argument Sockaddr family is not AF_INET or sockaddr is nullptr. in_addr* sockaddr2in_addr(sockaddr* sa); - /** - * Attempt to extract IPv4 address from sockaddr - * @param[in] sa - input sockaddr - * @return Pointer to address in in_addr format or nullptr if extraction fails. - */ + /// Attempt to extract IPv4 address from sockaddr + /// @param[in] sa - input sockaddr + /// @return Pointer to address in in_addr format or nullptr if extraction fails. in_addr* try_sockaddr2in_addr(sockaddr* sa); - /** - * Extract IPv6 address from sockaddr - * @param[in] sa - input sockaddr - * @return Address in in6_addr format - * @throws std::invalid_argument Sockaddr family is not AF_INET6 or sockaddr is nullptr. - */ + /// Extract IPv6 address from sockaddr + /// @param[in] sa - input sockaddr + /// @return Address in in6_addr format + /// @throws std::invalid_argument Sockaddr family is not AF_INET6 or sockaddr is nullptr. in6_addr* sockaddr2in6_addr(sockaddr* sa); - /** - * Attempt to extract IPv6 address from sockaddr - * @param[in] sa - input sockaddr - * @return Pointer to address in in6_addr format or nullptr if extraction fails. - */ + /// Attempt to extract IPv6 address from sockaddr + /// @param[in] sa - input sockaddr + /// @return Pointer to address in in6_addr format or nullptr if extraction fails. in6_addr* try_sockaddr2in6_addr(sockaddr* sa); - /** - * Converts a sockaddr format address to its string representation - * @param[in] sa Address in sockaddr format - * @param[out] resultString String representation of the address - * @param[in] resultBufLen Length of the result buffer. - * @throws std::invalid_argument Sockaddr family is not AF_INET or AF_INET6, sockaddr is nullptr or the result - * str buffer is insufficient. - */ + /// Converts a sockaddr format address to its string representation + /// @param[in] sa Address in sockaddr format + /// @param[out] resultString String representation of the address + /// @param[in] resultBufLen Length of the result buffer. + /// @throws std::invalid_argument Sockaddr family is not AF_INET or AF_INET6, sockaddr is nullptr or the result + /// str buffer is insufficient. void sockaddr2string(sockaddr const* sa, char* resultString, size_t resultBufLen); - /** - * Convert a in_addr format address to 32bit representation - * @param[in] inAddr Address in in_addr format - * @return Address in 32bit format - */ + /// Convert a in_addr format address to 32bit representation + /// @param[in] inAddr Address in in_addr format + /// @return Address in 32bit format uint32_t in_addr2int(in_addr inAddr); } // namespace internal } // namespace pcpp diff --git a/Common++/header/LRUList.h b/Common++/header/LRUList.h index a900c8413a..81bc6db3a7 100644 --- a/Common++/header/LRUList.h +++ b/Common++/header/LRUList.h @@ -1,6 +1,7 @@ #pragma once #include +#include #include #if __cplusplus > 199711L || _MSC_VER >= 1800 @@ -9,47 +10,39 @@ /// @file -/** - * \namespace pcpp - * \brief The main namespace for the PcapPlusPlus lib - */ +/// @namespace pcpp +/// @brief The main namespace for the PcapPlusPlus lib namespace pcpp { - /** - * @class LRUList - * A template class that implements a LRU cache with limited size. Each time the user puts an element it goes to - * head of the list as the most recently used element (if the element was already in the list it advances to the - * head of the list). The last element in the list is the one least recently used and will be pulled out of the list - * if it reaches its max size and a new element comes in. All actions on this LRU list are O(1) - */ + /// @class LRUList + /// A template class that implements a LRU cache with limited size. Each time the user puts an element it goes to + /// head of the list as the most recently used element (if the element was already in the list it advances to the + /// head of the list). The last element in the list is the one least recently used and will be pulled out of the + /// list if it reaches its max size and a new element comes in. All actions on this LRU list are O(1) template class LRUList { public: typedef typename std::list::iterator ListIterator; typedef typename std::unordered_map::iterator MapIterator; - /** - * A c'tor for this class - * @param[in] maxSize The max size this list can go - */ - explicit LRUList(size_t maxSize) + /// A c'tor for this class + /// @param[in] maxSize The max size this list can go + explicit LRUList(std::size_t maxSize) { m_MaxSize = maxSize; } - /** - * Puts an element in the list. This element will be inserted (or advanced if it already exists) to the head of - * the list as the most recently used element. If the list already reached its max size and the element is new - * this method will remove the least recently used element and return a value in deletedValue. Method complexity - * is O(log(getSize())). This is a optimized version of the method T* put(const T&). - * @param[in] element The element to insert or to advance to the head of the list (if already exists) - * @param[out] deletedValue The value of deleted element if a pointer is not nullptr. This parameter is - * optional. - * @return 0 if the list didn't reach its max size, 1 otherwise. In case the list already reached its max size - * and deletedValue is not nullptr the value of deleted element is copied into the place the deletedValue points - * to. - */ + /// Puts an element in the list. This element will be inserted (or advanced if it already exists) to the head of + /// the list as the most recently used element. If the list already reached its max size and the element is new + /// this method will remove the least recently used element and return a value in deletedValue. Method + /// complexity is O(log(getSize())). This is a optimized version of the method T* put(const T&). + /// @param[in] element The element to insert or to advance to the head of the list (if already exists) + /// @param[out] deletedValue The value of deleted element if a pointer is not nullptr. This parameter is + /// optional. + /// @return 0 if the list didn't reach its max size, 1 otherwise. In case the list already reached its max size + /// and deletedValue is not nullptr the value of deleted element is copied into the place the deletedValue + /// points to. int put(const T& element, T* deletedValue = nullptr) { m_CacheItemsList.push_front(element); @@ -83,28 +76,22 @@ namespace pcpp return 0; } - /** - * Get the most recently used element (the one at the beginning of the list) - * @return The most recently used element - */ + /// Get the most recently used element (the one at the beginning of the list) + /// @return The most recently used element const T& getMRUElement() const { return m_CacheItemsList.front(); } - /** - * Get the least recently used element (the one at the end of the list) - * @return The least recently used element - */ + /// Get the least recently used element (the one at the end of the list) + /// @return The least recently used element const T& getLRUElement() const { return m_CacheItemsList.back(); } - /** - * Erase an element from the list. If element isn't found in the list nothing happens - * @param[in] element The element to erase - */ + /// Erase an element from the list. If element isn't found in the list nothing happens + /// @param[in] element The element to erase void eraseElement(const T& element) { MapIterator iter = m_CacheItemsMap.find(element); @@ -115,17 +102,13 @@ namespace pcpp m_CacheItemsMap.erase(iter); } - /** - * @return The max size of this list as determined in the c'tor - */ + /// @return The max size of this list as determined in the c'tor size_t getMaxSize() const { return m_MaxSize; } - /** - * @return The number of elements currently in this list - */ + /// @return The number of elements currently in this list size_t getSize() const { return m_CacheItemsMap.size(); diff --git a/Common++/header/Logger.h b/Common++/header/Logger.h index fafe6a9e37..49d05ef759 100644 --- a/Common++/header/Logger.h +++ b/Common++/header/Logger.h @@ -42,16 +42,12 @@ /// @file -/** - * \namespace pcpp - * \brief The main namespace for the PcapPlusPlus lib - */ +/// @namespace pcpp +/// @brief The main namespace for the PcapPlusPlus lib namespace pcpp { - /** - * An enum representing all PcapPlusPlus modules - */ + /// An enum representing all PcapPlusPlus modules enum LogModule { UndefinedLogModule, @@ -117,32 +113,28 @@ namespace pcpp NumOfLogModules }; - /** - * @class Logger - * PcapPlusPlus logger manager. - * PcapPlusPlus uses this logger to output both error and debug logs. - * There are currently 3 log levels: Logger#Error, Logger#Info and Logger#Debug. - * - * PcapPlusPlus is divided into modules (described in #LogModule enum). The user can set the log level got each - * module or to all modules at once. The default is Logger#Info which outputs only error messages. Changing log - * level for modules can be done dynamically while the application is running. - * - * The logger also exposes a method to retrieve the last error log message. - * - * Logs are printed to console by default in a certain format. The user can set a different print function to change - * the format or to print to other media (such as files, etc.). - * - * PcapPlusPlus logger is a singleton which can be reached from anywhere in the code. - * - * Note: Logger#Info level logs are currently only used in DPDK devices to set DPDK log level to RTE_LOG_NOTICE. - */ + /// @class Logger + /// PcapPlusPlus logger manager. + /// PcapPlusPlus uses this logger to output both error and debug logs. + /// There are currently 3 log levels: Logger#Error, Logger#Info and Logger#Debug. + /// + /// PcapPlusPlus is divided into modules (described in #LogModule enum). The user can set the log level got each + /// module or to all modules at once. The default is Logger#Info which outputs only error messages. Changing log + /// level for modules can be done dynamically while the application is running. + /// + /// The logger also exposes a method to retrieve the last error log message. + /// + /// Logs are printed to console by default in a certain format. The user can set a different print function to + /// change the format or to print to other media (such as files, etc.). + /// + /// PcapPlusPlus logger is a singleton which can be reached from anywhere in the code. + /// + /// Note: Logger#Info level logs are currently only used in DPDK devices to set DPDK log level to RTE_LOG_NOTICE. class Logger { public: - /** - * An enum representing the log level. Currently 3 log levels are supported: Error, Info and Debug. Info is the - * default log level - */ + /// An enum representing the log level. Currently 3 log levels are supported: Error, Info and Debug. Info is the + /// default log level enum LogLevel { Error, ///< Error log level @@ -150,110 +142,86 @@ namespace pcpp Debug ///< Debug log level }; - /** - * @typedef LogPrinter - * Log printer callback. Used for printing the logs in a custom way. - * @param[in] logLevel The log level for this log message - * @param[in] logMessage The log message - * @param[in] file The source file in PcapPlusPlus code the log message is coming from - * @param[in] method The method in PcapPlusPlus code the log message is coming from - * @param[in] line The line in PcapPlusPlus code the log message is coming from - */ + /// @typedef LogPrinter + /// Log printer callback. Used for printing the logs in a custom way. + /// @param[in] logLevel The log level for this log message + /// @param[in] logMessage The log message + /// @param[in] file The source file in PcapPlusPlus code the log message is coming from + /// @param[in] method The method in PcapPlusPlus code the log message is coming from + /// @param[in] line The line in PcapPlusPlus code the log message is coming from typedef void (*LogPrinter)(LogLevel logLevel, const std::string& logMessage, const std::string& file, const std::string& method, const int line); - /** - * A static method for converting the log level enum to a string. - * @param[in] logLevel A log level enum - * @return The log level as a string - */ + /// A static method for converting the log level enum to a string. + /// @param[in] logLevel A log level enum + /// @return The log level as a string static std::string logLevelAsString(LogLevel logLevel); - /** - * Get the log level for a certain module - * @param[in] module PcapPlusPlus module - * @return The log level set for this module - */ + /// Get the log level for a certain module + /// @param[in] module PcapPlusPlus module + /// @return The log level set for this module LogLevel getLogLevel(LogModule module) { return m_LogModulesArray[module]; } - /** - * Set the log level for a certain PcapPlusPlus module - * @param[in] module PcapPlusPlus module - * @param[in] level The log level to set the module to - */ + /// Set the log level for a certain PcapPlusPlus module + /// @param[in] module PcapPlusPlus module + /// @param[in] level The log level to set the module to void setLogLevel(LogModule module, LogLevel level) { m_LogModulesArray[module] = level; } - /** - * Check whether a certain module is set to debug log level - * @param[in] module PcapPlusPlus module - * @return True if this module log level is "debug". False otherwise - */ + /// Check whether a certain module is set to debug log level + /// @param[in] module PcapPlusPlus module + /// @return True if this module log level is "debug". False otherwise bool isDebugEnabled(LogModule module) const { return m_LogModulesArray[module] == Debug; } - /** - * Set all PcapPlusPlus modules to a certain log level - * @param[in] level The log level to set all modules to - */ + /// Set all PcapPlusPlus modules to a certain log level + /// @param[in] level The log level to set all modules to void setAllModulesToLogLevel(LogLevel level) { for (int i = 1; i < NumOfLogModules; i++) m_LogModulesArray[i] = level; } - /** - * Set a custom log printer. - * @param[in] printer A log printer function that will be called for every log message - */ + /// Set a custom log printer. + /// @param[in] printer A log printer function that will be called for every log message void setLogPrinter(LogPrinter printer) { m_LogPrinter = printer; } - /** - * Set the log printer back to the default printer - */ + /// Set the log printer back to the default printer void resetLogPrinter() { m_LogPrinter = &defaultLogPrinter; } - /** - * @return Get the last error message - */ + /// @return Get the last error message std::string getLastError() { return m_LastError; } - /** - * Suppress logs in all PcapPlusPlus modules - */ + /// Suppress logs in all PcapPlusPlus modules void suppressLogs() { m_LogsEnabled = false; } - /** - * Enable logs in all PcapPlusPlus modules - */ + /// Enable logs in all PcapPlusPlus modules void enableLogs() { m_LogsEnabled = true; } - /** - * Get an indication if logs are currently enabled. - * @return True if logs are currently enabled, false otherwise - */ + /// Get an indication if logs are currently enabled. + /// @return True if logs are currently enabled, false otherwise bool logsEnabled() const { return m_LogsEnabled; @@ -267,17 +235,13 @@ namespace pcpp std::ostringstream* internalCreateLogStream(); - /** - * An internal method to print log messages. Shouldn't be used externally. - */ + /// An internal method to print log messages. Shouldn't be used externally. void internalPrintLogMessage(std::ostringstream* logStream, Logger::LogLevel logLevel, const char* file, const char* method, int line); - /** - * Get access to Logger singleton - * @todo: make this singleton thread-safe/ - * @return a pointer to the Logger singleton - **/ + /// Get access to Logger singleton + /// @todo: make this singleton thread-safe/ + /// @return a pointer to the Logger singleton static Logger& getInstance() { static Logger instance; diff --git a/Common++/header/MacAddress.h b/Common++/header/MacAddress.h index 8b59f7d53c..6e0834b013 100644 --- a/Common++/header/MacAddress.h +++ b/Common++/header/MacAddress.h @@ -10,62 +10,48 @@ /// @file -/** - * \namespace pcpp - * \brief The main namespace for the PcapPlusPlus lib - */ +/// @namespace pcpp +/// @brief The main namespace for the PcapPlusPlus lib namespace pcpp { - /** - * @class MacAddress - * Represents L2 MAC addresses. Can be constructed from string or a series of 6 byte octets - */ + /// @class MacAddress + /// Represents L2 MAC addresses. Can be constructed from string or a series of 6 byte octets class MacAddress { public: - /** - * Default constructor for this class. - * Initializes the address as 00:00:00:00:00:00. - */ + /// Default constructor for this class. + /// Initializes the address as 00:00:00:00:00:00. MacAddress() = default; - /** - * A constructor that creates an instance of the class out of a byte array. - * The byte array length should be 6 (as MAC address is 6-byte long), and the remaining bytes are ignored. - * If the byte array is invalid, the constructor throws an exception. - * @param[in] addr A pointer to the byte array containing 6 bytes representing the MAC address - */ + /// A constructor that creates an instance of the class out of a byte array. + /// The byte array length should be 6 (as MAC address is 6-byte long), and the remaining bytes are ignored. + /// If the byte array is invalid, the constructor throws an exception. + /// @param[in] addr A pointer to the byte array containing 6 bytes representing the MAC address explicit MacAddress(const uint8_t* addr) { memcpy(m_Address, addr, sizeof(m_Address)); } - /** - * A constructor that creates an instance of the class out of a std::string. - * If the string doesn't represent a valid MAC address, the constructor throws an exception. - * @param[in] addr the string representing the MAC address in format "00:00:00:00:00:00" - */ + /// A constructor that creates an instance of the class out of a std::string. + /// If the string doesn't represent a valid MAC address, the constructor throws an exception. + /// @param[in] addr the string representing the MAC address in format "00:00:00:00:00:00" explicit MacAddress(const std::string& addr); - /** - * A template constructor that creates an instance of the class out of a string convertible to std::string. - * If the string doesn't represent a valid MAC address, the constructor throws an exception. - * @param[in] addr the string representing the MAC address in format "00:00:00:00:00:00" - */ + /// A template constructor that creates an instance of the class out of a string convertible to std::string. + /// If the string doesn't represent a valid MAC address, the constructor throws an exception. + /// @param[in] addr the string representing the MAC address in format "00:00:00:00:00:00" template ::value>::type> MacAddress(const T& addr) : MacAddress(static_cast(addr)) {} - /** - * A constructor that creates an instance of 6 bytes representing the MAC address - * @param[in] firstOctet Represent the first octet in the address - * @param[in] secondOctet Represent the second octet in the address - * @param[in] thirdOctet Represent the third octet in the address - * @param[in] fourthOctet Represent the fourth octet in the address - * @param[in] fifthOctet Represent the fifth octet in the address - * @param[in] sixthOctet Represent the sixth octet in the address - */ + /// A constructor that creates an instance of 6 bytes representing the MAC address + /// @param[in] firstOctet Represent the first octet in the address + /// @param[in] secondOctet Represent the second octet in the address + /// @param[in] thirdOctet Represent the third octet in the address + /// @param[in] fourthOctet Represent the fourth octet in the address + /// @param[in] fifthOctet Represent the fifth octet in the address + /// @param[in] sixthOctet Represent the sixth octet in the address inline MacAddress(uint8_t firstOctet, uint8_t secondOctet, uint8_t thirdOctet, uint8_t fourthOctet, uint8_t fifthOctet, uint8_t sixthOctet) { @@ -77,12 +63,10 @@ namespace pcpp m_Address[5] = sixthOctet; } - /** - * A constructor that creates an instance out of the initializer list. - * The byte list length should be 6 (as MAC address is 6-byte long). - * If the list is invalid, the constructor throws an exception. - * @param[in] octets An initializer list containing the values of type uint8_t representing the MAC address - */ + /// A constructor that creates an instance out of the initializer list. + /// The byte list length should be 6 (as MAC address is 6-byte long). + /// If the list is invalid, the constructor throws an exception. + /// @param[in] octets An initializer list containing the values of type uint8_t representing the MAC address MacAddress(std::initializer_list octets) { if (octets.size() != sizeof(m_Address)) @@ -92,32 +76,26 @@ namespace pcpp std::copy(octets.begin(), octets.end(), std::begin(m_Address)); } - /** - * Overload of the comparison operator. - * @param[in] other The object to compare with - * @return True if addresses are equal, false otherwise - */ + /// Overload of the comparison operator. + /// @param[in] other The object to compare with + /// @return True if addresses are equal, false otherwise bool operator==(const MacAddress& other) const { return memcmp(m_Address, other.m_Address, sizeof(m_Address)) == 0; } - /** - * Overload of the not-equal operator - * @param[in] other The object to compare with - * @return True if addresses are not equal, false otherwise - */ + /// Overload of the not-equal operator + /// @param[in] other The object to compare with + /// @return True if addresses are not equal, false otherwise bool operator!=(const MacAddress& other) const { return !operator==(other); } - /** - * Overload of the assignment operator. - * If the list is invalid, the constructor throws an exception. - * @param[in] octets An initializer list containing the values of type uint8_t representing the MAC address, the - * length of the list must be equal to 6 - */ + /// Overload of the assignment operator. + /// If the list is invalid, the constructor throws an exception. + /// @param[in] octets An initializer list containing the values of type uint8_t representing the MAC address, + /// the length of the list must be equal to 6 MacAddress& operator=(std::initializer_list octets) { if (octets.size() != sizeof(m_Address)) @@ -129,45 +107,35 @@ namespace pcpp return *this; } - /** - * Returns the pointer to raw data - * @return The pointer to raw data - */ + /// Returns the pointer to raw data + /// @return The pointer to raw data const uint8_t* getRawData() const { return m_Address; } - /** - * Returns a std::string representation of the address - * @return A string representation of the address - */ + /// Returns a std::string representation of the address + /// @return A string representation of the address std::string toString() const; - /** - * Allocates a byte array of length 6 and copies address value into it. Array deallocation is user - * responsibility - * @param[in] arr A pointer to where array will be allocated - */ + /// Allocates a byte array of length 6 and copies address value into it. Array deallocation is user + /// responsibility + /// @param[in] arr A pointer to where array will be allocated void copyTo(uint8_t** arr) const { *arr = new uint8_t[sizeof(m_Address)]; memcpy(*arr, m_Address, sizeof(m_Address)); } - /** - * Gets a pointer to an already allocated byte array and copies the address value to it. - * This method assumes array allocated size is at least 6 (the size of a MAC address) - * @param[in] arr A pointer to the array which address will be copied to - */ + /// Gets a pointer to an already allocated byte array and copies the address value to it. + /// This method assumes array allocated size is at least 6 (the size of a MAC address) + /// @param[in] arr A pointer to the array which address will be copied to void copyTo(uint8_t* arr) const { memcpy(arr, m_Address, sizeof(m_Address)); } - /** - * A static value representing a zero value of MAC address, meaning address of value "00:00:00:00:00:00" - */ + /// A static value representing a zero value of MAC address, meaning address of value "00:00:00:00:00:00" static MacAddress Zero; private: diff --git a/Common++/header/OUILookup.h b/Common++/header/OUILookup.h index fb49ac236d..20ac58d56f 100644 --- a/Common++/header/OUILookup.h +++ b/Common++/header/OUILookup.h @@ -7,27 +7,21 @@ /// @file -/** - * \namespace pcpp - * \brief The main namespace for the PcapPlusPlus lib - */ +/// @namespace pcpp +/// @brief The main namespace for the PcapPlusPlus lib namespace pcpp { - /** - * @class OUILookup - * Provides vendor name matching functionality from MAC addresses. It uses an internal database to define name of - * the vendor. The class itself should be initialized by using initOUIDatabaseFromJson() otherwise all requests will - * return "Unknown" as vendor. The class itself currently does not support on-fly modifying the database but anyone - * who wants to add/modify/remove entries, should modify 3rdParty/OUILookup/PCPP_OUIDatabase.json file and call to - * initOUIDatabaseFromJson() function to renew the internal data. - */ + /// @class OUILookup + /// Provides vendor name matching functionality from MAC addresses. It uses an internal database to define name of + /// the vendor. The class itself should be initialized by using initOUIDatabaseFromJson() otherwise all requests + /// will return "Unknown" as vendor. The class itself currently does not support on-fly modifying the database but + /// anyone who wants to add/modify/remove entries, should modify 3rdParty/OUILookup/PCPP_OUIDatabase.json file and + /// call to initOUIDatabaseFromJson() function to renew the internal data. class OUILookup { private: - /** - * MAC addresses with mask values. For example for a MAC address "XX:XX:XX:XX:X0:00/36" the first element will - * be 36, and the second element will be unsigned integer equivalent of "XX:XX:XX:XX:X0:00" and vendor name. - */ + /// MAC addresses with mask values. For example for a MAC address "XX:XX:XX:XX:X0:00/36" the first element will + /// be 36, and the second element will be unsigned integer equivalent of "XX:XX:XX:XX:X0:00" and vendor name. struct MaskedFilter { int mask; @@ -41,10 +35,8 @@ namespace pcpp std::vector maskedFilter; }; - /** - * MAC addresses with only first three octets. The first element is unsigned integer equivalent of "XX:XX:XX" - * formatted MAC address - */ + /// MAC addresses with only first three octets. The first element is unsigned integer equivalent of "XX:XX:XX" + /// formatted MAC address typedef std::unordered_map OUIVendorMap; /// Internal vendor list for MAC addresses @@ -53,19 +45,15 @@ namespace pcpp template int64_t internalParser(T& jsonData); public: - /** - * Initialise internal OUI database from a JSON file - * @param[in] path Path to OUI database. The database itself is located at - * 3rdParty/OUILookup/PCPP_OUIDatabase.json - * @return Returns the number of total vendors, negative on errors - */ + /// Initialise internal OUI database from a JSON file + /// @param[in] path Path to OUI database. The database itself is located at + /// 3rdParty/OUILookup/PCPP_OUIDatabase.json + /// @return Returns the number of total vendors, negative on errors int64_t initOUIDatabaseFromJson(const std::string& path = ""); - /** - * Returns the vendor of the MAC address. OUI database should be initialized with initOUIDatabaseFromJson() - * @param[in] addr MAC address to search - * @return Vendor name - */ + /// Returns the vendor of the MAC address. OUI database should be initialized with initOUIDatabaseFromJson() + /// @param[in] addr MAC address to search + /// @return Vendor name std::string getVendorName(const pcpp::MacAddress& addr); }; } // namespace pcpp diff --git a/Common++/header/PcapPlusPlusVersion.h b/Common++/header/PcapPlusPlusVersion.h index 0e47016610..a4d5ca2b51 100644 --- a/Common++/header/PcapPlusPlusVersion.h +++ b/Common++/header/PcapPlusPlusVersion.h @@ -4,10 +4,8 @@ /// @file -/** - * \namespace pcpp - * \brief The main namespace for the PcapPlusPlus lib - */ +/// @namespace pcpp +/// @brief The main namespace for the PcapPlusPlus lib namespace pcpp { #define PCAPPLUSPLUS_VERSION "24.09+" @@ -15,28 +13,22 @@ namespace pcpp #define PCAPPLUSPLUS_VERSION_FULL "v" PCAPPLUSPLUS_VERSION " (" PCAPPLUSPLUS_VERSION_OFFICIAL ")" - /** - * @return PcapPlusPlus current version, e.g: 23.09. Notice that for non-official releases (which were pulled from - * GitHub) the version will end with a '+'. For example: '23.09+' means non-official release but '23.09' means - * official release - */ + /// @return PcapPlusPlus current version, e.g: 23.09. Notice that for non-official releases (which were pulled from + /// GitHub) the version will end with a '+'. For example: '23.09+' means non-official release but '23.09' means + /// official release inline std::string getPcapPlusPlusVersion() { return PCAPPLUSPLUS_VERSION; } - /** - * @return PcapPlusPlus long version string which includes the version and info whether it's an official or - * non-official release. For example: "v23.09+ (non-official release)" or "v23.09 (official release)" - */ + /// @return PcapPlusPlus long version string which includes the version and info whether it's an official or + /// non-official release. For example: "v23.09+ (non-official release)" or "v23.09 (official release)" inline std::string getPcapPlusPlusVersionFull() { return PCAPPLUSPLUS_VERSION_FULL; } - /** - * @return The build date and time in a format of "Mmm dd yyyy hh:mm:ss" - */ + /// @return The build date and time in a format of "Mmm dd yyyy hh:mm:ss" #ifdef PCAPPP_BUILD_REPRODUCIBLE inline std::string getBuildDateTime() { @@ -49,20 +41,14 @@ namespace pcpp } #endif - /** - * @return The Git commit (revision) the binaries are built from - */ + /// @return The Git commit (revision) the binaries are built from std::string getGitCommit(); - /** - * @return The Git branch the binaries are built from - */ + /// @return The Git branch the binaries are built from std::string getGitBranch(); - /** - * @return Git branch and commit the binaries are built from. - * Aggregates data from getGitCommit() and getGitBranch() - */ + /// @return Git branch and commit the binaries are built from. + /// Aggregates data from getGitCommit() and getGitBranch() std::string getGitInfo(); } // namespace pcpp diff --git a/Common++/header/PointerVector.h b/Common++/header/PointerVector.h index 342ad62e0b..be2a072c56 100644 --- a/Common++/header/PointerVector.h +++ b/Common++/header/PointerVector.h @@ -12,19 +12,15 @@ /// @file -/** - * \namespace pcpp - * \brief The main namespace for the PcapPlusPlus lib - */ +/// @namespace pcpp +/// @brief The main namespace for the PcapPlusPlus lib namespace pcpp { namespace internal { - /** - * @brief A helper struct to facilitate the creation of a copy of an object. - * @tparam T The type of object to copy. - * @tparam Enable Helper parameter for SFINAE. - */ + /// @brief A helper struct to facilitate the creation of a copy of an object. + /// @tparam T The type of object to copy. + /// @tparam Enable Helper parameter for SFINAE. template struct Copier { std::unique_ptr operator()(const T& obj) const @@ -33,10 +29,8 @@ namespace pcpp } }; - /** - * @brief A specialization of Copier to facilitate the safe copying of polymorphic objects via clone() method. - * @tparam T The type of object to copy. - */ + /// @brief A specialization of Copier to facilitate the safe copying of polymorphic objects via clone() method. + /// @tparam T The type of object to copy. template struct Copier::value>::type> { std::unique_ptr operator()(const T& obj) const @@ -47,65 +41,49 @@ namespace pcpp }; } // namespace internal - /** - * @class PointerVector - * A template class for representing a std::vector of pointers. Once (a pointer to) an element is added to this - * vector, the element responsibility moves to the vector, meaning the PointerVector will free the object once it's - * removed from the vector This class wraps std::vector and adds the capability of freeing objects once they're - * removed from it - */ + /// @class PointerVector + /// A template class for representing a std::vector of pointers. Once (a pointer to) an element is added to this + /// vector, the element responsibility moves to the vector, meaning the PointerVector will free the object once it's + /// removed from the vector This class wraps std::vector and adds the capability of freeing objects once they're + /// removed from it template class PointerVector { public: - /** - * Iterator object that is used for iterating all elements in the vector - */ + /// Iterator object that is used for iterating all elements in the vector using VectorIterator = typename std::vector::iterator; - /** - * Const iterator object that is used for iterating all elements in a constant vector - */ + /// Const iterator object that is used for iterating all elements in a constant vector using ConstVectorIterator = typename std::vector::const_iterator; - /** - * A constructor that create an empty instance of this object - */ + /// A constructor that create an empty instance of this object PointerVector() {} - /** - * Copies the vector along with all elements inside it. - * All elements inside the copied vector are duplicates and the originals remain unchanged. - * @param[in] other The vector to copy from. - * @remarks As the vector is copied via deep copy, all pointers obtained from the copied vector - * reference the duplicates and not the originals. - */ + /// Copies the vector along with all elements inside it. + /// All elements inside the copied vector are duplicates and the originals remain unchanged. + /// @param[in] other The vector to copy from. + /// @remarks As the vector is copied via deep copy, all pointers obtained from the copied vector + /// reference the duplicates and not the originals. PointerVector(const PointerVector& other) : m_Vector(deepCopyUnsafe(other.m_Vector)) {} - /** - * Move constructor. All elements along with their ownership is transferred to the new vector. - * @param[in] other The vector to move from. - */ + /// Move constructor. All elements along with their ownership is transferred to the new vector. + /// @param[in] other The vector to move from. PointerVector(PointerVector&& other) noexcept : m_Vector(std::move(other.m_Vector)) { other.m_Vector.clear(); } - /** - * A destructor for this class. The destructor frees all elements that are binded to the vector - */ + /// A destructor for this class. The destructor frees all elements that are binded to the vector ~PointerVector() { freeVectorUnsafe(m_Vector); } - /** - * A copy assignment operator. Replaces the contents with a copy of the contents of other. - * See copy constructor for more information on the specific copy procedure. - * @param[in] other The vector to copy from. - * @return A reference to the current object. - */ + /// A copy assignment operator. Replaces the contents with a copy of the contents of other. + /// See copy constructor for more information on the specific copy procedure. + /// @param[in] other The vector to copy from. + /// @return A reference to the current object. PointerVector& operator=(const PointerVector& other) { // Saves a copy of the old pointer to defer cleanup. @@ -125,12 +103,10 @@ namespace pcpp return *this; } - /** - * A move assignment operator. Replaces the contents with those of other via move semantics. - * The other vector is left empty. - * @param[in] other The vector to move from. - * @return A reference to the current object. - */ + /// A move assignment operator. Replaces the contents with those of other via move semantics. + /// The other vector is left empty. + /// @param[in] other The vector to move from. + /// @return A reference to the current object. PointerVector& operator=(PointerVector&& other) noexcept { // Releases all current elements. @@ -142,26 +118,21 @@ namespace pcpp return *this; } - /** - * Clears all elements of the vector while freeing them - */ + /// Clears all elements of the vector while freeing them void clear() { freeVectorUnsafe(m_Vector); m_Vector.clear(); } - /** - * Adding a nullptr to the vector is not allowed. - */ + /// Adding a nullptr to the vector is not allowed. void pushBack(std::nullptr_t element, bool freeElementOnError = true) = delete; - /** - * Add a new (pointer to an) element to the vector - * @param[in] element A pointer to an element to assume ownership of. - * @param[in] freeElementOnError If set to true, the element is freed if an exception is thrown during the push. - * @throws std::invalid_argument The provided pointer is a nullptr. - */ + /// Add a new (pointer to an) element to the vector + /// @param[in] element A pointer to an element to assume ownership of. + /// @param[in] freeElementOnError If set to true, the element is freed if an exception is thrown during the + /// push. + /// @throws std::invalid_argument The provided pointer is a nullptr. void pushBack(T* element, bool freeElementOnError = true) { if (element == nullptr) @@ -183,12 +154,10 @@ namespace pcpp } } - /** - * Add a new element to the vector that has been managed by an unique pointer. - * @param[in] element A unique pointer holding an element. - * @throws std::invalid_argument The provided pointer is a nullptr. - * @remarks If pushBack throws the element is freed immediately. - */ + /// Add a new element to the vector that has been managed by an unique pointer. + /// @param[in] element A unique pointer holding an element. + /// @throws std::invalid_argument The provided pointer is a nullptr. + /// @remarks If pushBack throws the element is freed immediately. void pushBack(std::unique_ptr element) { if (!element) @@ -203,103 +172,81 @@ namespace pcpp element.release(); } - /** - * Get the first element of the vector - * @return An iterator object pointing to the first element of the vector - */ + /// Get the first element of the vector + /// @return An iterator object pointing to the first element of the vector VectorIterator begin() { return m_Vector.begin(); } - /** - * Get the first element of a constant vector - * @return A const iterator object pointing to the first element of the vector - */ + /// Get the first element of a constant vector + /// @return A const iterator object pointing to the first element of the vector ConstVectorIterator begin() const { return m_Vector.begin(); } - /** - * Get the last element of the vector - * @return An iterator object pointing to the last element of the vector - */ + /// Get the last element of the vector + /// @return An iterator object pointing to the last element of the vector VectorIterator end() { return m_Vector.end(); } - /** - * Get the last element of a constant vector - * @return A const iterator object pointing to the last element of the vector - */ + /// Get the last element of a constant vector + /// @return A const iterator object pointing to the last element of the vector ConstVectorIterator end() const { return m_Vector.end(); } - /** - * Get number of elements in the vector - * @return The number of elements in the vector - */ + /// Get number of elements in the vector + /// @return The number of elements in the vector size_t size() const { return m_Vector.size(); } - /** - * @return A pointer of the first element in the vector - */ + /// @return A pointer of the first element in the vector T* front() { return m_Vector.front(); } - /** - * @return A pointer to the first element in the vector - */ + /// @return A pointer to the first element in the vector T const* front() const { return m_Vector.front(); } - /** - * @return A pointer to the last element in the vector - */ + /// @return A pointer to the last element in the vector T* back() { return m_Vector.back(); } - /* - * @return A pointer to the last element in the vector. - */ + /// @return A pointer to the last element in the vector. T const* back() const { return m_Vector.back(); } - /** - * Removes from the vector a single element (position). Once the element is erased, it's also freed - * @param[in] position The position of the element to erase - * @return An iterator pointing to the new location of the element that followed the last element erased by the - * function call - */ + /// Removes from the vector a single element (position). Once the element is erased, it's also freed + /// @param[in] position The position of the element to erase + /// @return An iterator pointing to the new location of the element that followed the last element erased by the + /// function call VectorIterator erase(VectorIterator position) { delete (*position); return m_Vector.erase(position); } - /** - * Remove an element from the vector without freeing it - * @param[in, out] position The position of the element to remove from the vector. - * The iterator is shifted to the following element after the removal is completed. - * @return A pointer to the element which is no longer managed by the vector. It's user responsibility to free - * it - * @deprecated Deprecated in favor of 'getAndDetach' as that function provides memory safety. - */ + /// Remove an element from the vector without freeing it + /// @param[in, out] position The position of the element to remove from the vector. + /// The iterator is shifted to the following element after the removal is completed. + /// @return A pointer to the element which is no longer managed by the vector. It's user responsibility to free + /// it + /// @deprecated Deprecated in favor of 'getAndDetach' as that function provides memory safety. PCPP_DEPRECATED("Please use the memory safe 'getAndDetach' instead.") T* getAndRemoveFromVector(VectorIterator& position) { @@ -308,22 +255,18 @@ namespace pcpp return result; } - /** - * Removes an element from the vector and transfers ownership to the returned unique pointer. - * @param[in] index The index of the element to detach. - * @return An unique pointer that holds ownership of the detached element. - */ + /// Removes an element from the vector and transfers ownership to the returned unique pointer. + /// @param[in] index The index of the element to detach. + /// @return An unique pointer that holds ownership of the detached element. std::unique_ptr getAndDetach(size_t index) { return getAndDetach(m_Vector.begin() + index); } - /** - * Removes an element from the vector and transfers ownership to the returned unique pointer. - * @param[in, out] position An iterator pointing to the element to detach. - * The iterator is shifted to the following element after the detach completes. - * @return An unique pointer that holds ownership of the detached element. - */ + /// Removes an element from the vector and transfers ownership to the returned unique pointer. + /// @param[in, out] position An iterator pointing to the element to detach. + /// The iterator is shifted to the following element after the detach completes. + /// @return An unique pointer that holds ownership of the detached element. std::unique_ptr getAndDetach(VectorIterator& position) { std::unique_ptr result(*position); @@ -331,11 +274,9 @@ namespace pcpp return result; } - /** - * Removes an element from the vector and transfers ownership to the returned unique pointer. - * @param[in] position An iterator pointing to the element to detach. - * @return An unique pointer that holds ownership of the detached element. - */ + /// Removes an element from the vector and transfers ownership to the returned unique pointer. + /// @param[in] position An iterator pointing to the element to detach. + /// @return An unique pointer that holds ownership of the detached element. std::unique_ptr getAndDetach(VectorIterator const& position) { std::unique_ptr result(*position); @@ -343,32 +284,26 @@ namespace pcpp return result; } - /** - * Return a pointer to the element in a certain index - * @param[in] index The index to retrieve the element from - * @return The element at the specified position in the vector - */ + /// Return a pointer to the element in a certain index + /// @param[in] index The index to retrieve the element from + /// @return The element at the specified position in the vector T* at(int index) { return m_Vector.at(index); } - /** - * Return a const pointer to the element in a certain index - * @param[in] index The index to retrieve the element from - * @return The element at the specified position in the vector - */ + /// Return a const pointer to the element in a certain index + /// @param[in] index The index to retrieve the element from + /// @return The element at the specified position in the vector const T* at(int index) const { return m_Vector.at(index); } private: - /** - * Performs a copy of the vector along with its elements. - * The caller is responsible of freeing the copied elements. - * @return A vector of pointers to the newly copied elements. - */ + /// Performs a copy of the vector along with its elements. + /// The caller is responsible of freeing the copied elements. + /// @return A vector of pointers to the newly copied elements. static std::vector deepCopyUnsafe(std::vector const& origin) { std::vector copyVec; @@ -396,12 +331,10 @@ namespace pcpp return copyVec; } - /** - * Frees all elements inside the vector. - * Calling this function with non-heap allocated pointers is UB. - * @param[in] origin The vector of elements to free. - * @remarks The vector's contents are not cleared and will point to invalid locations in memory. - */ + /// Frees all elements inside the vector. + /// Calling this function with non-heap allocated pointers is UB. + /// @param[in] origin The vector of elements to free. + /// @remarks The vector's contents are not cleared and will point to invalid locations in memory. static void freeVectorUnsafe(std::vector const& origin) { for (auto& obj : origin) diff --git a/Common++/header/SystemUtils.h b/Common++/header/SystemUtils.h index c68ab8f777..bd557ca824 100644 --- a/Common++/header/SystemUtils.h +++ b/Common++/header/SystemUtils.h @@ -12,301 +12,192 @@ int gettimeofday(struct timeval* tp, struct timezone* tzp); #endif -/** - * \namespace pcpp - * \brief The main namespace for the PcapPlusPlus lib - */ +/// @namespace pcpp +/// @brief The main namespace for the PcapPlusPlus lib namespace pcpp { - /** - * @struct SystemCore - * Represents data of 1 CPU core. Current implementation supports up to 32 cores - */ + /// @struct SystemCore + /// Represents data of 1 CPU core. Current implementation supports up to 32 cores struct SystemCore { - /** - * Core position in a 32-bit mask. For each core this attribute holds a 4B integer where only 1 bit is set, - * according to the core ID. For example: - * - In core #0 the right-most bit will be set (meaning the number 0x01); - * - in core #5 the 5th right-most bit will be set (meaning the number 0x20) - */ + + /// Core position in a 32-bit mask. For each core this attribute holds a 4B integer where only 1 bit is set, + /// according to the core ID. For example: + /// - In core #0 the right-most bit will be set (meaning the number 0x01); + /// - in core #5 the 5th right-most bit will be set (meaning the number 0x20) uint32_t Mask; - /** - * Core ID - a value between 0 and 31 - */ + /// Core ID - a value between 0 and 31 uint8_t Id; - /** - * Overload of the comparison operator - * @return true if 2 addresses are equal. False otherwise - */ + /// Overload of the comparison operator + /// @return true if 2 addresses are equal. False otherwise bool operator==(const SystemCore& other) const { return Id == other.Id; } }; - /** - * @struct SystemCores - * Contains static representation to all 32 cores and a static array to map core ID (integer) to a SystemCore struct - */ + /// @struct SystemCores + /// Contains static representation to all 32 cores and a static array to map core ID (integer) to a SystemCore + /// struct struct SystemCores { - /** - * Static representation of core #0 - */ + /// Static representation of core #0 static const SystemCore Core0; - /** - * Static representation of core #1 - */ + /// Static representation of core #1 static const SystemCore Core1; - /** - * Static representation of core #2 - */ + /// Static representation of core #2 static const SystemCore Core2; - /** - * Static representation of core #3 - */ + /// Static representation of core #3 static const SystemCore Core3; - /** - * Static representation of core #4 - */ + /// Static representation of core #4 static const SystemCore Core4; - /** - * Static representation of core #5 - */ + /// Static representation of core #5 static const SystemCore Core5; - /** - * Static representation of core #6 - */ + /// Static representation of core #6 static const SystemCore Core6; - /** - * Static representation of core #7 - */ + /// Static representation of core #7 static const SystemCore Core7; - /** - * Static representation of core #8 - */ + /// Static representation of core #8 static const SystemCore Core8; - /** - * Static representation of core #9 - */ + /// Static representation of core #9 static const SystemCore Core9; - /** - * Static representation of core #10 - */ + /// Static representation of core #10 static const SystemCore Core10; - /** - * Static representation of core #11 - */ + /// Static representation of core #11 static const SystemCore Core11; - /** - * Static representation of core #12 - */ + /// Static representation of core #12 static const SystemCore Core12; - /** - * Static representation of core #13 - */ + /// Static representation of core #13 static const SystemCore Core13; - /** - * Static representation of core #14 - */ + /// Static representation of core #14 static const SystemCore Core14; - /** - * Static representation of core #15 - */ + /// Static representation of core #15 static const SystemCore Core15; - /** - * Static representation of core #16 - */ + /// Static representation of core #16 static const SystemCore Core16; - /** - * Static representation of core #17 - */ + /// Static representation of core #17 static const SystemCore Core17; - /** - * Static representation of core #18 - */ + /// Static representation of core #18 static const SystemCore Core18; - /** - * Static representation of core #19 - */ + /// Static representation of core #19 static const SystemCore Core19; - /** - * Static representation of core #20 - */ + /// Static representation of core #20 static const SystemCore Core20; - /** - * Static representation of core #21 - */ + /// Static representation of core #21 static const SystemCore Core21; - /** - * Static representation of core #22 - */ + /// Static representation of core #22 static const SystemCore Core22; - /** - * Static representation of core #23 - */ + /// Static representation of core #23 static const SystemCore Core23; - /** - * Static representation of core #24 - */ + /// Static representation of core #24 static const SystemCore Core24; - /** - * Static representation of core #25 - */ + /// Static representation of core #25 static const SystemCore Core25; - /** - * Static representation of core #26 - */ + /// Static representation of core #26 static const SystemCore Core26; - /** - * Static representation of core #27 - */ + /// Static representation of core #27 static const SystemCore Core27; - /** - * Static representation of core #28 - */ + /// Static representation of core #28 static const SystemCore Core28; - /** - * Static representation of core #29 - */ + /// Static representation of core #29 static const SystemCore Core29; - /** - * Static representation of core #30 - */ + /// Static representation of core #30 static const SystemCore Core30; - /** - * Static representation of core #31 - */ + /// Static representation of core #31 static const SystemCore Core31; - - /** - * A static array for mapping core ID (integer) to the corresponding static SystemCore representation - */ + /// A static array for mapping core ID (integer) to the corresponding static SystemCore representation static const SystemCore IdToSystemCore[MAX_NUM_OF_CORES]; }; typedef uint32_t CoreMask; - /** - * Get total number of cores on device - * @return Total number of CPU cores on device - */ + /// Get total number of cores on device + /// @return Total number of CPU cores on device int getNumOfCores(); - /** - * Create a core mask for all cores available on machine - * @return A core mask for all cores available on machine - */ + /// Create a core mask for all cores available on machine + /// @return A core mask for all cores available on machine CoreMask getCoreMaskForAllMachineCores(); - /** - * Create a core mask from a vector of system cores - * @param[in] cores A vector of SystemCore instances - * @return A core mask representing these cores - */ + /// Create a core mask from a vector of system cores + /// @param[in] cores A vector of SystemCore instances + /// @return A core mask representing these cores CoreMask createCoreMaskFromCoreVector(const std::vector& cores); - /** - * Create a core mask from a vector of core IDs - * @param[in] coreIds A vector of core IDs - * @return A core mask representing these cores - */ + /// Create a core mask from a vector of core IDs + /// @param[in] coreIds A vector of core IDs + /// @return A core mask representing these cores CoreMask createCoreMaskFromCoreIds(const std::vector& coreIds); - /** - * Convert a core mask into a vector of its appropriate system cores - * @param[in] coreMask The input core mask - * @param[out] resultVec The vector that will contain the system cores - */ + /// Convert a core mask into a vector of its appropriate system cores + /// @param[in] coreMask The input core mask + /// @param[out] resultVec The vector that will contain the system cores void createCoreVectorFromCoreMask(CoreMask coreMask, std::vector& resultVec); - /** - * Execute a shell command and return its output - * @param[in] command The command to run - * @return The output of the command (both stdout and stderr) - * @throws std::runtime_error Error executing the command. - */ + /// Execute a shell command and return its output + /// @param[in] command The command to run + /// @return The output of the command (both stdout and stderr) + /// @throws std::runtime_error Error executing the command. std::string executeShellCommand(const std::string& command); - /** - * Check if a directory exists - * @param[in] dirPath Full path of the directory to search - * @return True if directory exists, false otherwise - */ + /// Check if a directory exists + /// @param[in] dirPath Full path of the directory to search + /// @return True if directory exists, false otherwise bool directoryExists(const std::string& dirPath); - /** - * Retrieve a system-wide real-time accurate clock. It's actually a multi-platform version of clock_gettime() which - * is fully supported only on Linux - * @param[out] sec The second portion of the time - * @param[out] nsec The nanosecond portion of the time - * @return 0 for success, or -1 for failure - */ + /// Retrieve a system-wide real-time accurate clock. It's actually a multi-platform version of clock_gettime() which + /// is fully supported only on Linux + /// @param[out] sec The second portion of the time + /// @param[out] nsec The nanosecond portion of the time + /// @return 0 for success, or -1 for failure int clockGetTime(long& sec, long& nsec); - /** - * A multi-platform version of the popular sleep method. This method simply runs the right sleep method, according - * to the platform it is running on. - * @param[in] seconds Number of seconds to sleep - */ + /// A multi-platform version of the popular sleep method. This method simply runs the right sleep method, according + /// to the platform it is running on. + /// @param[in] seconds Number of seconds to sleep void multiPlatformSleep(uint32_t seconds); - /** - * A multi-platform version of sleep in milliseconds resolution. This method simply runs the right sleep method, - * according to the platform it is running on. - * @param[in] milliseconds Number of milliseconds to sleep - */ + /// A multi-platform version of sleep in milliseconds resolution. This method simply runs the right sleep method, + /// according to the platform it is running on. + /// @param[in] milliseconds Number of milliseconds to sleep void multiPlatformMSleep(uint32_t milliseconds); - /** - * A multi-platform version of `htons` which convert host to network byte order - * @param[in] host Value in host byte order - * @return Value in network byte order - */ + /// A multi-platform version of `htons` which convert host to network byte order + /// @param[in] host Value in host byte order + /// @return Value in network byte order uint16_t hostToNet16(uint16_t host); - /** - * A multi-platform version of `ntohs` which convert network to host byte order - * @param[in] net Value in network byte order - * @return Value in host byte order - */ + /// A multi-platform version of `ntohs` which convert network to host byte order + /// @param[in] net Value in network byte order + /// @return Value in host byte order uint16_t netToHost16(uint16_t net); - /** - * A multi-platform version of `htonl` which convert host to network byte order - * @param[in] host Value in host byte order - * @return Value in network byte order - */ + /// A multi-platform version of `htonl` which convert host to network byte order + /// @param[in] host Value in host byte order + /// @return Value in network byte order uint32_t hostToNet32(uint32_t host); - /** - * A multi-platform version of `ntohl` which convert network to host byte order - * @param[in] net Value in network byte order - * @return Value in host byte order - */ + /// A multi-platform version of `ntohl` which convert network to host byte order + /// @param[in] net Value in network byte order + /// @return Value in host byte order uint32_t netToHost32(uint32_t net); - /** - * @class AppName - * This class extracts the application name from the current running executable and stores it for usage of the - * application throughout its runtime. This class should be initialized once in the beginning of the main() method - * using AppName#init() and from then on the app name could be retrieved using AppName#get() - */ + /// @class AppName + /// This class extracts the application name from the current running executable and stores it for usage of the + /// application throughout its runtime. This class should be initialized once in the beginning of the main() method + /// using AppName#init() and from then on the app name could be retrieved using AppName#get() class AppName { private: static std::string m_AppName; public: - /** - * Static init method which should be called once at the beginning of the main method. - * @param[in] argc The argc param from main() - * @param[in] argv The argv param from main() - */ + /// Static init method which should be called once at the beginning of the main method. + /// @param[in] argc The argc param from main() + /// @param[in] argv The argv param from main() // cppcheck-suppress constParameter static void init(int argc, char* argv[]) { @@ -340,47 +231,37 @@ namespace pcpp } } - /** - * @return The app name as extracted from the current running executable - */ + /// @return The app name as extracted from the current running executable static const std::string& get() { return m_AppName; } }; - /** - * @class ApplicationEventHandler - * A singleton class that provides callbacks for events that occur during application life-cycle such as ctrl+c - * pressed, application closed, killed, etc. - */ + /// @class ApplicationEventHandler + /// A singleton class that provides callbacks for events that occur during application life-cycle such as ctrl+c + /// pressed, application closed, killed, etc. class ApplicationEventHandler { public: - /** - * @typedef EventHandlerCallback - * The callback to be invoked when the event occurs - * @param[in] cookie A pointer the the cookie provided by the user in ApplicationEventHandler c'tor - */ + /// @typedef EventHandlerCallback + /// The callback to be invoked when the event occurs + /// @param[in] cookie A pointer the the cookie provided by the user in ApplicationEventHandler c'tor typedef void (*EventHandlerCallback)(void* cookie); - /** - * As ApplicationEventHandler is a singleton, this is the static getter to retrieve its instance - * @return The singleton instance of ApplicationEventHandler - */ + /// As ApplicationEventHandler is a singleton, this is the static getter to retrieve its instance + /// @return The singleton instance of ApplicationEventHandler static ApplicationEventHandler& getInstance() { static ApplicationEventHandler instance; return instance; } - /** - * Register for an application-interrupted event, meaning ctrl+c was pressed - * @param[in] handler The callback to be activated when the event occurs - * @param[in] cookie A pointer to a user provided object. This object will be transferred to the - * EventHandlerCallback callback. This cookie is very useful for transferring objects that give context to the - * event callback - */ + /// Register for an application-interrupted event, meaning ctrl+c was pressed + /// @param[in] handler The callback to be activated when the event occurs + /// @param[in] cookie A pointer to a user provided object. This object will be transferred to the + /// EventHandlerCallback callback. This cookie is very useful for transferring objects that give context to the + /// event callback void onApplicationInterrupted(EventHandlerCallback handler, void* cookie); private: diff --git a/Common++/header/TablePrinter.h b/Common++/header/TablePrinter.h index d34ec0df51..620b7dd6e7 100644 --- a/Common++/header/TablePrinter.h +++ b/Common++/header/TablePrinter.h @@ -1,61 +1,47 @@ #pragma once +#include #include /// @file -/** - * \namespace pcpp - * \brief The main namespace for the PcapPlusPlus lib - */ +/// @namespace pcpp +/// @brief The main namespace for the PcapPlusPlus lib namespace pcpp { - /** - * A class for printing tables in command-line - */ + + /// A class for printing tables in command-line class TablePrinter { public: - /** - * C'tor - get column names and column widths - * @param[in] columnNames A vector of strings containing column names - * @param[in] columnWidths A vector of integers containing column widths - */ + /// C'tor - get column names and column widths + /// @param[in] columnNames A vector of strings containing column names + /// @param[in] columnWidths A vector of integers containing column widths TablePrinter(std::vector columnNames, std::vector columnWidths); - /** - * A d'tor for this class. Closes the table if not closed - */ + /// A d'tor for this class. Closes the table if not closed virtual ~TablePrinter(); - /** - * Print a single row by providing a single string containing all values delimited by a specified character. - * For example: if specified delimiter is '|' and there are 3 columns an example input can be: - * "value for column1|value for column2|value for column3" - * @param[in] values A string delimited by a specified delimiter that contains values for all columns - * @param[in] delimiter A delimiter that separates between values of different columns in the values string - * @return True if row was printed successfully or false otherwise (in any case of error an appropriate message - * will be printed to log) - */ + /// Print a single row by providing a single string containing all values delimited by a specified character. + /// For example: if specified delimiter is '|' and there are 3 columns an example input can be: + /// "value for column1|value for column2|value for column3" + /// @param[in] values A string delimited by a specified delimiter that contains values for all columns + /// @param[in] delimiter A delimiter that separates between values of different columns in the values string + /// @return True if row was printed successfully or false otherwise (in any case of error an appropriate message + /// will be printed to log) bool printRow(const std::string& values, char delimiter); - /** - * Print a single row - * @param[in] values A vector of strings containing values for all columns - * @return True if row was printed successfully or false otherwise (in any case of error an appropriate message - * will be printed to log) - */ + /// Print a single row + /// @param[in] values A vector of strings containing values for all columns + /// @return True if row was printed successfully or false otherwise (in any case of error an appropriate message + /// will be printed to log) bool printRow(std::vector values); - /** - * Print a separator line - */ + /// Print a separator line void printSeparator(); - /** - * Close the table - should be called after all rows were printed. Calling this method is not a must as it's - * called in the class d'tor - */ + /// Close the table - should be called after all rows were printed. Calling this method is not a must as it's + /// called in the class d'tor void closeTable(); private: @@ -64,9 +50,7 @@ namespace pcpp bool m_FirstRow; bool m_TableClosed; - /** - * Print the table headline - */ + /// Print the table headline void printHeadline(); }; diff --git a/Common++/src/SystemUtils.cpp b/Common++/src/SystemUtils.cpp index 13f2d68caa..9a5bc84a92 100644 --- a/Common++/src/SystemUtils.cpp +++ b/Common++/src/SystemUtils.cpp @@ -54,10 +54,9 @@ int gettimeofday(struct timeval* tp, struct timezone* tzp) namespace { - /** - * @class PcloseDeleter - * A deleter that cleans up a FILE handle using pclose. - */ + + /// @class PcloseDeleter + /// A deleter that cleans up a FILE handle using pclose. struct PcloseDeleter { void operator()(FILE* ptr) const From ad01cda727d63e3755f14bedd7be6c097e4585fa Mon Sep 17 00:00:00 2001 From: Ivan Morozko Date: Wed, 25 Dec 2024 00:33:02 +0400 Subject: [PATCH 09/11] Replace variable length arrays with std::vector (#1662) Variable Length Arrays, while widely supported as compiler extensions are not part of the C++ standard. Replaced them with std::vector. --- Examples/DpdkExample-FilterTraffic/main.cpp | 4 ++-- Examples/PfRingExample-FilterTraffic/main.cpp | 8 ++++---- Pcap++/src/DpdkDevice.cpp | 20 +++++++++---------- Pcap++/src/DpdkDeviceList.cpp | 2 +- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Examples/DpdkExample-FilterTraffic/main.cpp b/Examples/DpdkExample-FilterTraffic/main.cpp index c48e865677..be72a1ed81 100644 --- a/Examples/DpdkExample-FilterTraffic/main.cpp +++ b/Examples/DpdkExample-FilterTraffic/main.cpp @@ -162,7 +162,7 @@ void listDpdkPorts() void prepareCoreConfiguration(std::vector& dpdkDevicesToUse, std::vector& coresToUse, bool writePacketsToDisk, const std::string& packetFilePath, pcpp::DpdkDevice* sendPacketsTo, - AppWorkerConfig workerConfigArr[], int workerConfigArrLen, uint16_t rxQueues) + std::vector& workerConfigArr, int workerConfigArrLen, uint16_t rxQueues) { // create a list of pairs of DpdkDevice and RX queues for all RX queues in all requested devices int totalNumOfRxQueues = 0; @@ -588,7 +588,7 @@ int main(int argc, char* argv[]) } // prepare configuration for every core - AppWorkerConfig workerConfigArr[coresToUse.size()]; + std::vector workerConfigArr(coresToUse.size()); prepareCoreConfiguration(dpdkDevicesToUse, coresToUse, writePacketsToDisk, packetFilePath, sendPacketsTo, workerConfigArr, coresToUse.size(), rxQueues); diff --git a/Examples/PfRingExample-FilterTraffic/main.cpp b/Examples/PfRingExample-FilterTraffic/main.cpp index e6c6a38942..f070fceb67 100644 --- a/Examples/PfRingExample-FilterTraffic/main.cpp +++ b/Examples/PfRingExample-FilterTraffic/main.cpp @@ -406,7 +406,7 @@ int main(int argc, char* argv[]) int threadCount = 0; // create an array of packet stats with the size of all machine cores - PacketStats packetStatsArr[totalNumOfCores]; + std::vector packetStatsArr(totalNumOfCores); // init each packet stats instance with an illegal core ID for (int coreId = 0; coreId < totalNumOfCores; coreId++) @@ -430,7 +430,7 @@ int main(int argc, char* argv[]) PacketMatchingEngine matchingEngine(srcIPToMatch, dstIPToMatch, srcPortToMatch, dstPortToMatch, protocolToMatch); // create a flow table for each core - std::unordered_map flowTables[totalNumOfCores]; + std::vector> flowTables(totalNumOfCores); pcpp::PcapFileWriterDevice** pcapWriters = nullptr; @@ -463,9 +463,9 @@ int main(int argc, char* argv[]) // prepare packet capture configuration CaptureThreadArgs args; - args.packetStatArr = packetStatsArr; + args.packetStatArr = packetStatsArr.data(); args.matchingEngine = &matchingEngine; - args.flowTables = flowTables; + args.flowTables = flowTables.data(); args.sendPacketsTo = sendPacketsToIface; args.pcapWriters = pcapWriters; diff --git a/Pcap++/src/DpdkDevice.cpp b/Pcap++/src/DpdkDevice.cpp index bb4b025733..7aa7b7e171 100644 --- a/Pcap++/src/DpdkDevice.cpp +++ b/Pcap++/src/DpdkDevice.cpp @@ -929,8 +929,8 @@ namespace pcpp return 0; } - struct rte_mbuf* mBufArray[rawPacketArrLength]; - uint16_t packetsReceived = rte_eth_rx_burst(m_Id, rxQueueId, mBufArray, rawPacketArrLength); + std::vector mBufArray(rawPacketArrLength); + uint16_t packetsReceived = rte_eth_rx_burst(m_Id, rxQueueId, mBufArray.data(), rawPacketArrLength); if (unlikely(!packetsReceived)) { @@ -972,8 +972,8 @@ namespace pcpp return 0; } - struct rte_mbuf* mBufArray[packetsArrLength]; - uint16_t packetsReceived = rte_eth_rx_burst(m_Id, rxQueueId, mBufArray, packetsArrLength); + std::vector mBufArray(packetsArrLength); + uint16_t packetsReceived = rte_eth_rx_burst(m_Id, rxQueueId, mBufArray.data(), packetsArrLength); if (unlikely(!packetsReceived)) { @@ -1133,9 +1133,9 @@ namespace pcpp uint16_t DpdkDevice::sendPackets(Packet** packetsArr, uint16_t arrLength, uint16_t txQueueId, bool useTxBuffer) { - rte_mbuf* mBufArr[arrLength]; + std::vector mBufArr(arrLength); MBufRawPacketVector mBufVec; - MBufRawPacket* mBufRawPacketArr[arrLength]; + std::vector mBufRawPacketArr(arrLength); for (size_t i = 0; i < arrLength; i++) { @@ -1162,7 +1162,7 @@ namespace pcpp } uint16_t packetsSent = - sendPacketsInner(txQueueId, (void*)mBufArr, getNextPacketFromMBufArray, arrLength, useTxBuffer); + sendPacketsInner(txQueueId, (void*)mBufArr.data(), getNextPacketFromMBufArray, arrLength, useTxBuffer); bool needToFreeMbuf = (!useTxBuffer && (packetsSent != arrLength)); for (int index = 0; index < arrLength; index++) @@ -1174,8 +1174,8 @@ namespace pcpp uint16_t DpdkDevice::sendPackets(RawPacketVector& rawPacketsVec, uint16_t txQueueId, bool useTxBuffer) { size_t vecSize = rawPacketsVec.size(); - rte_mbuf* mBufArr[vecSize]; - MBufRawPacket* mBufRawPacketArr[vecSize]; + std::vector mBufArr(vecSize); + std::vector mBufRawPacketArr(vecSize); MBufRawPacketVector mBufVec; int mBufIndex = 0; @@ -1204,7 +1204,7 @@ namespace pcpp } uint16_t packetsSent = - sendPacketsInner(txQueueId, (void*)mBufArr, getNextPacketFromMBufArray, vecSize, useTxBuffer); + sendPacketsInner(txQueueId, (void*)mBufArr.data(), getNextPacketFromMBufArray, vecSize, useTxBuffer); bool needToFreeMbuf = (!useTxBuffer && (packetsSent != vecSize)); for (size_t index = 0; index < rawPacketsVec.size(); index++) diff --git a/Pcap++/src/DpdkDeviceList.cpp b/Pcap++/src/DpdkDeviceList.cpp index f41d1bba9e..9331734707 100644 --- a/Pcap++/src/DpdkDeviceList.cpp +++ b/Pcap++/src/DpdkDeviceList.cpp @@ -121,7 +121,7 @@ namespace pcpp // Should be equal to the number of static params initDpdkArgc += 7; - std::string dpdkParamsArray[initDpdkArgc]; + std::vector dpdkParamsArray(initDpdkArgc); initDpdkArgvBuffer = new char*[initDpdkArgc]; i = 0; while (dpdkParamsStream.good() && i < initDpdkArgc) From 8b20f9094abe73d45a19ff5f7ca58f89c60b65fa Mon Sep 17 00:00:00 2001 From: Dimitar Krastev Date: Wed, 25 Dec 2024 03:38:37 +0200 Subject: [PATCH 10/11] Removed VLA usage as it is not part of the C++ standard. (#1661) --- Pcap++/src/XdpDevice.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Pcap++/src/XdpDevice.cpp b/Pcap++/src/XdpDevice.cpp index d1f9e99f75..04378bcbf2 100644 --- a/Pcap++/src/XdpDevice.cpp +++ b/Pcap++/src/XdpDevice.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -144,6 +145,7 @@ namespace pcpp pollfd pollFds[1]; pollFds[0] = { .fd = xsk_socket__fd(socketInfo->xsk), .events = POLLIN }; + std::vector receiveBuffer; while (m_ReceivingPackets) { checkCompletionRing(); @@ -169,14 +171,16 @@ namespace pcpp uint32_t receivedPacketsCount = xsk_ring_cons__peek(&socketInfo->rx, m_Config->rxTxBatchSize, &rxId); - if (!receivedPacketsCount) + if (receivedPacketsCount == 0) { continue; } m_Stats.rxPackets += receivedPacketsCount; - RawPacket rawPacketsArr[receivedPacketsCount]; + // Reserves at least enough memory to hold all the received packets. No-op if capacity is enough. + // May hold more memory than needed if a previous cycle has reserved more already. + receiveBuffer.reserve(receivedPacketsCount); for (uint32_t i = 0; i < receivedPacketsCount; i++) { @@ -186,14 +190,15 @@ namespace pcpp auto data = m_Umem->getDataPtr(addr); timespec ts; clock_gettime(CLOCK_REALTIME, &ts); - rawPacketsArr[i].initWithRawData(data, static_cast(len), ts); + // Initializes the RawPacket directly into the buffer. + receiveBuffer.emplace_back(data, static_cast(len), ts, false); m_Stats.rxBytes += len; m_Umem->freeFrame(addr); } - onPacketsArrive(rawPacketsArr, receivedPacketsCount, this, onPacketsArriveUserCookie); + onPacketsArrive(receiveBuffer.data(), receiveBuffer.size(), this, onPacketsArriveUserCookie); xsk_ring_cons__release(&socketInfo->rx, receivedPacketsCount); m_Stats.rxRingId = rxId + receivedPacketsCount; @@ -202,6 +207,9 @@ namespace pcpp { m_ReceivingPackets = false; } + + // Clears the receive buffer. + receiveBuffer.clear(); } return true; From ab755348711dfb94fa0780c5aa71a8e6e614d132 Mon Sep 17 00:00:00 2001 From: Dimitar Krastev Date: Wed, 25 Dec 2024 03:39:16 +0200 Subject: [PATCH 11/11] Added exception when an unknown direction is supplied. (#1666) --- Pcap++/src/PcapLiveDevice.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Pcap++/src/PcapLiveDevice.cpp b/Pcap++/src/PcapLiveDevice.cpp index 6eef2111d2..831db83502 100644 --- a/Pcap++/src/PcapLiveDevice.cpp +++ b/Pcap++/src/PcapLiveDevice.cpp @@ -80,6 +80,8 @@ namespace pcpp return PCAP_D_OUT; case PcapLiveDevice::PCPP_INOUT: return PCAP_D_INOUT; + default: + throw std::invalid_argument("Unknown direction type"); } } #endif