| 
									
										
										
										
											2025-10-09 23:23:03 +03:00
										 |  |  | libndbuf: Network-oriented buffer operations library | 
					
						
							|  |  |  | ---------------------------------------------------- | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 1. What is it? | 
					
						
							|  |  |  | A small C library providing a simple API to read and write typed values | 
					
						
							|  |  |  | to/from buffers with correct endianness handling. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 2. Purpose | 
					
						
							|  |  |  | Make parsing and building network packets easy and concise. The API is | 
					
						
							|  |  |  | intended to act like a binary printf/scanf for packet fields. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Example: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Packet layout: | 
					
						
							|  |  |  | <16-bit><8-bit><32-bit><raw data> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Reading with a single call: | 
					
						
							|  |  |  | ndbuf_escan(buf, "wbdR", &a16, &a8, &a32, &data_ptr) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | The same style is used to build packets. | 
					
						
							| 
									
										
										
										
											2017-11-24 23:54:42 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 3. Future plans | 
					
						
							| 
									
										
										
										
											2025-10-09 23:23:03 +03:00
										 |  |  |  * Improve the API ergonomics (better support for preallocated buffers). | 
					
						
							|  |  |  |  * Add convenience helpers and safer bounds checks. | 
					
						
							|  |  |  |  * Possibly extend format specifiers and documentation. | 
					
						
							| 
									
										
										
										
											2017-11-24 23:54:42 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 4. Contact | 
					
						
							| 
									
										
										
										
											2025-10-09 23:23:03 +03:00
										 |  |  | Email: alex@vapaa.xyz |