Inital commit
FossilOrigin-Name: daa4bc12d9830f63b1217a60dcd0bfa4f7710e86d6f79164e49b8489daa1c330
This commit is contained in:
		
							
								
								
									
										7
									
								
								src/capwap/bstr.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								src/capwap/bstr.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,7 @@
 | 
			
		||||
 | 
			
		||||
#include <stdint.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
extern uint8_t * bstr_create(uint8_t *data, uint8_t len);
 | 
			
		||||
 | 
			
		||||
#define bstr_len(s) (*s)
 | 
			
		||||
							
								
								
									
										17
									
								
								src/capwap/bstr_create.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								src/capwap/bstr_create.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,17 @@
 | 
			
		||||
#include <stdint.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
uint8_t * bstr_create(uint8_t *data, uint8_t len)
 | 
			
		||||
{
 | 
			
		||||
	uint8_t * str = malloc(len*sizeof(uint8_t));
 | 
			
		||||
	if (!str)	
 | 
			
		||||
		return 0;
 | 
			
		||||
	*str=len;
 | 
			
		||||
	memcpy(str+1,data,len);
 | 
			
		||||
	return str;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user