Initial commit
FossilOrigin-Name: 7311d2f6705051c28d32d3037f6d0144060265a13764b3ce3bc22aded135f370
This commit is contained in:
		
							
								
								
									
										62
									
								
								src/capwap/cw_log_str2dbglevel.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										62
									
								
								src/capwap/cw_log_str2dbglevel.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,62 @@
 | 
			
		||||
/*
 | 
			
		||||
    This file is part of libcapwap.
 | 
			
		||||
 | 
			
		||||
    libcapwap is free software: you can redistribute it and/or modify
 | 
			
		||||
    it under the terms of the GNU General Public License as published by
 | 
			
		||||
    the Free Software Foundation, either version 3 of the License, or
 | 
			
		||||
    (at your option) any later version.
 | 
			
		||||
 | 
			
		||||
    libcapwap is distributed in the hope that it will be useful,
 | 
			
		||||
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
    GNU General Public License for more details.
 | 
			
		||||
 | 
			
		||||
    You should have received a copy of the GNU General Public License
 | 
			
		||||
    along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#include <string.h>
 | 
			
		||||
 | 
			
		||||
#include "cw_log.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
struct 
 | 
			
		||||
{
 | 
			
		||||
	const char *name;
 | 
			
		||||
	int level;
 | 
			
		||||
} dbg_strs[] = {
 | 
			
		||||
 | 
			
		||||
	{"info",DBG_CW_INFO},
 | 
			
		||||
	{"msg",DBG_CW_MSG},
 | 
			
		||||
	{"msgelem",DBG_CW_MSGELEM},
 | 
			
		||||
	{"msgelem_dmp",DBG_CW_MSGELEM_DMP},
 | 
			
		||||
	{"rfc",DBG_CW_RFC},
 | 
			
		||||
	{"pkt",DBG_CW_PKT},
 | 
			
		||||
	{"pkt_dmp",DBG_CW_PKT_DMP},
 | 
			
		||||
	{"pkt_err",DBG_CW_PKT_ERR},
 | 
			
		||||
	{"pkt_err",DBG_CW_MSG_ERR},
 | 
			
		||||
 | 
			
		||||
	{"dtls",DBG_DTLS},
 | 
			
		||||
	{"dtls_dietail",DBG_DTLS_DETAIL},
 | 
			
		||||
	{"dtls_bio",DBG_DTLS_BIO},
 | 
			
		||||
	{"dtls_bio_dmp",DBG_DTLS_BIO_DMP},
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	{"all",DBG_ALL},
 | 
			
		||||
	{"err",DBG_ERR},
 | 
			
		||||
	{0,0}
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
int cw_log_str2dbglevel(const char * str)
 | 
			
		||||
{
 | 
			
		||||
	int i;
 | 
			
		||||
	for (i=0; dbg_strs[i].name; i++) {
 | 
			
		||||
		if (!strcmp(str,dbg_strs[i].name))
 | 
			
		||||
			return dbg_strs[i].level;
 | 
			
		||||
	}
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user