bRAWcap 1.1.0
b-plus Technologies - Ethernet Performance Transmitter Receiver
Loading...
Searching...
No Matches
brawcap.h
Go to the documentation of this file.
1/**
2 * @file brawcap.h
3 *
4 * @brief bRAWcap API - Functions.
5 *
6 * This file contains generic parts of the API and includes all specific bRAWcap parts.
7 *
8 * @copyright
9 * <b> © 2021 - b-plus technologies GmbH. All rights reserved!</b>
10 *
11 * All rights exclusively reserved for b-plus GmbH, unless expressly otherwise agreed.
12 *
13 * Redistribution in source or any other form, with or without modification, is not permitted.
14 *
15 * You may use this code under the according license terms of b-plus.
16 * Please contact b-plus at services@b-plus.com to get the appropriate terms and conditions.
17 */
18#ifndef BRAWCAP_H
19#define BRAWCAP_H
20
21#include "brawcap_types_um.h"
22
23#if defined(__cplusplus)
24extern "C"
25{
26#endif //(__cplusplus)
27
28/************************************************ LOGGING ************************************************************/
29#if 1
30/**
31 * @addtogroup brawcap_logging
32 * @{
33 */
34
35/**
36 * @brief Sets the current log level for the given log type to the specified log level.
37 *
38 * @param[in] type Log type for which to configure the log level.
39 *
40 * @param[in] level The log level to be applied.
41 *
42 * @param[in] pKey Key required to activate debug logging.
43 * For any other log level than @ref BRAWCAP_LOG_LEVEL_DEBUG this parameter is not required
44 * and should be set to NULL.
45 *
46 * @return
47 * Status | Description
48 * ---------------------------------------------- | -------------------------------------------------------------------
49 * @ref BRAWCAP_STATUS_SUCCESS | Success.
50 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Attempted to enable debug logging with wrong key.
51 * @ref BRAWCAP_STATUS_ERROR_INVALID_PARAM | None of the specified log types is available.
52 */
54brawcap_log_level_set(const brawcap_log_type_t type, const brawcap_log_level_t level, const char* pKey);
55
56/**
57 * @brief Sets the current log levels for the given log types to the specified log levels.
58 *
59 * @param[in] type Log types for which to configure the log level(s).
60 * Value has to be interpreted as bitfield.
61 * This allows to (de)activate levels for several types with only one call.
62 *
63 * @param[in] level The log levels to be applied.
64 * Value has to be interpreted as bitfield.
65 * This allows to (de)activate several levels with only one call.
66 *
67 * @param[in] pKey Key required to activate debug logging.
68 * For any other log level than @ref BRAWCAP_LOG_LEVEL_DEBUG this parameter is not required
69 * and should be set to NULL.
70 *
71 * @return
72 * Status | Description
73 * ---------------------------------------------- | -------------------------------------------------------------------
74 * @ref BRAWCAP_STATUS_SUCCESS | Success.
75 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Attempted to enable debug logging with wrong key.
76 * @ref BRAWCAP_STATUS_ERROR_INVALID_PARAM | None of the specified log types is available.
77 */
79brawcap_log_levels_set(const UINT32 type, const UINT32 level, const char* pKey);
80
81/**
82 * @brief Reads the level(s) for the given log type.
83 *
84 * @param[in] type Log type for which to read the log level.
85 * It is only possible to retrieve the log level for one type.
86 * Call this function for each type to resolve all log levels.
87 *
88 * @param[out] pLevel Will contain the currently configured log level(s), afterwards.
89 * This value shall be interpreted as bitfield, which allows to resolve all log levels for the type with only one call.
90 *
91 * @return
92 * Status | Description
93 * ---------------------------------------------- | -------------------------------------------------------------------
94 * @ref BRAWCAP_STATUS_SUCCESS | Success.
95 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
96 * @ref BRAWCAP_STATUS_ERROR_INVALID_PARAM | The specified log types is invalid.
97 */
100
101/**@}*/
102#endif
103
104/************************************************ GENERIC ************************************************************/
105#if 1
106/**
107 * @addtogroup brawcap_generics
108 * @{
109 */
110
111/**
112 * @brief Opens a new bRAWcap handle on the adapter, specified by it´s name.
113 *
114 * The created/opened bRAWcap handle should be saved by the user application and used for calling further bRAWcap
115 * functions. Each opened handle shall be @ref brawcap_close "closed", if it is not required anymore.
116 *
117 * @note On Windows a adapter name is always represented by a GUID.
118 *
119 * @note bRAWcap supports multiple handles to the same adapter.
120 * But the total number of open handles on the same adapter is limited to @ref BRAWCAP_HANDLES_PER_ADAPTER_MAX.
121 *
122 * @warning Opening multiple handles to the same adapter, with the same receive filter leads to redundancy and
123 * performance degradation and therefore should be avoided, if possible.
124 *
125 * @param[in] name The name of the adapter to open a bRAWcap handle.
126 *
127 * @param[out] pHandle Will contain the opened bRAWcap handle, afterwards.
128 *
129 * @return
130 * Status | Description
131 * ---------------------------------------------- | -------------------------------------------------------------------
132 * @ref BRAWCAP_STATUS_SUCCESS | Success.
133 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
134 * @ref BRAWCAP_STATUS_ERROR_INVALID_PARAM | The specified name does not represent a adapter name (GUID).
135 * @ref BRAWCAP_STATUS_ERROR_NOT_FOUND | Specified adapter name not found/not available.
136 * @ref BRAWCAP_STATUS_ERROR_DRIVER_NOT_AVAILABLE | bRAWcap driver is not running on specified adapter.
137 * @ref BRAWCAP_STATUS_ERROR_DRIVER_IO_FAILED | Communicating with bRAWcap driver failed.
138 */
141
142/**
143 * @brief Closes the specified bRAWcap handle.
144 *
145 * The user application should not use the specified handle anymore, after calling this function.
146 *
147 * @warning Closing bRAWcap handles is not thread safe and the user is responsible for synchronization.
148 *
149 * @param[in] pHandle bRAWcap handle to be closed.
150 *
151 * @return
152 * Status | Description
153 * ---------------------------------------------- | -------------------------------------------------------------------
154 * @ref BRAWCAP_STATUS_SUCCESS | Success.
155 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
156 * @ref BRAWCAP_STATUS_ERROR_FAILED | A system error occurred.
157 */
160
161/**@}*/
162#endif
163
164/************************************************** STATUS ***********************************************************/
165#if 1
166/**
167 * @addtogroup brawcap_status
168 * @{
169 */
170
171/**
172 * @brief Reads the last status appeared in bRAWcap, for the calling thread.
173 *
174 * The last status is only updated if it does not equal @ref BRAWCAP_STATUS_SUCCESS.
175 * Which means that this function shall never be used to check if a bRAWcap function succeeded.
176 * Instead this should always be checked on each bRAWcap function return value directly
177 * and only if something different than @ref BRAWCAP_STATUS_SUCCESS is returned,
178 * this function can be used to get the last status again.
179 *
180 * The last status may be overwritten when the calling thread calls another bRAWcap function.
181 * It is therefore recommended to call this function directly after a bRAWcap function to get the status of that
182 * function again.
183 *
184 * @note If yet, no other status than @ref BRAWCAP_STATUS_SUCCESS occurred for the calling thread,
185 * @ref BRAWCAP_STATUS_SUCCESS will be returned.
186 *
187 * @return
188 * Status | Description
189 * ---------------------------------------------- | ------------------------------------------------------------------
190 * @ref BRAWCAP_STATUS_SUCCESS | If no other status than success happened for the calling thread.
191 * Any of @ref brawcap_status_t | Please see return of last called function for detailed info.
192 */
195
196/**@}*/
197#endif
198
199/************************************************ VERSION ************************************************************/
200#if 1
201/**
202 * @addtogroup brawcap_version
203 * @{
204 */
205
206/**
207 * @brief Returns loaded bRAWcap library version.
208 *
209 * @param[out] pVersion Will contain the loaded library version, afterwards.
210 *
211 * @return
212 * Status | Description
213 * ---------------------------------------------- | ------------------------------------------------------------------
214 * @ref BRAWCAP_STATUS_SUCCESS | Success.
215 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
216 */
219
220/**
221 * @brief Reads current version of loaded bRAWcap driver.
222 *
223 * @note The driver version is the same for each adapter.
224 * Therefore, it doesn´t matter which handle/adapter is used to read the driver version.
225 *
226 * @param[in] pHandle bRAWcap handle to read from.
227 *
228 * @param[out] pVersion Will contain the bRAWcap driver version, afterwards.
229 *
230 * @return
231 * Status | Description
232 * ---------------------------------------------- | ------------------------------------------------------------------
233 * @ref BRAWCAP_STATUS_SUCCESS | Success.
234 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
235 * @ref BRAWCAP_STATUS_ERROR_DRIVER_IO_FAILED | Communicating with bRAWcap driver failed.
236 */
239
240/**@}*/
241#endif
242
243/*********************************************** TIMESTAMP ***********************************************************/
244#if 1
245/**
246 * @addtogroup brawcap_timestamp
247 * @{
248 */
249
250/**
251 * @brief Reads out the mode of the specified timestamp.
252 *
253 * @param[in] pTimestamp The timestamp to read from.
254 *
255 * @param[out] pMode Will contain the timestamp mode, afterwards.
256 *
257 * @return
258 * Status | Description
259 * ---------------------------------------------- | ------------------------------------------------------------------
260 * @ref BRAWCAP_STATUS_SUCCESS | Success.
261 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
262 */
265
266/**
267 * @brief Reads out the timestamp resolution of the specified timestamp.
268 *
269 * @note If the resolution is unknown it will be set to zero (@ref BRAWCAP_TIMESTAMP_RESOLUTION_UNKNOWN)
270 *
271 * @param[in] pTimestamp The timestamp to read from.
272 *
273 * @param[out] pResolution_ns Will contain the timestamp resolution in nanoseconds, afterwards.
274 *
275 * @return
276 * Status | Description
277 * ---------------------------------------------- | ------------------------------------------------------------------
278 * @ref BRAWCAP_STATUS_SUCCESS | Success.
279 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
280 */
283 brawcap_timestamp_resolution_ns_t* const pResolution_ns);
284
285/**
286 * @brief Reads out the timestamp value in seconds and nanoseconds.
287 *
288 * The values are based on 00:00 01.01.1970.
289 *
290 * The seconds part contains only whole seconds of the timestamp,
291 * while the nanoseconds part contains only the fractional part.
292 *
293 * @param[in] pTimestamp The timestamp to read from.
294 *
295 * @param[out] pSeconds Will contain the whole seconds of the timestamp, afterwards.
296 *
297 * @param[out] pNanoseconds Will contain the fractional part in nanoseconds, afterwards.
298 *
299 * @return
300 * Status | Description
301 * ---------------------------------------------- | ------------------------------------------------------------------
302 * @ref BRAWCAP_STATUS_SUCCESS | Success.
303 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
304 */
306brawcap_timestamp_value_ns_get(brawcap_timestamp_t* const pTimestamp, UINT64* const pSeconds,
307 UINT32* const pNanoseconds);
308
309/**
310 * @brief Sets the timestamp value in seconds and nanoseconds.
311 *
312 * The values has to be based on 00:00 01.01.1970.
313 *
314 * @param[in] pTimestamp The timestamp to be modified.
315 *
316 * @param[in] seconds Whole seconds since 00:00 01.01.1970.
317 *
318 * @param[in] nanoseconds The fractional part in nanoseconds.
319 * This parameter should only contain the fractional timestamp part.
320 * That means that it can never exceed 999.999.999 nanoseconds.
321 *
322 * @return
323 * Status | Description
324 * ---------------------------------------------- | ------------------------------------------------------------------
325 * @ref BRAWCAP_STATUS_SUCCESS | Success.
326 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
327 * @ref BRAWCAP_STATUS_ERROR_PARAM_OUT_OF_RANGE | Nanosecond value to high (only fraction of second).
328 */
330brawcap_timestamp_value_ns_set(brawcap_timestamp_t* const pTimestamp, const UINT64 seconds, const UINT32 nanoseconds);
331
332/**
333 * @brief Reads out the timestamp value in seconds and microseconds.
334 *
335 * The values are based on 00:00 01.01.1970.
336 *
337 * The seconds part contains only whole seconds of the timestamp,
338 * while the microseconds contains only the fractional part.
339 *
340 * @param[in] pTimestamp The timestamp to read from.
341 *
342 * @param[out] pSeconds Will contain the whole seconds of the timestamp, afterwards.
343 *
344 * @param[out] pMicroseconds Will contain the fractional part in microseconds, afterwards.
345 *
346 * @return
347 * Status | Description
348 * ---------------------------------------------- | ------------------------------------------------------------------
349 * @ref BRAWCAP_STATUS_SUCCESS | Success.
350 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
351 */
353brawcap_timestamp_value_us_get(brawcap_timestamp_t* const pTimestamp, UINT64* const pSeconds,
354 UINT32* const pMicroseconds);
355
356/**
357 * @brief Sets the timestamp value in seconds and microseconds.
358 *
359 * The values has to be based on 00:00 01.01.1970.
360 *
361 * @param[in] pTimestamp The timestamp to be modified.
362 *
363 * @param[in] seconds Whole seconds since 00:00 01.01.1970.
364 *
365 * @param[in] microseconds The fractional part in microseconds.
366 * This parameter should only contain the fractional timestamp part.
367 * That means that it can never exceed 999.999 microseconds.
368 *
369 * @return
370 * Status | Description
371 * ---------------------------------------------- | ------------------------------------------------------------------
372 * @ref BRAWCAP_STATUS_SUCCESS | Success.
373 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
374 * @ref BRAWCAP_STATUS_ERROR_PARAM_OUT_OF_RANGE | Nanosecond value to high (only fraction of second).
375 *
376 */
378brawcap_timestamp_value_us_set(brawcap_timestamp_t* const pTimestamp, const UINT64 seconds, const UINT32 microseconds);
379
380/**
381 * @brief Reads out the timestamp value in seconds and milliseconds.
382 *
383 * The values are based on 00:00 01.01.1970.
384 *
385 * The seconds part contains only whole seconds of the timestamp,
386 * while the milliseconds part contains only the fractional part.
387 *
388 * @param[in] pTimestamp The timestamp to read from.
389 *
390 * @param[out] pSeconds Will contain the whole seconds of the timestamp, afterwards.
391 *
392 * @param[out] pMilliseconds Will contain the fractional part in milliseconds, afterwards.
393 *
394 * @return
395 * Status | Description
396 * ---------------------------------------------- | ------------------------------------------------------------------
397 * @ref BRAWCAP_STATUS_SUCCESS | Success.
398 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
399 */
401brawcap_timestamp_value_ms_get(brawcap_timestamp_t* const pTimestamp, UINT64* const pSeconds,
402 UINT32* const pMilliseconds);
403
404/**
405 * @brief Sets the timestamp value in seconds and milliseconds.
406 *
407 * The values has to be based on 00:00 01.01.1970.
408 *
409 * @param[in] pTimestamp The timestamp to be modified.
410 *
411 * @param[in] seconds Whole seconds since 00:00 01.01.1970.
412 *
413 * @param[in] milliseconds The fractional part in milliseconds.
414 * This parameter should only contain the fractional timestamp part.
415 * That means that it can never exceed 999 milliseconds.
416 *
417 * @return
418 * Status | Description
419 * ---------------------------------------------- | ------------------------------------------------------------------
420 * @ref BRAWCAP_STATUS_SUCCESS | Success.
421 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
422 * @ref BRAWCAP_STATUS_ERROR_PARAM_OUT_OF_RANGE | Nanosecond value to high (only fraction of second).
423 */
425brawcap_timestamp_value_ms_set(brawcap_timestamp_t* const pTimestamp, const UINT64 seconds, const UINT32 milliseconds);
426
427/**@}*/
428#endif
429
430/************************************************ PACKET *************************************************************/
431#if 1
432/**
433 * @addtogroup brawcap_packet
434 * @{
435 */
436
437/**
438 * @brief Creates a new packet.
439 *
440 * A packet can be used for @ref brawcap_rx_packet "receiving" (single packet based) or
441 * @ref brawcap_tx_packet "transmitting"
442 * (also single packet based).
443 *
444 * If a packet is not required anymore it should be @ref brawcap_packet_free "freed".
445 *
446 * @param[out] pPacket Will contain the new created packet, afterwards.
447 *
448 * @param[in] maxSize The maximum supported byte size for the packet payload.
449 * This value cannot be changed after packet creation and determines how much memory is required for the packet.
450 * The packet can only contain payloads up to this value.
451 *
452 * @return
453 * Status | Description
454 * ---------------------------------------------- | ------------------------------------------------------------------
455 * @ref BRAWCAP_STATUS_SUCCESS | Success.
456 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
457 * @ref BRAWCAP_STATUS_ERROR_PARAM_OUT_OF_RANGE | Packet payload byte size to low/high.
458 * @ref BRAWCAP_STATUS_ERROR_FAILED | System error occurred (e.g. out of memory).
459 */
462
463/**
464 * @brief Frees the specified packet.
465 * When this function is called the specified packet becomes invalid and it´s memory is released.
466 *
467 * @warning Freeing a packet is not thread safe and the user is responsible for synchronization.
468 *
469 * @param[in] pPacket The packet to be freed.
470 *
471 * @return
472 * Status | Description
473 * ---------------------------------------------- | ------------------------------------------------------------------
474 * @ref BRAWCAP_STATUS_SUCCESS | Success.
475 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
476 */
479
480/**
481 * @brief Reads out the status for the specified packet.
482 * The status will be set updated during reception/transmission.
483 * It indicates the status of the packet depending on the operation.
484 *
485 * @param[in] pPacket The packet to read from.
486 *
487 * @param[out] pStatus Will contain the packet status, afterwards.
488 *
489 * @return
490 * Status | Description
491 * ---------------------------------------------- | ------------------------------------------------------------------
492 * @ref BRAWCAP_STATUS_SUCCESS | Success.
493 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
494 */
497
498/**
499 * @brief Reads out the @ref brawcap_timestamp "timestamp" object for the specified packet.
500 *
501 * @attention The timestamp is part of the packet itself.
502 * Therefore the returned timestamp is only valid as long as the packet itself is valid.
503 * The user application shall not store the timestamp object separately and only used it as long as the packet is valid.
504 *
505 * @param[in] pPacket The packet to read from.
506 *
507 * @param[out] pTimestamp Will contain the timestamp object of the packet, afterwards.
508 * This object can be used by the @ref brawcap_timestamp module.
509 *
510 * @return
511 * Status | Description
512 * ---------------------------------------------- | ------------------------------------------------------------------
513 * @ref BRAWCAP_STATUS_SUCCESS | Success.
514 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
515 */
518
519/**
520 * @brief Reads out the length on wire of the specified packet.
521 * This value is especially useful for received packets.
522 * It indicates the total packet payload byte size of the packet on wire.
523 * This may not equal to the @ref brawcap_packet_payload_size_get "captured payload byte size".
524 * Because the payload byte size depends on the configured filter and it´s
525 * @ref brawcap_filter_bytes_to_capture_set "bytes to capture" parameters.
526 *
527 * @param[in] pPacket The packet to read from.
528 *
529 * @param[out] pLengthOnWire Will contain the payload byte length on wire, afterwards.
530 *
531 * @return
532 * Status | Description
533 * ---------------------------------------------- | ------------------------------------------------------------------
534 * @ref BRAWCAP_STATUS_SUCCESS | Success.
535 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
536 */
539
540/**
541 * @brief Reads out the max supported payload byte size of the specified packet.
542 * This value was set during packet @ref brawcap_packet_create "creation"
543 * (or @ref brawcap_buffer_create "buffer creation" if it´s a buffered packet).
544 *
545 * @param[in] pPacket The packet to read from.
546 *
547 * @param[out] pMaxPayloadSize Will contain the max packet payload byte size, afterwards.
548 *
549 * @return
550 * Status | Description
551 * ---------------------------------------------- | ------------------------------------------------------------------
552 * @ref BRAWCAP_STATUS_SUCCESS | Success.
553 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
554 */
557
558/**
559 * @brief Reads out the captured payload byte size of the specified packet.
560 * This indicates the total byte size of the (captured - if received) packet payload
561 *
562 * @param[in] pPacket The packet to read from.
563 *
564 * @param[out] pLength Will contain the captured payload byte size, afterwards.
565 *
566 * @return
567 * Status | Description
568 * ---------------------------------------------- | ------------------------------------------------------------------
569 * @ref BRAWCAP_STATUS_SUCCESS | Success.
570 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
571 */
574
575/**
576 * @brief Reads out the payload of the specified packet.
577 *
578 * The function returns a pointer to the beginning of the packet payload.
579 *
580 * @note The returned payload pointer should be only accessed as long as the packet is not freed.
581 * If post processing is required a copy of the required payload should be done.
582 *
583 * @attention Accessing the packet payload is not thread safe and user is responsible for synchronization.
584 *
585 * @par Byte order
586 * The packet payload bytes are returned exactly as captured / constructed on the wire. For multi-byte protocol
587 * fields this means network byte order (big endian). No host <-> network endianness conversion is performed by
588 * bRAWcap. User code that interprets multi-byte integers must perform the appropriate conversion.
589 *
590 * @deprecated Use @ref brawcap_packet_payload_get_v2 instead.
591 *
592 * @param[in] pPacket The packet to read from.
593 *
594 * @param[out] pPayload Will contain a pointer to the beginning of the packet payload, afterwards.
595 *
596 * @param[out] pLength Will contain the total length of the packet payload, afterwards.
597 *
598 * @return
599 * Status | Description
600 * ---------------------------------------------- | ------------------------------------------------------------------
601 * @ref BRAWCAP_STATUS_SUCCESS | Success.
602 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
603 */
604_BRAWCAP_DEPRECATED
606brawcap_packet_payload_get(brawcap_packet_t* const pPacket, const char** const pPayload,
607 brawcap_packet_size_t* const pLength);
608
609/**
610 * @brief Reads out the payload of the specified packet.
611 *
612 * The function returns a pointer to the beginning of the packet payload.
613 *
614 * @note The returned payload pointer should be only accessed as long as the packet is not freed.
615 * If post processing is required a copy of the required payload should be done.
616 *
617 * @attention Accessing the packet payload is not thread safe and user is responsible for synchronization.
618 *
619 * @par Byte order
620 * The payload reflects the exact on-the-wire representation (network order for multi-byte fields). bRAWcap does not
621 * transform endianness; callers parsing headers (e.g. IPv4, TCP) must convert multi-byte fields to host order where
622 * needed.
623 *
624 * @param[in] pPacket The packet to read from.
625 *
626 * @param[out] pPayload Will contain a pointer to the beginning of the packet payload, afterwards.
627 *
628 * @param[out] pLength Will contain the total length of the packet payload, afterwards.
629 *
630 * @return
631 * Status | Description
632 * ---------------------------------------------- | ------------------------------------------------------------------
633 * @ref BRAWCAP_STATUS_SUCCESS | Success.
634 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
635 */
637brawcap_packet_payload_get_v2(brawcap_packet_t* const pPacket, const unsigned char** const pPayload,
638 brawcap_packet_size_t* const pLength);
639
640 /**
641 * @brief Sets the packet payload of the specified packet.
642 *
643 * @note It is not allowed to set a larger payload than the max byte payload size
644 * (specified during @ref brawcap_packet_create "packet creation" or
645 * @ref brawcap_buffer_create "buffer creation").
646 * If a larger payload is specified the function will fail and return an error.
647 *
648 * @par Byte order
649 * The provided @p pPayload buffer must already be in the desired on-the-wire layout. bRAWcap will transmit /
650 * store the bytes verbatim without performing any host-to-network conversions. For multi-byte protocol values
651 * you must encode them in network byte order (big endian) before calling this function.
652 *
653 * @deprecated Use @ref brawcap_packet_payload_set_v2 instead.
654 *
655 * @param[in] pPacket The packet to be modified.
656 *
657 * @param[in] pPayload Pointer to the beginning of the payload to set.
658 *
659 * @param[in] length Total byte size of the payload to set.
660 *
661 * @return
662 * Status | Description
663 * ---------------------------------------------- | ------------------------------------------------------------------
664 * @ref BRAWCAP_STATUS_SUCCESS | Success.
665 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
666 * @ref BRAWCAP_STATUS_ERROR_PARAM_OUT_OF_RANGE | The specified payload size exceeds the packet max payload size.
667 */
668_BRAWCAP_DEPRECATED
670brawcap_packet_payload_set(brawcap_packet_t* const pPacket, const char* const pPayload,
671 const brawcap_packet_size_t length);
672
673
674/**
675 * @brief Sets the packet payload of the specified packet.
676 *
677 * @note It is not allowed to set a larger payload than the max byte payload size
678 * (specified during @ref brawcap_packet_create "packet creation" or
679 * @ref brawcap_buffer_create "buffer creation").
680 * If a larger payload is specified the function will fail and return an error.
681 *
682 * @par Byte order
683 * The payload is taken exactly as provided and treated as on-the-wire bytes. Caller code must ensure multi-byte
684 * protocol fields are encoded in network byte order (big endian) prior to calling.
685 *
686 * @param[in] pPacket The packet to be modified.
687 *
688 * @param[in] pPayload Pointer to the beginning of the payload to set.
689 *
690 * @param[in] length Total byte size of the payload to set.
691 *
692 * @return
693 * Status | Description
694 * ---------------------------------------------- | ------------------------------------------------------------------
695 * @ref BRAWCAP_STATUS_SUCCESS | Success.
696 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
697 * @ref BRAWCAP_STATUS_ERROR_PARAM_OUT_OF_RANGE | The specified payload size exceeds the packet max payload size.
698 */
700brawcap_packet_payload_set_v2(brawcap_packet_t* const pPacket, const unsigned char* const pPayload,
701 const brawcap_packet_size_t length);
702
703/**@}*/
704#endif
705
706/************************************************* BUFFER ************************************************************/
707#if 1
708/**
709 * @addtogroup brawcap_buffer
710 * @{
711 */
712
713/**
714 * @brief Creates a new packet buffer.
715 *
716 * The created buffer can be used for:
717 * - Receiving by @ref brawcap_rx_buffer_attach "attaching" it.
718 * - Transmitting by @ref brawcap_tx_buffer_send "sending" it.
719 *
720 * If a buffer is not required anymore it shall be @ref brawcap_buffer_free "freed".
721 *
722 * @param[out] pBuffer Will contain the new created packet buffer, afterwards.
723 *
724 * @param[in] maxPacketPayloadSize Specifies the max payload byte size for each packet in the buffer.
725 * This cannot be changed after buffer creation and controls the memory size required for each packet in the buffer.
726 * When trying to set the packet payload of any buffered packet which exceeds this value, it will fail.
727 * The value has to be between @ref BRAWCAP_PACKET_SIZE_MIN and @ref BRAWCAP_PACKET_SIZE_MAX.
728 *
729 * @param[in] numPackets Specifies how many packets can be stored in the buffer.
730 * This value, together with the max packet payload size, will control the total amount of memory required for
731 * the packet buffer and cannot be changed after buffer creation.
732 * The value has to be between @ref BRAWCAP_BUFFER_PACKETS_MIN and @ref BRAWCAP_BUFFER_PACKETS_MAX.
733 *
734 * @return
735 * Status | Description
736 * ---------------------------------------------- | ------------------------------------------------------------------
737 * @ref BRAWCAP_STATUS_SUCCESS | Success.
738 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
739 * @ref BRAWCAP_STATUS_ERROR_PARAM_OUT_OF_RANGE | The specified packet payload or number of packets is invalid.
740 * @ref BRAWCAP_STATUS_ERROR_FAILED | System error occurred (e.g. out of memory).
741 */
743brawcap_buffer_create(brawcap_buffer_t** const pBuffer, const brawcap_packet_size_t maxPacketPayloadSize,
744 const brawcap_buffer_packet_count_t numPackets);
745
746/**
747 * @brief Frees the specified packet buffer.
748 * When this function is called the specified packet buffer becomes invalid and it´s memory will be released.
749 *
750 * @warning Freeing a buffer is not thread safe and the user is responsible for synchronization.
751 *
752 * @param[in] pBuffer The packet buffer to be freed.
753 *
754 * @return
755 * Status | Description
756 * ---------------------------------------------- | ------------------------------------------------------------------
757 * @ref BRAWCAP_STATUS_SUCCESS | Success.
758 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
759 * @ref BRAWCAP_STATUS_ERROR_IN_USE | Buffer is still in use/pending (receive/transmit).
760 */
763
764/**
765 * @brief Clears the specified packet buffer.
766 *
767 * All buffered packets will be cleared.
768 * It may be used to reuse a already created packet buffer.
769 * For example this can be useful after transmission of the packet buffer has finished.
770 * Reusing a buffer improves performance and should be preferred instead of always creating and freeing packet
771 * buffers.
772 *
773 * @warning After calling this function all buffered packets in the packet buffer become invalid and shall not be used
774 * anymore.
775 *
776 * @param[in] pBuffer The packet buffer to be cleared.
777 *
778 * @return
779 * Status | Description
780 * ---------------------------------------------- | ------------------------------------------------------------------
781 * @ref BRAWCAP_STATUS_SUCCESS | Success.
782 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
783 * @ref BRAWCAP_STATUS_ERROR_IN_USE | Buffer is still in use/pending (receive/transmit).
784 */
787
788/**
789 * @brief Adds the specified packet at the end of the specified packet buffer.
790 *
791 * @param[in] pBuffer The packet buffer to be modified.
792 *
793 * @param[in] pPacket The packet to insert into the buffer.
794 *
795 * @return
796 * Status | Description
797 * ---------------------------------------------- | ------------------------------------------------------------------
798 * @ref BRAWCAP_STATUS_SUCCESS | Success.
799 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
800 * @ref BRAWCAP_STATUS_ERROR_IN_USE | Buffer is still in use/pending (receive/transmit).
801 * @ref BRAWCAP_STATUS_ERROR_OVERRUN | The max number of packets for the buffer is reached.
802 * @ref BRAWCAP_STATUS_ERROR_PARAM_OUT_OF_RANGE | The packet payload length is to long for the buffer.
803 */
805brawcap_buffer_add_back(brawcap_buffer_t* const pBuffer, const brawcap_packet_t* const pPacket);
806
807/**
808 * @brief Adds the specified packet at the front of the specified packet buffer.
809 *
810 * @param[in] pBuffer The packet buffer to be modified.
811 *
812 * @param[in] pPacket The packet to insert into the buffer.
813 *
814 * @return
815 * Status | Description
816 * ---------------------------------------------- | ------------------------------------------------------------------
817 * @ref BRAWCAP_STATUS_SUCCESS | Success.
818 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
819 * @ref BRAWCAP_STATUS_ERROR_IN_USE | Buffer is still in use/pending (receive/transmit).
820 * @ref BRAWCAP_STATUS_ERROR_OVERRUN | The max number of packets for the buffer is reached.
821 * @ref BRAWCAP_STATUS_ERROR_PARAM_OUT_OF_RANGE | The packet payload length is to long for the buffer.
822 */
824brawcap_buffer_add_front(brawcap_buffer_t* const pBuffer, const brawcap_packet_t* const pPacket);
825
826/**
827 * @brief Inserts the specified packet at index/position into the specified packet buffer.
828 *
829 * @param[in] pBuffer The packet buffer to be modified.
830 *
831 * @param[in] pPacket The packet to insert into the buffer.
832 *
833 * @param[in] index Index at which the packet should be inserted.
834 *
835 * @return
836 * Status | Description
837 * ---------------------------------------------- | ------------------------------------------------------------------
838 * @ref BRAWCAP_STATUS_SUCCESS | Success.
839 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
840 * @ref BRAWCAP_STATUS_ERROR_IN_USE | Buffer is still in use/pending (receive/transmit).
841 * @ref BRAWCAP_STATUS_ERROR_OVERRUN | The max number of packets for the buffer is reached.
842 * @ref BRAWCAP_STATUS_ERROR_PARAM_OUT_OF_RANGE | The packet payload length is to long for the buffer.
843 * @ref BRAWCAP_STATUS_ERROR_INVALID_PARAM | The given index is invalid (exceeds buffer).
844 */
848
849/**
850 * @brief Reads out a buffered packet at the index of the specified packet buffer.
851 *
852 * @param[in] pBuffer The packet buffer to read from.
853 *
854 * @param[in] index The index of the packet.
855 *
856 * @param[out] pPacket Will contain the buffered packet, afterwards.
857 *
858 * @return
859 * Status | Description
860 * ---------------------------------------------- | ------------------------------------------------------------------
861 * @ref BRAWCAP_STATUS_SUCCESS | Success.
862 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
863 * @ref BRAWCAP_STATUS_ERROR_IN_USE | Buffer is still in use/pending (receive/transmit).
864 * @ref BRAWCAP_STATUS_ERROR_INVALID_PARAM | The given index is invalid (exceeds buffer).
865 */
868 brawcap_packet_t** const pPacket);
869
870/**
871 * @brief Reads out the first buffered packet of the specified packet buffer.
872 *
873 * @param[in] pBuffer The packet buffer to read from.
874 *
875 * @param[out] pPacket Will contain the buffered packet, afterwards.
876 *
877 * @return
878 * Status | Description
879 * ---------------------------------------------- | ------------------------------------------------------------------
880 * @ref BRAWCAP_STATUS_SUCCESS | Success.
881 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
882 * @ref BRAWCAP_STATUS_ERROR_IN_USE | Buffer is still in use/pending (receive/transmit).
883 */
886
887/**
888 * @brief Reads out the last buffered packet of the specified packet buffer.
889 *
890 * @param[in] pBuffer The packet buffer to read from.
891 *
892 * @param[out] pPacket Will contain the buffered packet, afterwards.
893 *
894 * @return
895 * Status | Description
896 * ---------------------------------------------- | ------------------------------------------------------------------
897 * @ref BRAWCAP_STATUS_SUCCESS | Success.
898 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
899 * @ref BRAWCAP_STATUS_ERROR_IN_USE | Buffer is still in use/pending (receive/transmit).
900 */
903
904/**
905 * @brief Reads out the number of currently buffered packets in the specified packet buffer.
906 *
907 * @param[in] pBuffer The packet buffer to read from.
908 *
909 * @param[out] pPacketCount Will contain the number of buffered packets, afterwards.
910 *
911 * @return
912 * Status | Description
913 * ---------------------------------------------- | ------------------------------------------------------------------
914 * @ref BRAWCAP_STATUS_SUCCESS | Success.
915 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
916 * @ref BRAWCAP_STATUS_ERROR_IN_USE | Buffer is still in use/pending (receive/transmit).
917 */
920
921/**
922 * @brief Reads out the total number of packets which can be buffered by the specified packet buffer.
923 * This value represents the packet buffer capacity, which is set during buffer creation.
924 *
925 * @param[in] pBuffer The packet buffer to read from.
926 *
927 * @param[out] pPacketCapacity Will contain the total number of packets which can be buffered, afterwards.
928 *
929 * @return
930 * Status | Description
931 * ---------------------------------------------- | ------------------------------------------------------------------
932 * @ref BRAWCAP_STATUS_SUCCESS | Success.
933 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
934 * @ref BRAWCAP_STATUS_ERROR_IN_USE | Buffer is still in use/pending (receive/transmit).
935 */
938
939/**
940 * @brief Sorts packets in a buffer by timestamp or by a payload field.
941 *
942 * Purpose: Provides deterministic ordering for analysis, replay or synchronized transmission preparation.
943 *
944 * Modes (@p type):
945 * - TIMESTAMP : Uses packet receive (or transmit) timestamp. Requires packets to be timestamped.
946 * - PAYLOAD : Compares a payload slice defined by (@p offset,@p length).
947 * - NONE : No sorting (function returns success, buffer unchanged).
948 *
949 * Order (@p order): RISING (ascending) or FALLING (descending). NONE => no change.
950 *
951 * Payload mode specifics:
952 * - Offset origin is the first payload byte (index 0).
953 * - Every packet must satisfy offset + length <= captured payload size or the call fails with PARAM_OUT_OF_RANGE.
954 * - length == 0 => no-op (treated like NONE).
955 * - Endianness (@p endian) controls multi-byte numeric interpretation for common field sizes (1/2/4/8). For other
956 * lengths a byte-wise comparison is performed in the direction implied by endian.
957 *
958 * Endianness (@p endian): BIG = network order; LITTLE = host little-endian. Ignored for timestamp mode or length <= 1.
959 *
960 * Stability: Not stable (equal keys may reorder). If stable ordering is required, apply a stable algorithm afterwards.
961 *
962 * Usage constraints:
963 * - Buffer must not be attached to an active receive or transmit operation (else ERROR_IN_USE).
964 * - Provide valid enumeration values; invalid combinations yield ERROR_INVALID_PARAM.
965 *
966 * Common use cases:
967 * - Prepare buffers for synchronized transmission (sort by timestamp RISING).
968 * - Group flows or detect gaps by sorting on protocol header fields (e.g. TCP sequence number slice).
969 *
970 * @param[in] pBuffer Buffer to sort.
971 * @param[in] order Desired order (ignored if type NONE or length == 0).
972 * @param[in] type Sort key type.
973 * @param[in] offset Payload slice start (payload mode only).
974 * @param[in] length Payload slice length (payload mode only; 0=no-op).
975 * @param[in] endian Endianness for multi-byte payload slice (payload mode only).
976 *
977 * @return
978 * Status | Description
979 * ---------------------------------------------- | -----------------------------------------------------------
980 * @ref BRAWCAP_STATUS_SUCCESS | Completed (or no-op).
981 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | pBuffer NULL.
982 * @ref BRAWCAP_STATUS_ERROR_IN_USE | Buffer currently attached / in use.
983 * @ref BRAWCAP_STATUS_ERROR_PARAM_OUT_OF_RANGE | Offset/length invalid for at least one packet.
984 * @ref BRAWCAP_STATUS_ERROR_INVALID_PARAM | Invalid enum value combination.
985 */
988 const brawcap_buffer_sort_types_t type, const brawcap_packet_size_t offset,
989 const brawcap_packet_size_t length, const brawcap_buffer_sort_endian_t endian);
990
991/********************************************* BUFFER ITERATOR ********************************************************/
992#if 1
993/**
994 * @addtogroup brawcap_buffer_iterator
995 * @{
996 */
997
998/**
999 * @brief Creates a new iterator for the specified buffer.
1000 *
1001 * If a iterator is not required anymore it shall be @ref brawcap_buffer_iterator_free "freed".
1002 *
1003 * @param[out] pIterator Will contain the new created iterator.
1004 *
1005 * @param[in] pBuffer The buffer for which to create the iterator.
1006 *
1007 * @param[in] startPosition The start position of the iterator (packet buffer index/position).
1008 * The specified position must be below the number of currently buffered packets,
1009 * which can be resolved with @ref brawcap_buffer_count.
1010 *
1011 * @return
1012 * Status | Description
1013 * ---------------------------------------------- | ------------------------------------------------------------------
1014 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1015 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
1016 * @ref BRAWCAP_STATUS_ERROR_IN_USE | Buffer is still in use/pending (receive/transmit).
1017 * @ref BRAWCAP_STATUS_ERROR_INVALID_PARAM | Start position exceeds number of buffered packets.
1018 * @ref BRAWCAP_STATUS_ERROR_FAILED | System error occurred (e.g. out of memory).
1019 */
1022 brawcap_buffer_packet_count_t startPosition);
1023
1024/**
1025 * @brief Frees the specified iterator.
1026 * When this function is called the specified iterator becomes invalid and it´s memory will be released.
1027 *
1028 * @warning Freeing a iterator is not thread safe and the user is responsible for synchronization.
1029 *
1030 * @param[in] pIterator The iterator to be freed.
1031 *
1032 * @return
1033 * Status | Description
1034 * ---------------------------------------------- | ------------------------------------------------------------------
1035 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1036 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
1037 */
1040
1041/**
1042 * @brief Increments the iterator to the next buffered packet.
1043 *
1044 * @param[in] pIterator The iterator to be incremented.
1045 *
1046 * @return
1047 * Status | Description
1048 * ---------------------------------------------- | ------------------------------------------------------------------
1049 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1050 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
1051 */
1054
1055/**
1056 * @brief Decreases the iterator to the previous buffered packet.
1057 *
1058 * @param[in] pIterator The iterator to be decremented.
1059 *
1060 * @return
1061 * Status | Description
1062 * ---------------------------------------------- | ------------------------------------------------------------------
1063 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1064 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
1065 */
1068
1069/**
1070 * @brief Returns the buffered packet for the specified iterator.
1071 *
1072 * @param[in] pIterator The iterator to read from.
1073 *
1074 * @return
1075 * Pointer | Description
1076 * ---------------------------------------------- | ------------------------------------------------------------------
1077 * @ref brawcap_packet_t | On success a valid bRAWcap packet object pointer.
1078 * NULL | Invalid iterator (e.g. beyond the last or first packet).
1079 */
1082
1083/**@}*/
1084#endif
1085
1086/**@}*/
1087#endif
1088
1089/************************************************ ADAPTER ************************************************************/
1090#if 1
1091/**
1092 * @addtogroup brawcap_adapter
1093 * @{
1094 */
1095
1096/**
1097 * @brief Updates the list of supported adapters.
1098 * This function searches the current machine for supported adapters and add them to the adapter list.
1099 *
1100 * @note The list will be initialized when calling the first bRAWcap function and not update automatically after that.
1101 * To update the list later on use this function.
1102 * A alternative to detect new/removed adapters is
1103 * @ref brawcap_adapter_notify_register "registering for change notifications".
1104 *
1105 * @attention The adapter list is not thread safe.
1106 * Therefore parallel calls to this function, @ref brawcap_adapter_list_count and @ref brawcap_adapter_list_at
1107 * should be avoided or at least synchronized.
1108 * If the list is changed by this function and another thread is currently retrieving information from the list
1109 * it may lead to undefined behavior or even a crash if the number of entries is reduced.
1110 *
1111 * @return
1112 * Status | Description
1113 * ---------------------------------------------- | ------------------------------------------------------------------
1114 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1115 */
1118
1119/**
1120 * @brief Reads out the current number of supported adapters in the adapter list.
1121 *
1122 * @note The count is only updated after a call to @ref brawcap_adapter_list_update.
1123 *
1124 * @attention Updating the list and retrieving information from it is not thread safe.
1125 * Therefore accessing it from different threads shall be avoided or synchronized.
1126 *
1127 * @param[out] pCount Will contain the current number of adapters in the list, afterwards.
1128 *
1129 * @return
1130 * Status | Description
1131 * ---------------------------------------------- | ------------------------------------------------------------------
1132 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1133 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
1134 */
1137
1138/**
1139 * @brief Reads out the adapter name of the adapter at the adapter list index.
1140 *
1141 * @note The adapter list is only updated after a call to @ref brawcap_adapter_list_update.
1142 *
1143 * @attention Updating the list and retrieving information from it is not thread safe.
1144 * Therefore accessing it from different threads shall be avoided or synchronized.
1145 *
1146 * @param[in] index The index of the adapter in the adapter list..
1147 *
1148 * @param[out] name Will contain the name of the adapter, afterwards.
1149 *
1150 * @return
1151 * Status | Description
1152 * ---------------------------------------------- | ------------------------------------------------------------------
1153 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1154 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
1155 * @ref BRAWCAP_STATUS_ERROR_PARAM_OUT_OF_RANGE | Specified index exceeds adapter list length.
1156 */
1159
1160/**
1161 * @brief Registers the calling process for receiving adapter change notifications.
1162 *
1163 * The given callback function will be called each time a adapter change is recognized by bRAWcap for any of the
1164 * supported adapters on the current machine.
1165 *
1166 * @attention Blocking for long periods within the callback function can lead to incorrect behavior
1167 * and should be avoided.
1168 * If you need to process a lot on adapter changes it is recommended to do the processing in
1169 * another thread rather than directly within the callback.
1170 *
1171 * @note Calls to the registered callback function are serialized.
1172 * This means that the callback can not be called in parallel and
1173 * one call has to be finished before another one is received.
1174 *
1175 * @note Each process can only register for notifications once.
1176 *
1177 * @param[in] callback Function pointer to the callback function which should be executed each time
1178 * a adapter change is registered.
1179 *
1180 * @param[in] pUser Pointer to a user defined context.
1181 * This allows access to user specific data within the callback.
1182 *
1183 * @return
1184 * Status | Description
1185 * ---------------------------------------------- | ------------------------------------------------------------------
1186 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1187 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
1188 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1189 * @ref BRAWCAP_STATUS_INFO_ALREADY_REGISTERED | Calling process has already registered for this notification.
1190 */
1193
1194/**
1195 * @brief Unregisters the calling process from receiving adapter change notifications.
1196 *
1197 * @return
1198 * Status | Description
1199 * ---------------------------------------------- | ------------------------------------------------------------------
1200 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1201 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1202 * @ref BRAWCAP_STATUS_INFO_NOT_REGISTERED | Calling process was not registered for this notification.
1203 */
1206
1207/**
1208 * @brief Registers the specified handle for receiving adapter change notifications.
1209 *
1210 * This registration only receives adapter change notifications related to the underlying adapter of the given
1211 * bRAWcap handle.
1212 * Whereas @ref brawcap_adapter_notify_register notifies about adapter changes for all supported adapters on the
1213 * current machine.
1214 *
1215 * Each bRAWcap handle can register for this notification once.
1216 *
1217 * @attention Blocking for long periods within the callback function can lead to incorrect behavior
1218 * and should be avoided. If you need to process a lot on adapter changes it is recommended to do the processing in
1219 * another thread rather than directly within the callback.
1220 *
1221 * @note Calls to the registered callback function are serialized.
1222 * This means that the callback can not be called in parallel and
1223 * one call has to be finished before another one is received.
1224 *
1225 * @param[in] pHandle Handle to register for adapter notifications.
1226 *
1227 * @param[in] pUser Pointer to a user defined context.
1228 * This allows access to user specific data within the callback.
1229 *
1230 * @param[in] callback Function pointer to the callback function which should be executed each time
1231 * a adapter change is registered.
1232 *
1233 * @return
1234 * Status | Description
1235 * ---------------------------------------------- | ------------------------------------------------------------------
1236 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1237 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
1238 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1239 * @ref BRAWCAP_STATUS_INFO_ALREADY_REGISTERED | Specified handle has already registered for this notification.
1240 */
1243 brawcap_adapter_notify_handle_callback_t const callback, void* const pUser);
1244
1245/**
1246 * @brief Unregisters the specified handle from receiving adapter change notifications.
1247 *
1248 * @param[in] pHandle Handle to unregister for adapter notifications.
1249 *
1250 * @return
1251 * Status | Description
1252 * ---------------------------------------------- | ------------------------------------------------------------------
1253 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1254 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
1255 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1256 * @ref BRAWCAP_STATUS_INFO_NOT_REGISTERED | Specified handle was not registered for this notification.
1257 */
1260
1261/**
1262 * @brief Reads out the adapter name of the specified adapter.
1263 *
1264 * @param[in] pHandle The bRAWcap handle to read from.
1265 *
1266 * @param[out] name Will contain the adapter name, afterwards.
1267 *
1268 * @return
1269 * Status | Description
1270 * ---------------------------------------------- | ------------------------------------------------------------------
1271 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1272 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
1273 */
1276
1277/**
1278 * @brief Reads out the currently set adapter friendly name for the specified adapter.
1279 *
1280 * @param[in] name Name of the adapter.
1281 *
1282 * @param[out] friendlyName Pointer to a buffer which will contain the currently set adapter friendly name, afterwards.
1283 * This parameter can be NULL.
1284 * If it is NULL the function will set the required buffer length in pLength and
1285 * return @ref BRAWCAP_STATUS_ERROR_OVERRUN.
1286 *
1287 * @param[inout] pLength Length of the provided buffer.
1288 * If the specified length is to short,
1289 * it will be set to the required length and @ref BRAWCAP_STATUS_ERROR_OVERRUN is returned.
1290 *
1291 * @return
1292 * Status | Description
1293 * ---------------------------------------------- | ------------------------------------------------------------------
1294 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1295 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1296 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1297 * @ref BRAWCAP_STATUS_ERROR_NOT_FOUND | Adapter name not found/not available.
1298 * @ref BRAWCAP_STATUS_ERROR_OVERRUN | Given buffer length was to short.
1299 */
1301brawcap_adapter_friendly_name(const brawcap_adapter_name_t name, char* const friendlyName, UINT32* const pLength);
1302
1303/**
1304 * @brief Reads out the currently set friendly name of the specified adapter.
1305 *
1306 * @param[in] pHandle The bRAWcap handle to read from.
1307 *
1308 * @param[out] friendlyName Pointer to a buffer which will contain the currently set friendly name, afterwards.
1309 * This parameter can be NULL.
1310 * If it is NULL the function will set the required buffer length in pLength and
1311 * return @ref BRAWCAP_STATUS_ERROR_OVERRUN.
1312 *
1313 * @param[inout] pLength Length of the provided buffer.
1314 * If the specified length is to short,
1315 * it will be set to the required length and @ref BRAWCAP_STATUS_ERROR_OVERRUN is returned.
1316 *
1317 * @return
1318 * Status | Description
1319 * ---------------------------------------------- | -----------------------------------------------------------
1320 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1321 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1322 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1323 * @ref BRAWCAP_STATUS_ERROR_OVERRUN | Given buffer length was to short.
1324 */
1326brawcap_adapter_friendly_name_by_handle(brawcap_handle_t* const pHandle, char* const friendlyName,
1327 UINT32* const pLength);
1328
1329/**
1330 * @brief Reads out the description of the specified adapter.
1331 *
1332 * @note Adapter descriptions are set depending on the loaded network adapter driver.
1333 * This means it will not change as long as the network driver is not changed.
1334 *
1335 * @param[in] name Name of the adapter.
1336 *
1337 * @param[out] description Pointer to a buffer which will contain the description, afterwards.
1338 * This parameter can be NULL.
1339 * If it is NULL the function will set the required buffer length in pLength and
1340 * return @ref BRAWCAP_STATUS_ERROR_OVERRUN.
1341 *
1342 * @param[inout] pLength Length of the provided buffer.
1343 * If the specified length is to short,
1344 * it will be set to the required length and @ref BRAWCAP_STATUS_ERROR_OVERRUN is returned.
1345 *
1346 * @return
1347 * Status | Description
1348 * ---------------------------------------------- | -----------------------------------------------------------
1349 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1350 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1351 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1352 * @ref BRAWCAP_STATUS_ERROR_NOT_FOUND | Adapter name not found/not available.
1353 * @ref BRAWCAP_STATUS_ERROR_OVERRUN | Given buffer length was to short.
1354 */
1356brawcap_adapter_description(const brawcap_adapter_name_t name, char* const description, UINT32* const pLength);
1357
1358/**
1359 * @brief Reads out the description of a network adapter based on the specified adapter.
1360 *
1361 * @note Adapter descriptions are set depending on the loaded network adapter driver.
1362 * This means it will not change as long as the network driver is not changed.
1363 *
1364 * @param[in] pHandle The bRAWcap handle to read from.
1365 *
1366 * @param[out] description Pointer to a buffer which will contain the description, afterwards.
1367 * This parameter can be NULL.
1368 * If it is NULL the required buffer length will be set for pLength and the
1369 * function will return @ref BRAWCAP_STATUS_ERROR_OVERRUN.
1370 *
1371 * @param[inout] pLength Length of the provided buffer.
1372 * If the specified length is to short,
1373 * it will be set to the required length and @ref BRAWCAP_STATUS_ERROR_OVERRUN is returned.
1374 *
1375 * @return
1376 * Status | Description
1377 * ---------------------------------------------- | -----------------------------------------------------------
1378 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1379 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1380 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1381 * @ref BRAWCAP_STATUS_ERROR_OVERRUN | Given buffer length was to short.
1382 */
1384brawcap_adapter_description_by_handle(brawcap_handle_t* const pHandle, char* const description, UINT32* const pLength);
1385
1386/**
1387 * @brief Reads out the currently set IPv4 address of the specified adapter.
1388 *
1389 * @param[in] name Name of the adapter.
1390 *
1391 * @param[out] pIpv4 Will contain the currently set IPv4 address, afterwards.
1392 *
1393 * @return
1394 * Status | Description
1395 * ---------------------------------------------- | -----------------------------------------------------------
1396 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1397 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1398 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1399 * @ref BRAWCAP_STATUS_ERROR_NOT_FOUND | Adapter name not found/not available.
1400 */
1403
1404/**
1405 * @brief Reads out the currently set IPv4 address of the specified adapter.
1406 *
1407 * @param[in] pHandle The bRAWcap handle to read from.
1408 *
1409 * @param[out] pIpv4 Will contain the currently set IPv4 address, afterwards.
1410 *
1411 * @return
1412 * Status | Description
1413 * ---------------------------------------------- | -----------------------------------------------------------
1414 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1415 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1416 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1417 */
1420
1421/**
1422 * @brief Reads out the currently set IPv6 address of the specified adapter.
1423 *
1424 * @param[in] name Name of the adapter.
1425 *
1426 * @param[out] pIpv6 Will contain the currently set IPv6 address, afterwards.
1427 *
1428 * @return
1429 * Status | Description
1430 * ---------------------------------------------- | -----------------------------------------------------------
1431 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1432 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1433 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1434 * @ref BRAWCAP_STATUS_ERROR_NOT_FOUND | Adapter name not found/not available.
1435 */
1438
1439/**
1440 * @brief Reads out the currently set IPv6 address of the specified adapter.
1441 *
1442 * @param[in] pHandle The bRAWcap handle to read from.
1443 *
1444 * @param[out] pIpv6 Will contain the currently set IPv6 address, afterwards.
1445 *
1446 * @return
1447 * Status | Description
1448 * ---------------------------------------------- | -----------------------------------------------------------
1449 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1450 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1451 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1452 */
1455
1456/**
1457 * @brief Reads out the MAC address of the specified adapter.
1458 *
1459 * @param[in] name Name of the adapter.
1460 *
1461 * @param[out] mac Will contain the MAC address, afterwards.
1462 *
1463 * @return
1464 * Status | Description
1465 * ---------------------------------------------- | -----------------------------------------------------------
1466 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1467 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1468 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1469 * @ref BRAWCAP_STATUS_ERROR_NOT_FOUND | Adapter name not found/not available.
1470 */
1473
1474/**
1475 * @brief Reads out the MAC address of the specified adapter.
1476 *
1477 * @param[in] pHandle The bRAWcap handle to read from.
1478 *
1479 * @param[out] mac Will contain the MAC address, afterwards.
1480 *
1481 * @return
1482 * Status | Description
1483 * ---------------------------------------------- | -----------------------------------------------------------
1484 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1485 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1486 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1487 */
1490
1491/**
1492 * @brief Reads out the current receive speed of the specified adapter.
1493 *
1494 * @param[in] name Name of the adapter.
1495 *
1496 * @param[out] pSpeed Will contain the current receive speed, afterwards.
1497 *
1498 * @return
1499 * Status | Description
1500 * ---------------------------------------------- | -----------------------------------------------------------
1501 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1502 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1503 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1504 * @ref BRAWCAP_STATUS_ERROR_NOT_FOUND | Adapter name not found/not available.
1505 */
1508
1509/**
1510 * @brief Reads out the current receive speed of the specified adapter.
1511 *
1512 * @param[in] pHandle The bRAWcap handle to read from.
1513 *
1514 * @param[out] pSpeed Will contain the current receive speed, afterwards.
1515 *
1516 * @return
1517 * Status | Description
1518 * ---------------------------------------------- | -----------------------------------------------------------
1519 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1520 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1521 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1522 */
1525
1526/**
1527 * @brief Reads out the current transmit speed of the specified adapter.
1528 *
1529 * @param[in] name Name of the adapter.
1530 *
1531 * @param[out] pSpeed Will contain the current transmit speed, afterwards.
1532 *
1533 * @return
1534 * Status | Description
1535 * ---------------------------------------------- | -----------------------------------------------------------
1536 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1537 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1538 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1539 * @ref BRAWCAP_STATUS_ERROR_NOT_FOUND | Adapter name not found/not available.
1540 */
1543
1544/**
1545 * @brief Reads out the current transmit speed of the specified adapter.
1546 *
1547 * @param[in] pHandle The bRAWcap handle to read from.
1548 *
1549 * @param[out] pSpeed Will contain the current transmit speed, afterwards.
1550 *
1551 * @return
1552 * Status | Description
1553 * ---------------------------------------------- | -----------------------------------------------------------
1554 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1555 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1556 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1557 */
1560
1561/**
1562 * @brief Reads out the current connection state of the specified adapter.
1563 *
1564 * @param[in] name Name of the adapter.
1565 *
1566 * @param[out] pConnection Will contain the current connection state, afterwards.
1567 *
1568 * @return
1569 * Status | Description
1570 * ---------------------------------------------- | -----------------------------------------------------------
1571 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1572 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1573 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1574 * @ref BRAWCAP_STATUS_ERROR_NOT_FOUND | Adapter name not found/not available.
1575 */
1578
1579/**
1580 * @brief Reads out the current connection state of the specified adapter.
1581 *
1582 * @param[in] pHandle The bRAWcap handle to read from.
1583 *
1584 * @param[out] pConnection Will contain the current connection state, afterwards.
1585 *
1586 * @return
1587 * Status | Description
1588 * ---------------------------------------------- | -----------------------------------------------------------
1589 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1590 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1591 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1592 */
1595 brawcap_adapter_connection_state_t* const pConnection);
1596
1597/**
1598 * @brief Reads out the current operation state of the specified adapter.
1599 *
1600 * @param[in] name Name of the adapter.
1601 *
1602 * @param[out] pOperation Will contain the current operation state, afterwards.
1603 *
1604 * @return
1605 * Status | Description
1606 * ---------------------------------------------- | -----------------------------------------------------------
1607 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1608 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1609 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1610 * @ref BRAWCAP_STATUS_ERROR_NOT_FOUND | Adapter name not found/not available.
1611 */
1614
1615/**
1616 * @brief Reads out the current operation state of the specified adapter.
1617 *
1618 * @param[in] pHandle The bRAWcap handle to read from.
1619 *
1620 * @param[out] pOperation Will contain the current operation state, afterwards.
1621 *
1622 * @return
1623 * Status | Description
1624 * ---------------------------------------------- | -----------------------------------------------------------
1625 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1626 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1627 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1628 */
1631 brawcap_adapter_operation_state_t* const pOperation);
1632
1633/**
1634 * @brief Reads out the configured MTU of the specified adapter.
1635 *
1636 * @param[in] name Name of the adapter.
1637 *
1638 * @param[out] pMtu Will contain the configured MTU, afterwards.
1639 *
1640 * @return
1641 * Status | Description
1642 * ---------------------------------------------- | -----------------------------------------------------------
1643 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1644 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1645 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1646 * @ref BRAWCAP_STATUS_ERROR_NOT_FOUND | Adapter name not found/not available.
1647 */
1650
1651/**
1652 * @brief Reads out the configured MTU of the specified adapter.
1653 *
1654 * @param[in] pHandle The bRAWcap handle to read from.
1655 *
1656 * @param[out] pMtu Will contain the configured MTU, afterwards.
1657 *
1658 * @return
1659 * Status | Description
1660 * ---------------------------------------------- | -----------------------------------------------------------
1661 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1662 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1663 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1664 */
1667
1668/**@}*/
1669#endif
1670
1671/************************************************ RECEIVE ************************************************************/
1672#if 1
1673/**
1674 * @addtogroup brawcap_receive
1675 * @{
1676 */
1677
1678/********************************************** RECEIVE FILTER *******************************************************/
1679#if 1
1680/**
1681 * @addtogroup brawcap_filter
1682 * @{
1683 */
1684
1685/**
1686 * @brief Creates a new filter.
1687 *
1688 * The created filter can be used for filtering received packets by applying it to a bRAWcap handle with
1689 * @ref brawcap_rx_filter_set.
1690 *
1691 * If a created filter is not required anymore it should be freed with @ref brawcap_filter_free.
1692 *
1693 * @note Currently only the @ref BRAWCAP_FILTER_TYPE_BYTE_MASK filter type is supported.
1694 * Support for @ref BRAWCAP_FILTER_TYPE_BPF may be added later on.
1695 *
1696 * @param[in] pFilter Will contain the new created filter.
1697 *
1698 * @param[in] type Specifies the type of the created filter.
1699 *
1700 * @return
1701 * Status | Description
1702 * ---------------------------------------------- | ------------------------------------------------------------------
1703 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1704 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
1705 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Specified filter type is not supported.
1706 * @ref BRAWCAP_STATUS_ERROR_FAILED | System error occurred (e.g. out of memory).
1707 */
1710
1711/**
1712 * @brief Frees the specified filter.
1713 * When this function is called the given filter becomes invalid and it´s memory will be released.
1714 *
1715 * @warning Freeing a filter is not thread safe and the user is responsible for synchronization.
1716 *
1717 * @param[in] pFilter The filter to be freed.
1718 *
1719 * @return
1720 * Status | Description
1721 * ---------------------------------------------- | ------------------------------------------------------------------
1722 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1723 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
1724 */
1727
1728/**
1729 * @brief Reads out the type for the specified filter.
1730 *
1731 * @param[in] pFilter The filter to read from.
1732 *
1733 * @param[out] pType Will contain the filter type, afterwards.
1734 *
1735 * @return
1736 * Status | Description
1737 * ---------------------------------------------- | ------------------------------------------------------------------
1738 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1739 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
1740 */
1743
1744/**
1745 * @brief Sets the filter parameters for the specified filter.
1746 *
1747 * @note Changes will only effect after applying the modified filter to a handle with @ref brawcap_rx_filter_set.
1748 *
1749 * @param[in] pFilter The filter to be modified.
1750 *
1751 * @param[in] offset Byte offset of the filter.
1752 * This value specifies at which packet byte offset the first filter byte shall be applied.
1753 *
1754 * @param[in] length Byte length of the filter.
1755 * Specifies the number of bytes used by the filter.
1756 * This value is limited to @ref BRAWCAP_FILTER_BYTE_MAX_LENGTH.
1757 *
1758 * @param[in] mask The byte mask for the filter.
1759 * This is a fixed size byte array.
1760 * Set the byte values to the filter you want to apply.
1761 * Only bytes up to the specified filter length are used and following bytes will be ignored.
1762 *
1763 * @par Byte order
1764 * The mask ALWAYS represents on-the-wire values in network byte order (big endian), independent of the
1765 * host platform endianness. The library/driver does NOT perform any host-to-network conversion for you.
1766 * You must pre‑encode any multi-byte protocol fields (e.g. Ethertype, IP addresses, ports) into big-endian form
1767 * before passing them here. Single-byte fields can be copied directly.
1768 *
1769 * @attention The mask is always interpreted in network-order (big endian). Supplying host-endian encoded
1770 * multi-byte values on a little-endian host will result in the filter not matching.
1771 *
1772 * @par Ignore bits
1773 * The @p ignoreBits array uses per-bit flags (1 = ignore / wildcard that bit, 0 = compare) aligned
1774 * to the corresponding byte in @p mask. Ignoring an entire byte can be achieved by setting its
1775 * ignoreBits value to 0xFF.
1776 *
1777 * @par Example
1778 * Match TCP destination port 443 (0x01BB) at offset 36 in an Ethernet II + IPv4 (no options) packet
1779 * (Ethernet header 14 bytes + IP header 20 bytes + TCP dest port is bytes 2-3 of TCP header => offset 14+20+2 = 36):
1780 * @code{.c}
1781 * brawcap_filter_mask_array_t mask = {0};
1782 * brawcap_filter_ignore_bits_array_t ignoreBits = {0};
1783 * // Encode 0x01BB in big endian
1784 * mask[36] = 0x01; // high byte
1785 * mask[37] = 0xBB; // low byte
1786 * // No bits ignored -> ignoreBits[36] = ignoreBits[37] = 0;
1787 * brawcap_filter_mask_set(filter, 36, 2, mask, ignoreBits);
1788 * @endcode
1789 * If VLAN tagging (802.1Q) is enabled and the VLAN header is present on the wire, remember that all subsequent
1790 * offsets shift by 4 bytes; you must account for this when computing @p offset.
1791 *
1792 * @param[in] ignoreBits A fixed size bitfield byte array.
1793 * The bytes in this array has to be interpreted/used as bitfields.
1794 * This allows to select if a single bit at the corresponding mask position shall be ignored.
1795 * To ignore the value of a bit set it´s value to 1.
1796 * Like the mask, only bytes up to the specified filter length are used and following bytes will be ignored.
1797 *
1798 * @return
1799 * Status | Description
1800 * ---------------------------------------------- | ------------------------------------------------------------------
1801 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1802 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
1803 * @ref BRAWCAP_STATUS_ERROR_INVALID_PARAM | Specified filter is not of type @ref BRAWCAP_FILTER_TYPE_BYTE_MASK.
1804 * @ref BRAWCAP_STATUS_ERROR_PARAM_OUT_OF_RANGE | Specified offset+length exceeds @ref BRAWCAP_FILTER_BYTE_MAX_LENGTH.
1805 */
1809 const brawcap_filter_ignore_bits_array_t ignoreBits);
1810
1811/**
1812 * @brief Reads out the filter mask parameters for the specified filter.
1813 *
1814 * @param[in] pFilter The filter to read from.
1815 *
1816 * @param[out] pOffset Will contain the filter byte offset, afterwards.
1817 *
1818 * @param[out] pLength Will contain the filter byte length, afterwards.
1819 *
1820 * @param[out] pMask Will contain the filter mask bytes, afterwards.
1821 *
1822 * @par Byte order
1823 * Returned mask bytes are in network byte order (big endian) exactly as stored internally / originally supplied.
1824 * If you need to interpret multi-byte fields as host-endian integers, perform the appropriate conversion
1825 * (e.g. (mask[i] << 8) | mask[i+1] for 16-bit values).
1826 *
1827 * @attention The mask is always interpreted in network-order (big endian) when applying the filter during packet
1828 * comparison.
1829 *
1830 * @param[out] pIgnoreBits Will contain the filter bits to ignore, afterwards
1831 *
1832 * @return
1833 * Status | Description
1834 * ---------------------------------------------- | ------------------------------------------------------------------
1835 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1836 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
1837 * @ref BRAWCAP_STATUS_ERROR_INVALID_PARAM | Specified filter is not of type @ref BRAWCAP_FILTER_TYPE_BYTE_MASK.
1838 */
1841 brawcap_filter_byte_length_t* const pLength, brawcap_filter_mask_array_t* const pMask,
1842 brawcap_filter_ignore_bits_array_t* const pIgnoreBits);
1843
1844
1845/**
1846 * @brief Sets the BPF filter string for the specified filter.
1847 *
1848 * @param[in] pFilter The filter to be modified.
1849 *
1850 * @param[in] filterString The BPF filter string to set.
1851 *
1852 * @return
1853 * Status | Description
1854 * ---------------------------------------------- | ------------------------------------------------------------------
1855 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1856 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
1857 * @ref BRAWCAP_STATUS_ERROR_INVALID_PARAM | Specified filter is not of type @ref BRAWCAP_FILTER_TYPE_BPF.
1858 * @ref BRAWCAP_STATUS_ERROR_BPF_COMPILE_FAILED | BPF filter compilation failed.
1859 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | libpcap not available/found.
1860 */
1862brawcap_filter_bpf_set(brawcap_filter_t* const pFilter, const char* const filterString);
1863
1864/**
1865 * @brief Reads the BPF filter string from the specified filter.
1866 *
1867 * @param[in] pFilter The filter to read from.
1868 *
1869 * @param[out] filterString Buffer for the BPF filter string.
1870 *
1871 * @param[inout] pLength Length of the provided buffer for the BPF filter string.
1872 * If the provided buffer is too small, it will contain the required length, afterwards
1873 * and @ref BRAWCAP_STATUS_ERROR_OVERRUN will be returned.
1874 *
1875 * @return
1876 * Status | Description
1877 * ---------------------------------------------- | ------------------------------------------------------------------
1878 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1879 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
1880 * @ref BRAWCAP_STATUS_ERROR_INVALID_PARAM | Specified filter is not of type @ref BRAWCAP_FILTER_TYPE_BPF or current filter string is empty / not set.
1881 * @ref BRAWCAP_STATUS_ERROR_OVERRUN | BPF filter string is too long.
1882 */
1884brawcap_filter_bpf_get(brawcap_filter_t* const pFilter, char* filterString, UINT* const pLength);
1885
1886
1887/**
1888 * @brief Retrieves the BPF compile error message from the specified filter.
1889 *
1890 * @attention pError is only valid as long as the filter is not freed (by @ref brawcap_filter_free).
1891 *
1892 * @param[in] pFilter The filter to read from.
1893 *
1894 * @param[out] pError Will contain the BPF compile error message, afterwards.
1895 *
1896 * @return
1897 * Status | Description
1898 * ---------------------------------------------- | ------------------------------------------------------------------
1899 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1900 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
1901 * @ref BRAWCAP_STATUS_ERROR_INVALID_PARAM | Specified filter is not of type @ref BRAWCAP_FILTER_TYPE_BPF or current filter string is empty / not set.
1902 */
1904brawcap_filter_bpf_compile_error_get(brawcap_filter_t* const pFilter, const char* pError);
1905
1906/**
1907 * @brief Sets the specified filter to active.
1908 *
1909 * @note Changes will only effect after applying the modified filter to a handle with @ref brawcap_rx_filter_set.
1910 *
1911 * @param[in] pFilter The filter to be modified.
1912 *
1913 * @return
1914 * Status | Description
1915 * ---------------------------------------------- | ------------------------------------------------------------------
1916 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1917 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
1918 */
1921
1922/**
1923 * @brief Sets the specified filter to inactive.
1924 *
1925 * @note Changes will only effect after applying the modified filter to a handle with @ref brawcap_rx_filter_set.
1926 *
1927 * @param[in] pFilter The filter to be modified.
1928 *
1929 * @return
1930 * Status | Description
1931 * ---------------------------------------------- | ------------------------------------------------------------------
1932 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1933 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
1934 */
1937
1938/**
1939 * @brief Reads out the current activation state of the specified filter.
1940 *
1941 * @param[in] pFilter The filter to read from.
1942 *
1943 * @param[out] pActive Will contain the activation state, afterwards.
1944 *
1945 * @return
1946 * Status | Description
1947 * ---------------------------------------------- | ------------------------------------------------------------------
1948 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1949 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
1950 */
1952brawcap_filter_is_activated(brawcap_filter_t* const pFilter, BOOLEAN* const pActive);
1953
1954/**
1955 * @brief Sets the bytes to capture of the specified filter.
1956 *
1957 * @note Changes will only effect after applying the modified filter to a handle with @ref brawcap_rx_filter_set.
1958 *
1959 * @param[in] pFilter The filter to be modified.
1960 *
1961 * @param[in] offset The byte offset, from packet payload beginning, to begin capturing the payload bytes.
1962 *
1963 * @param[in] length The number of bytes to be captured - beginning at offset.
1964 *
1965 * @return
1966 * Status | Description
1967 * ---------------------------------------------- | ------------------------------------------------------------------
1968 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1969 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
1970 * @ref BRAWCAP_STATUS_ERROR_PARAM_OUT_OF_RANGE | Specified offset+length exceeds @ref BRAWCAP_PACKET_SIZE_MAX.
1971 */
1974 const brawcap_packet_size_t length);
1975
1976/**
1977 * @brief Reads out the configured bytes to capture of the specified filter.
1978 *
1979 * @param[in] pFilter The filter to read from.
1980 *
1981 * @param[out] pOffset Will contain the byte offset of the bytes to capture, afterwards.
1982 *
1983 * @param[out] pLength Will contain the number of bytes to capture, afterwards.
1984 *
1985 * @return
1986 * Status | Description
1987 * ---------------------------------------------- | ------------------------------------------------------------------
1988 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1989 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
1990 */
1993 brawcap_packet_size_t* const pLength);
1994
1995/**
1996 * @brief Specifies if packets which matched the specified filter should be indicated to the network stack.
1997 *
1998 * @note Changes will only effect after applying the modified filter to a handle with @ref brawcap_rx_filter_set.
1999 *
2000 * @param[in] pFilter The filter to be modified.
2001 *
2002 * @param[in] indicate Flag specifying the network stack indication.
2003 * If true filtered packets are forwarded to the network stack.
2004 * If false filtered packets are not forwarded to the network stack, they are only visible for bRAWcap handles.
2005 *
2006 * @return
2007 * Status | Description
2008 * ---------------------------------------------- | ------------------------------------------------------------------
2009 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2010 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
2011 */
2013brawcap_filter_indicate_set(brawcap_filter_t* const pFilter, const BOOLEAN indicate);
2014
2015/**
2016 * @brief Reads out the current network stack indication state of the specified filter.
2017 *
2018 * @param[in] pFilter The filter to read from.
2019 *
2020 * @param[out] pIndicate Will contain the current network stack indication, afterwards.
2021 *
2022 * @return
2023 * Status | Description
2024 * ---------------------------------------------- | ------------------------------------------------------------------
2025 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2026 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
2027 */
2029brawcap_filter_indicate_get(brawcap_filter_t* const pFilter, BOOLEAN* const pIndicate);
2030
2031/**@}*/
2032#endif
2033
2034/**
2035 * @brief Receives a single packet from the specified handle.
2036 *
2037 * The caller must provide a valid packet were bRAWcap will store the received data.
2038 * To create a packet use @ref brawcap_packet_create or use a buffered packet which was returned by a
2039 * valid buffer with @ref brawcap_buffer_at_index.
2040 *
2041 * @note Parallel receives per handle are not allowed. This means that if there is any other receive pending on the
2042 * handle each further initiated receive will fail until the pending operation has finished.
2043 *
2044 * @param[in] pHandle bRAWcap handle to receive from.
2045 *
2046 * @param[out] pPacket Packet were the received data will be stored.
2047 *
2048 * @return
2049 * Status | Description
2050 * ---------------------------------------------- | -----------------------------------------------------------
2051 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2052 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2053 * @ref BRAWCAP_STATUS_WARNING_PENDING | Another receive is still pending/active.
2054 * @ref BRAWCAP_STATUS_ERROR_DRIVER_NOT_AVAILABLE | bRAWcap driver is not active (anymore) on the adapter.
2055 * @ref BRAWCAP_STATUS_WARNING_DEMO_MODE | Running in demo mode (no license).
2056 * @ref BRAWCAP_STATUS_ERROR_DRIVER_IO_FAILED | Communicating with bRAWcap driver failed.
2057 * @ref BRAWCAP_STATUS_INFO_NO_DATA | Returned without any data received (due to timeout).
2058 */
2061
2062/**
2063 * @brief Starts the internal receive loop.
2064 *
2065 * To receive data using this method it is necessary to attach memory to the
2066 * bRAWcap handle were received data can be stored. This can be done by attaching (with @ref brawcap_rx_buffer_attach)
2067 * a previously created bRAWcap packet buffer (with @ref brawcap_buffer_create).
2068 *
2069 * When a reception has finished (due to timeout, min packets or full buffer) the receive callback will be called
2070 * for this handle (@ref brawcap_rx_callback_t). In this callback the user application can do it´s post
2071 * processing on the received data. If the user application does not detach the buffer
2072 * (with @ref brawcap_rx_buffer_detach) it will be reused for receiving after callback has completed.
2073 *
2074 * The user application should do it´s post processing anyway, as fast as possible. Depending on the current
2075 * bandwidth the attached buffers may be filled up very fast. If the user application takes to long it
2076 * will lead to a bottleneck in the reception and the driver runs out of resources. This may result in performance
2077 * degradation or packet loss.
2078 *
2079 * It is possible to attach more than only one buffer to a single handle. This ensures that the bRAWcap driver can
2080 * toggle the buffers during the reception. This reduces the time gap the driver has to buffer data internally (because
2081 * there is no user buffer available). With more than one buffer the driver can still fill up another buffer while the
2082 * user application does it´s post processing. Therefore in general, using more than one buffer increases the
2083 * performance.
2084 *
2085 * @note Due to the focus on optimized throughput with minimal CPU load bRAWcap does not fill up the packets in the
2086 * buffer with the same sequence they were received by the adapter.
2087 * Here we want to give some additional information on the topic of "packet sequence/timestamp":
2088 * - First of all it should be known that the receive sequence may not be equal to the sending sequence.
2089 * Due to several senders or some network managers in between (switches and so on...).
2090 * For any protocols which require a ordered packet stream, there will be at least one field in the packet
2091 * payload which allows to sort the packets on the receiver side.
2092 * This is a "higher" layer topic and not part of bRAWcap.
2093 * - With the bRAWcap supported timestamp mechanisms it is possible to sort the received packets corresponding to
2094 * their receive timestamps. But keep in mind that only the @ref BRAWCAP_TIMESTAMP_MODE_ADAPTER_HARDWARE guarantees
2095 * that the receive timestamps really match the received packet sequence on the adapter. To use the named timestamp
2096 * mechanism, the underlying network adapter must support it. Any other timestamp is generated by software. Windows
2097 * is not a realtime operation system, and therefore due to multithreading, scheduling (...) it could happen
2098 * that some packets are processed before other packets which was received earlier.
2099 * Especially the Windows network stack feature called "receive side scaling" can also increase the issue
2100 * of incorrect packet sequences.
2101 *
2102 * @invariant The user parameter allows access to user defined context.
2103 * The given pointer is not used and validated by bRAWcap. Therefore the user is responsible for validating
2104 * the context in the callback before accessing it.
2105 *
2106 * @attention After starting receive @ref brawcap_rx_packet can not be used until you stop the receive
2107 * with @ref brawcap_rx_stop, because parallel receives are not allowed.
2108 *
2109 * @param[in] pHandle bRAWcap handle to receive from.
2110 *
2111 * @param[in] callback Function pointer to user application receive callback.
2112 *
2113 * @param[in] pUser Pointer to a user defined context. Can be NULL if no user context is required.
2114 *
2115 * @param[in] indicateNoPackets Specifies if callback is called even without any received data.
2116 *
2117 * @return
2118 * Status | Description
2119 * ---------------------------------------------- | -----------------------------------------------------------
2120 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2121 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2122 * @ref BRAWCAP_STATUS_WARNING_PENDING | Another receive is pending or reception is already started.
2123 */
2125brawcap_rx_start(brawcap_handle_t* const pHandle, brawcap_rx_callback_t const callback, void* const pUser,
2126 const BOOLEAN indicateNoPackets);
2127
2128/**
2129 * @brief Stops the internal receive loop.
2130 *
2131 * @param[in] pHandle bRAWcap handle to stop reception.
2132 *
2133 * @return
2134 * Status | Description
2135 * ---------------------------------------------- | -----------------------------------------------------------
2136 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2137 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2138 * @ref BRAWCAP_STATUS_INFO_NOT_RUNNING | There was no receive running.
2139 */
2142
2143/**
2144 * @brief Attaches the specified bRAWcap packet buffer to the specified handle.
2145 *
2146 * After attaching a packet buffer to a handle it will be used for receiving data on that handle.
2147 * Data is only received if the internal receive loop was started/is running (with @ref brawcap_rx_start).
2148 *
2149 * The buffer is locked until:
2150 * - It is detached from the handle with @ref brawcap_rx_buffer_detach.
2151 * - A receive has finished and the receive callback is called (buffer is not locked during callback execution).
2152 *
2153 * @note A buffer can be attached only once and is than locked down by the handle it is attached to.
2154 * This means that it has to be detached before it can be used again for another handle.
2155 *
2156 * @param[in] pHandle bRAWcap handle for attaching the buffer.
2157 *
2158 * @param[in] pBuffer Packet buffer to be attached.
2159 *
2160 * @return
2161 * Status | Description
2162 * ---------------------------------------------- | -----------------------------------------------------------
2163 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2164 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2165 * @ref BRAWCAP_STATUS_ERROR_IN_USE | The buffer is already in use / locked down by another operation.
2166 * @ref BRAWCAP_STATUS_WARNING_LIMIT_REACHED | Limitation of buffer per handle reached (@ref BRAWCAP_RX_BUFFERS_PER_HANDLE_MAX)
2167 */
2170
2171/**
2172 * @brief Detaches the specified bRAWcap packet buffer from the specified handle.
2173 *
2174 * After detaching a buffer it is unlocked and can be accessed/modified.
2175 * It can also be reused for another operation or freed with @ref brawcap_buffer_free if it is not required anymore.
2176 *
2177 * @param[in] pHandle bRAWcap handle from which the buffer is to be detached.
2178 *
2179 * @param[in] pBuffer Packet buffer to be detached.
2180 *
2181 * @return
2182 * Status | Description
2183 * ---------------------------------------------- | -----------------------------------------------------------
2184 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2185 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2186 * @ref BRAWCAP_STATUS_INFO_NOT_ATTACHED | The buffer was not attached.
2187 */
2190
2191/**
2192 * @brief Sets the receive direction for the specified handle.
2193 *
2194 * Possible directions are:
2195 * - @ref BRAWCAP_RX_DIRECTION_UNKNOWN
2196 * - @ref BRAWCAP_RX_DIRECTION_IN
2197 * - @ref BRAWCAP_RX_DIRECTION_OUT
2198 * - @ref BRAWCAP_RX_DIRECTION_BOTH
2199 *
2200 * @param[in] pHandle bRAWcap handle to be configured.
2201 *
2202 * @param[in] direction The direction to be set.
2203 *
2204 * @return
2205 * Status | Description
2206 * ---------------------------------------------- | -----------------------------------------------------------
2207 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2208 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2209 * @ref BRAWCAP_STATUS_ERROR_DRIVER_IO_FAILED | Communicating with bRAWcap driver failed.
2210 */
2213
2214/**
2215 * @brief Reads out the currently configured receive direction of the specified handle.
2216 *
2217 * @param[in] pHandle bRAWcap handle to read from.
2218 *
2219 * @param[out] pDirection Will contain the currently configured receive direction, afterwards.
2220 *
2221 * @return
2222 * Status | Description
2223 * ---------------------------------------------- | -----------------------------------------------------------
2224 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2225 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2226 */
2229
2230/**
2231 * @brief Sets the minimum amount of packets to receive for the specified handle.
2232 *
2233 * This value influences how often the bRAWcap driver will return pending receives.
2234 * It forces the driver to stay in the request as long as not the minimum amount of packets were captured.
2235 * Setting a higher value here can reduce the overall system load but increases also the responsiveness/latency
2236 * when the packet was received by the adapter and the indication of the packet to the caller.
2237 * The initial/default value is set to @ref BRAWCAP_RX_COPY_PACKETS_DEFAULT.
2238 *
2239 * @invariant If high receive rates should be reached (and many packets coming in), a high value is preferred.
2240 * Otherwise if low latency is required the best effort would be to set this value to zero.
2241 *
2242 * @note Independent from this value the receive will at least return if it pends for 10 times the configured
2243 * receive timeout. This avoid infinite blocking (infinite blocking is only the possible if the receive timeout is zero).
2244 * If this value is set to zero it will always return after the first receive timeout.
2245 * And if the given buffer becomes filled up before the timeout is reached it will return when the buffer is full.
2246 *
2247 * @param[in] pHandle bRAWcap handle to be configured.
2248 *
2249 * @param[in] minPackets The minimum amount of packets to receive.
2250 *
2251 * @return
2252 * Status | Description
2253 * ---------------------------------------------- | -----------------------------------------------------------
2254 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2255 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2256 * @ref BRAWCAP_STATUS_ERROR_DRIVER_IO_FAILED | Communicating with bRAWcap driver failed.
2257 */
2260
2261/**
2262 * @brief Reads out the currently configured number of packets to receive for the specified handle.
2263 *
2264 * @param[in] pHandle bRAWcap handle to read from.
2265 *
2266 * @param[out] pMinPackets Will contain the configured minimum amount of packets per receive, afterwards.
2267 *
2268 * @return
2269 * Status | Description
2270 * ---------------------------------------------- | -----------------------------------------------------------
2271 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2272 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2273 */
2276
2277/**
2278 * @brief Configures the receive timeout for the specified handle.
2279 *
2280 * It´s guaranteed that receive functions will return at least after the specified timeout value,
2281 * if the configured amount of packets value @ref brawcap_rx_min_packets_t is reached before.
2282 * If the configured amount of packets are not reached until the timeout occurs, the driver will stay in the request
2283 * for up to 10 times of the specified timeout time until it final returns.
2284 * It is also possible to specify a timeout of zero. A timeout of zero is equivalent to "no timeout".
2285 *
2286 * @note Default timeout value is @ref BRAWCAP_RX_TIMEOUT_MS_DEFAULT.
2287 * And the max supported timeout is @ref BRAWCAP_RX_TIMEOUT_MS_MAX.
2288 *
2289 * @attention Be careful in using infinite timeouts.
2290 * It could lead to a endless blocking behaviour.
2291 * For example if there are no packets received which meet your configured filter on the underlying adapter.
2292 *
2293 * @param[in] pHandle bRAWcap handle to be configured.
2294 *
2295 * @param[in] timeout_ms Receive timeout in milliseconds to be set.
2296 *
2297 * @return
2298 * Status | Description
2299 * ---------------------------------------------- | -----------------------------------------------------------
2300 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2301 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2302 * @ref BRAWCAP_STATUS_ERROR_PARAM_OUT_OF_RANGE | The specified timeout value is invalid/out of range.
2303 * @ref BRAWCAP_STATUS_ERROR_DRIVER_IO_FAILED | Communicating with bRAWcap driver failed.
2304 */
2307
2308/**
2309 * @brief Reads out the currently configured receive timeout for the specified handle
2310 *
2311 * @param[in] pHandle bRAWcap handle to read from.
2312 *
2313 * @param[out] pTimeout_ms Will contain the configured receive timeout in milliseconds, afterwards.
2314 *
2315 * @return
2316 * Status | Description
2317 * ---------------------------------------------- | -----------------------------------------------------------
2318 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2319 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2320 */
2323
2324/**
2325 * @brief Sets the specified filter to the specified handle.
2326 *
2327 * For more information on filters see @ref brawcap_filter_t.
2328 *
2329 * @note Each handle can have exactly one filter applied.
2330 * If several filters shall be applied to the same adapter,
2331 * it is required to open several bRAWcap handles to the same adapter.
2332 *
2333 * @param[in] pHandle bRAWcap handle to be modified.
2334 *
2335 * @param[in] pFilter The filter to set.
2336 *
2337 * @return
2338 * Status | Description
2339 * ---------------------------------------------- | -----------------------------------------------------------
2340 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2341 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2342 * @ref BRAWCAP_STATUS_ERROR_DRIVER_IO_FAILED | Communicating with bRAWcap driver failed.
2343 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Specified filter type is not available.
2344 */
2346brawcap_rx_filter_set(brawcap_handle_t* const pHandle, const brawcap_filter_t* const pFilter);
2347
2348/**
2349 * @brief Reads out the currently configured filter for the specified handle.
2350 *
2351 * @param[in] pHandle bRAWcap handle to read from.
2352 *
2353 * @param[out] pFilter Will contain the currently configured filter, afterwards.
2354 *
2355 * @return
2356 * Status | Description
2357 * ---------------------------------------------- | -----------------------------------------------------------
2358 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2359 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2360 */
2363
2364/**
2365 * @brief Sets the current promiscuous mode flag for the specified handle.
2366 *
2367 * If a adapter is set into promiscuous mode it receives not only packages which directly address the adapter.
2368 * This can be used for recording/sniffing purposes but increases the local system load.
2369 * Promiscuous mode is a network adapter feature and which can only be modified by bRAWcap.
2370 * Therefore it is not specific to a bRAWcap handle. Instead it is a per adapter setting which can also be
2371 * modified from another application.
2372 *
2373 * @note Promiscuous mode will be reset automatically upon deleting the corresponding handle.
2374 * Which means if it was activated due to the bRAWcap handle it will be disabled again when the handle is closed.
2375 *
2376 * @attention Because of the per adapter scope, promiscuous mode can not explicitly modified by bRAWcap.
2377 * Instead if at least one application or another bRAWcap handle activated it, it will stay enabled until the last
2378 * application/handle which has activated it, is closed or deactivates it again.
2379 *
2380 * @param[in] pHandle bRAWcap handle to be modified.
2381 *
2382 * @param[in] enable Promiscuous mode state to be set.
2383 *
2384 * @return
2385 * Status | Description
2386 * ---------------------------------------------- | -----------------------------------------------------------
2387 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2388 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2389 * @ref BRAWCAP_STATUS_ERROR_DRIVER_IO_FAILED | Communicating with bRAWcap driver failed.
2390 */
2392brawcap_rx_promiscuous_mode_set(brawcap_handle_t* const pHandle, const BOOLEAN enable);
2393
2394/**
2395 * @brief Reads out the current promiscuous mode state for the specified handle.
2396 *
2397 * Additionally to the promiscuous state of the handle itself it also reads the current promiscuous state of to the
2398 * underlying adapter.
2399 *
2400 * @param[in] pHandle bRAWcap handle to read from.
2401 *
2402 * @param[out] pEnabled Will contain the current promiscuous mode state of the handle, afterwards.
2403 *
2404 * @param[out] pEnabledAdapter Will contain the current promiscuous mode state of the underlying adapter, afterwards.
2405 *
2406 * @return
2407 * Status | Description
2408 * ---------------------------------------------- | -----------------------------------------------------------
2409 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2410 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2411 * @ref BRAWCAP_STATUS_ERROR_DRIVER_IO_FAILED | Communicating with bRAWcap driver failed.
2412 */
2414brawcap_rx_promiscuous_mode_get(brawcap_handle_t* const pHandle, BOOLEAN* const pEnabled,
2415 BOOLEAN* const pEnabledAdapter);
2416
2417/**
2418 * @brief Reads out the available receive timestamp modes for the specified handle.
2419 *
2420 * Some of the timestamp capabilites depend on the features provided by the underlying adapter.
2421 * Those modes are named with "adapter".
2422 *
2423 * @param[in] pHandle bRAWcap handle to read from.
2424 *
2425 * @param[out] pCapabilities Will contain the available receive timestamp modes, afterwards.
2426 *
2427 * @return
2428 * Status | Description
2429 * ---------------------------------------------- | -----------------------------------------------------------
2430 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2431 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2432 * @ref BRAWCAP_STATUS_ERROR_DRIVER_IO_FAILED | Communicating with bRAWcap driver failed.
2433 */
2436 brawcap_timestamp_capabilities_t* const pCapabilities);
2437
2438/**
2439 * @brief Reads out the currently configured receive time stamping mode for the specified handle.
2440 *
2441 * @param[in] pHandle bRAWcap handle to read from.
2442 *
2443 * @param[out] pMode Will contain the currently used receive time stamping mode, afterwards.
2444 *
2445 * @return
2446 * Status | Description
2447 * ---------------------------------------------- | -----------------------------------------------------------
2448 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2449 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2450 */
2453
2454/**
2455 * @brief Configures the used receive time stamping mode for the specified handle.
2456 *
2457 *
2458 * @note Only available timestamp modes are accepted. It is recommended to check if a timestamp mode is supported
2459 * before setting it. To check if a timestamp mode is available use @ref brawcap_rx_timestamp_capabilities.
2460 *
2461 * @param[in] pHandle bRAWcap handle to be configured.
2462 *
2463 * @param[out] mode The receive timestamp mode to be configured.
2464 *
2465 * @return
2466 * Status | Description
2467 * ---------------------------------------------- | -----------------------------------------------------------
2468 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2469 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2470 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Specified timestamp mode not available.
2471 * @ref BRAWCAP_STATUS_ERROR_DRIVER_IO_FAILED | Communicating with bRAWcap driver failed.
2472 */
2475
2476/**
2477 * @brief Sets the current VLAN tagging flag for the specified handle.
2478 *
2479 * If VLAN tagging is enabled, the VLAN Header (defined by IEEE 802.1Q) will be part of the packet payload.
2480 * By default, the VLAN header is not included in the packet payload.
2481 *
2482 * @param[in] pHandle bRAWcap handle to be configured.
2483 *
2484 * @param[in] enable VLAN tagging state to be set.
2485 *
2486 * @return
2487 * Status | Description
2488 * ---------------------------------------------- | -----------------------------------------------------------
2489 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2490 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2491 * @ref BRAWCAP_STATUS_ERROR_DRIVER_IO_FAILED | Communicating with bRAWcap driver failed.
2492 */
2494brawcap_rx_vlan_tagging_set(brawcap_handle_t* const pHandle, const BOOLEAN enable);
2495
2496/**
2497 * @brief Reads out the configured VLAN tagging state for the specified handle.
2498 *
2499 * @param[in] pHandle bRAWcap handle to read from.
2500 *
2501 * @param[out] pEnabled Will contain the currently configured VLAN tagging state, afterwards.
2502 *
2503 * @return
2504 * Status | Description
2505 * ---------------------------------------------- | -----------------------------------------------------------
2506 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2507 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2508 */
2510brawcap_rx_vlan_tagging_get(brawcap_handle_t* const pHandle, BOOLEAN* const pEnabled);
2511
2512/**
2513 * @brief Sets the driver queue size (in number of packets) for the specified handle.
2514 *
2515 * A larger driver queue can avoid packet drops for time gaps were no packet buffer is available.
2516 * But setting large driver queues should only be done if really necessary, because it can consume a lot of memory.
2517 * Because driver queues exist per handle, the total amount of consumed memory has to summed up for all open handles
2518 * and their current configuration.
2519 *
2520 * The driver queue size can be adjusted at any time.
2521 *
2522 * @note The default queue size is @see BRAWCAP_RX_DRIVER_QUEUE_SIZE_DEFAULT (in number of packets).
2523 * And its max limitation is @see BRAWCAP_RX_DRIVER_QUEUE_SIZE_MAX (in number of packets).
2524 *
2525 * @attention Reducing the queue size during runtime may result in packet loss.
2526 * This may be the case if there are more packets stored in the queue than the new size can accommodate.
2527 *
2528 * @param[in] pHandle bRAWcap handle to be configured.
2529 *
2530 * @param[in] size Driver receive queue size to be set.
2531 *
2532 * @return
2533 * Status | Description
2534 * ---------------------------------------------- | -----------------------------------------------------------
2535 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2536 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2537 * @ref BRAWCAP_STATUS_ERROR_PARAM_OUT_OF_RANGE | Specified queue size is out of range/invalid.
2538 * @ref BRAWCAP_STATUS_ERROR_DRIVER_IO_FAILED | Communicating with bRAWcap driver failed.
2539 */
2542
2543/**
2544 * @brief Reads out the currently configured driver receive queue size for the specified handle.
2545 *
2546 * @param[in] pHandle bRAWcap handle to read from.
2547 *
2548 * @param[out] pSize Will contain the currently configured driver receive queue size, afterwards.
2549 *
2550 * @return
2551 * Status | Description
2552 * ---------------------------------------------- | -----------------------------------------------------------
2553 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2554 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2555 */
2558
2559/**@}*/
2560#endif
2561
2562/*********************************************** TRANSMIT ************************************************************/
2563#if 1
2564/**
2565 * @addtogroup brawcap_transmit
2566 * @{
2567 */
2568
2569/**
2570 * @brief Transmits a single packet on the specified handle.
2571 *
2572 * The caller must provide a valid packet filled up with the payload to transmit.
2573 *
2574 * For creating a packet use @ref brawcap_packet_create. After creating the packet set all the required packet fields
2575 * and than call this function to initiate a transmission.
2576 *
2577 * When transmission has finished (the function returns) the packet fields are updated.
2578 *
2579 * To check if the transmission was successful check for the function return status or the packet status itself
2580 * with @ref brawcap_packet_status_get. If the packet was transmitted and transmit time stamping was enabled the packet
2581 * timestamp will contain the transmission time, which be accessed with @ref brawcap_packet_timestamp_get.
2582 *
2583 * @param[in] pHandle bRAWcap handle to transmit on.
2584 *
2585 * @param[inout] pPacket Packet to be transmitted.
2586 *
2587 * @return
2588 * Status | Description
2589 * ---------------------------------------------- | -----------------------------------------------------------
2590 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2591 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2592 * @ref BRAWCAP_STATUS_ERROR_DRIVER_NOT_AVAILABLE | bRAWcap driver is not active (anymore) on the adapter.
2593 * @ref BRAWCAP_STATUS_WARNING_DEMO_MODE | Running in demo mode (no license).
2594 * @ref BRAWCAP_STATUS_ERROR_DRIVER_IO_FAILED | Communicating with bRAWcap driver failed.
2595 * @ref BRAWCAP_STATUS_WARNING_NOT_ALL_PROCESSED | The transmission failed (or payload was not fully transmitted).
2596 */
2599
2600/**
2601 * @brief Starts the internal transmit loop.
2602 *
2603 * Enables asynchronous / buffered transmission mode on a handle.
2604 * After the loop is started the application queues packet buffers with @ref brawcap_tx_buffer_send.
2605 * Each queued buffer is locked until it has been fully processed and the transmit callback returns.
2606 *
2607 * Usage pattern:
2608 * 1. Prepare one or more packet buffers (filled packets, optional timestamps if synchronized sending desired).
2609 * 2. Call brawcap_tx_start(handle, callback, userCtx).
2610 * 3. Push buffers via @ref brawcap_tx_buffer_send (optionally specifying synchronized transmission).
2611 * 4. In the callback, reclaim / reuse / free completed buffers.
2612 * 5. Stop transmission with @ref brawcap_tx_stop when finished.
2613 *
2614 * Constraints:
2615 * - Only one active transmit loop per handle (returns WARNING_PENDING if already running).
2616 * - While the loop is running single packet API @ref brawcap_tx_packet MUST NOT be used on the same handle.
2617 * - Callback executions are serialized per handle (never concurrent on same handle).
2618 * - The callback MUST return promptly; long blocking degrades throughput.
2619 *
2620 * Callback contract:
2621 * - Signature: brawcap_tx_callback_t(brawcap_handle_t* handle, brawcap_buffer_t* buffer, void* userCtx, brawcap_status_t status)
2622 * - status reflects completion status for the processed buffer.
2623 * - buffer is unlocked while inside the callback allowing immediate inspection / reuse.
2624 * - userCtx is the same pointer provided in @p pUser (not validated by bRAWcap).
2625 *
2626 * Thread safety: Starting/stopping is not thread-safe with itself; synchronize if multiple threads may initiate.
2627 *
2628 * @param[in] pHandle bRAWcap handle to start transmission on.
2629 * @param[in] callback User transmit completion callback (required, must not be NULL).
2630 * @param[in] pUser Opaque user context pointer passed to each callback invocation (may be NULL).
2631 *
2632 * @return
2633 * Status | Description
2634 * ---------------------------------------------- | -----------------------------------------------------------
2635 * @ref BRAWCAP_STATUS_SUCCESS | Transmit loop started.
2636 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | pHandle or callback invalid.
2637 * @ref BRAWCAP_STATUS_WARNING_PENDING | A transmit loop is already running.
2638 * @ref BRAWCAP_STATUS_ERROR_DRIVER_NOT_AVAILABLE | Driver not active on adapter.
2639 * @ref BRAWCAP_STATUS_ERROR_DRIVER_IO_FAILED | Driver communication failed.
2640 */
2642brawcap_tx_start(brawcap_handle_t* const pHandle, brawcap_tx_callback_t const callback, void* pUser);
2643
2644/**
2645 * @brief Stops the internal transmit loop.
2646 *
2647 * @param[in] pHandle bRAWcap handle to stop transmission on.
2648 *
2649 * @return
2650 * Status | Description
2651 * ---------------------------------------------- | -----------------------------------------------------------
2652 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2653 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2654 * @ref BRAWCAP_STATUS_INFO_NOT_RUNNING | There was no transmission running.
2655 */
2658
2659/**
2660 * @brief Pushes the specified buffer to the specified handle transmit queue.
2661 *
2662 * After pushing a packet buffer to the handle for transmission it is locked down by the handle until transmission
2663 * has completed (and the @ref brawcap_tx_callback_t "transmit callback" is called).
2664 *
2665 * With the synchronized flag it is possible to activate a synchronized transmission of the specified packet buffer.
2666 * This means that the driver reads the time gap between each packet in the packet buffer and waits until it has been
2667 * elapsed before initiating transmission.
2668 * Test
2669 * @attention For synchronized transmission it is necessary to sort the packets in the buffer by rising timestamp.
2670 * Furthermore, it is currently not supported to specify a "start time" when the first packet should be transmitted.
2671 * Therefore if you want to start transmission depending on the first packet timestamp you should wait until the
2672 * time is reached and after this initiate the transmission by calling this function. The driver itself only
2673 * evaluates the time gaps between each packet in the buffer.
2674 *
2675 * @note Packet buffers are transmitted in the same order they was pushed to the handle.
2676 *
2677 * @invariant Keep in mind that the packet timestamp is updated after transmission has been completed by the
2678 * transmission timestamp (depending on the configured timestamp mode). Therefore if there was a packet timestamp set
2679 * for example to send synchronized, this timestamp will be overwritten.
2680 *
2681 * @param[in] pHandle bRAWcap handle for sending the buffer.
2682 *
2683 * @param[in] pBuffer Packet buffer to be sent.
2684 *
2685 * @param[in] synchronized Flag indicating if the packets in the packet buffer should be sent synchronized.
2686 *
2687 * @return
2688 * Status | Description
2689 * ---------------------------------------------- | -----------------------------------------------------------
2690 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2691 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2692 * @ref BRAWCAP_STATUS_ERROR_IN_USE | The buffer is already in use / locked down by another operation.
2693 */
2695brawcap_tx_buffer_send(brawcap_handle_t* const pHandle, brawcap_buffer_t* const pBuffer, const BOOLEAN synchronized);
2696
2697/**
2698 * @brief Sets the driver queue size (in number of packets) for the specified handle.
2699 *
2700 * For transmission the driver queue size may be increased if high data rates should be reached (for example 10GBit/s).
2701 * With a larger transmission queue the driver can forward more packets to the network adapter at the same time.
2702 * Therefore if the transmission rate is below the expected value it may be solved by a larger driver queue size.
2703 *
2704 * The driver queue size can be adjusted at any time.
2705 *
2706 * @note The default queue size is @see BRAWCAP_TX_DRIVER_QUEUE_SIZE_DEFAULT (in number of packets).
2707 * And its max limitation is @see BRAWCAP_TX_DRIVER_QUEUE_SIZE_MAX (in number of packets).
2708 *
2709 * @attention Reducing the queue size during runtime may result in packet transmission cancellation.
2710 * This may be the case if there are more packets pending for transmission than the new size can accommodate.
2711 *
2712 * @param[in] pHandle bRAWcap handle to be configured.
2713 *
2714 * @param[in] size Driver transmit queue size to be set.
2715 *
2716 * @return
2717 * Status | Description
2718 * ---------------------------------------------- | -----------------------------------------------------------
2719 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2720 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2721 * @ref BRAWCAP_STATUS_ERROR_PARAM_OUT_OF_RANGE | Specified queue size is out of range/invalid.
2722 * @ref BRAWCAP_STATUS_ERROR_DRIVER_IO_FAILED | Communicating with bRAWcap driver failed.
2723 */
2726
2727/**
2728 * @brief Reads out the currently configured driver transmit queue size for the specified handle.
2729 *
2730 * @param[in] pHandle bRAWcap handle to read from.
2731 *
2732 * @param[out] pSize Will contain the currently configured driver transmit queue size, afterwards.
2733 *
2734 * @return
2735 * Status | Description
2736 * ---------------------------------------------- | -----------------------------------------------------------
2737 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2738 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2739 */
2742
2743/**
2744 * @brief Reads out the available transmit timestamp modes for the specified handle.
2745 *
2746 * Some of the timestamp capabilities depend on the features provided by the underlying adapter.
2747 * Those modes are named with "adapter".
2748 *
2749 * @param[in] pHandle bRAWcap handle to read from.
2750 *
2751 * @param[out] pCapabilities Will contain the available transmit timestamp modes, afterwards.
2752 *
2753 * @return
2754 * Status | Description
2755 * ---------------------------------------------- | -----------------------------------------------------------
2756 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2757 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2758 * @ref BRAWCAP_STATUS_ERROR_DRIVER_IO_FAILED | Communicating with bRAWcap driver failed.
2759 */
2762 brawcap_timestamp_capabilities_t* const pCapabilities);
2763
2764/**
2765 * @brief Configures the used transmit time stamping mode for the specified handle.
2766 *
2767 * @note Only available timestamp modes are accepted. It is recommended to check if a timestamp mode is supported
2768 * before setting it. To check if a timestamp mode is available use @ref brawcap_tx_timestamp_capabilities.
2769 *
2770 * @param[in] pHandle bRAWcap handle to be configured.
2771 *
2772 * @param[in] mode The transmit timestamp mode to be configured.
2773 *
2774 * @return
2775 * Status | Description
2776 * ---------------------------------------------- | -----------------------------------------------------------
2777 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2778 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2779 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Specified timestamp mode not available.
2780 * @ref BRAWCAP_STATUS_ERROR_DRIVER_IO_FAILED | Communicating with bRAWcap driver failed.
2781 */
2784
2785/**
2786 * @brief Reads out the currently configured transmit time stamping mode for the specified handle.
2787 *
2788 * @param[in] pHandle bRAWcap handle to read from.
2789 *
2790 * @param[out] pMode Will contain the currently used transmit time stamping mode, afterwards.
2791 *
2792 * @return
2793 * Status | Description
2794 * ---------------------------------------------- | -----------------------------------------------------------
2795 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2796 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2797 */
2800
2801/**@}*/
2802#endif
2803
2804/************************************************* STATS **************************************************************/
2805#if 1
2806/**
2807 * @addtogroup brawcap_stats
2808 * @{
2809 */
2810
2811/**
2812 * @brief Reads out the available receive statistic counters for the specified handle.
2813 *
2814 * @param[in] pHandle bRAWcap handle to read from.
2815 *
2816 * @param[inout] pStats Will contain the current receive statistic counters, afterwards.
2817 * The header of the statistic struct hast to be filled by the caller, before calling this function.
2818 * If it is not filled or contains invalid data, the function will fail and return a error.
2819 *
2820 * @return
2821 * Status | Description
2822 * ---------------------------------------------- | -----------------------------------------------------------
2823 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2824 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2825 * @ref BRAWCAP_STATUS_ERROR_INVALID_PARAM | The header was invalid (type or revision).
2826 * @ref BRAWCAP_STATUS_ERROR_PARAM_OUT_OF_RANGE | The specified size in the header was invalid.
2827 * @ref BRAWCAP_STATUS_ERROR_DRIVER_IO_FAILED | Communicating with bRAWcap driver failed.
2828 */
2831
2832/**
2833 * @brief Reads out the available transmit statistic counters for the specified handle.
2834 *
2835 * @param[in] pHandle bRAWcap handle to read from.
2836 *
2837 * @param[inout] pStats Will contain the current transmit statistic counters, afterwards.
2838 * The header of the statistic struct hast to be filled by the caller, before calling this function.
2839 * If it is not filled or contains invalid data, the function will fail and return a error.
2840 *
2841 * @return
2842 * Status | Description
2843 * ---------------------------------------------- | -----------------------------------------------------------
2844 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2845 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2846 * @ref BRAWCAP_STATUS_ERROR_INVALID_PARAM | The header was invalid (type or revision).
2847 * @ref BRAWCAP_STATUS_ERROR_PARAM_OUT_OF_RANGE | The specified size in the header was invalid.
2848 * @ref BRAWCAP_STATUS_ERROR_DRIVER_IO_FAILED | Communicating with bRAWcap driver failed.
2849 */
2852
2853/**@}*/
2854#endif
2855
2856#if defined(__cplusplus)
2857}
2858#endif //(__cplusplus)
2859
2860#endif //BRAWCAP_H
bRAWcap API - User mode types.
UINT32 brawcap_queue_size_t
The number of packets which can be (temporary) buffered by the bRAWcap driver queue.
Definition: brawcap_types_shared.h:84
struct _brawcap_handle brawcap_handle_t
A bRAWcap handle.
Definition: brawcap_types_um.h:184
brawcap_status_t brawcap_close(brawcap_handle_t *pHandle)
Closes the specified bRAWcap handle.
brawcap_status_t brawcap_open(const brawcap_adapter_name_t name, brawcap_handle_t **const pHandle)
Opens a new bRAWcap handle on the adapter, specified by it´s name.
brawcap_status_t brawcap_last_status()
Reads the last status appeared in bRAWcap, for the calling thread.
brawcap_status_t
bRAWcap status/return codes.
Definition: brawcap_types_shared.h:140
bRAWcap version.
Definition: brawcap_types_shared.h:422
brawcap_status_t brawcap_version_api(brawcap_version_t *const pVersion)
Returns loaded bRAWcap library version.
brawcap_status_t brawcap_version_driver(brawcap_handle_t *const pHandle, brawcap_version_t *const pVersion)
Reads current version of loaded bRAWcap driver.
UINT32 brawcap_timestamp_capabilities_t
Type used for indicating the supported timestamp modes.
Definition: brawcap_types_shared.h:520
brawcap_status_t brawcap_timestamp_value_us_get(brawcap_timestamp_t *const pTimestamp, UINT64 *const pSeconds, UINT32 *const pMicroseconds)
Reads out the timestamp value in seconds and microseconds.
brawcap_status_t brawcap_timestamp_value_ms_get(brawcap_timestamp_t *const pTimestamp, UINT64 *const pSeconds, UINT32 *const pMilliseconds)
Reads out the timestamp value in seconds and milliseconds.
brawcap_status_t brawcap_timestamp_resolution_ns_get(brawcap_timestamp_t *const pTimestamp, brawcap_timestamp_resolution_ns_t *const pResolution_ns)
Reads out the timestamp resolution of the specified timestamp.
brawcap_status_t brawcap_timestamp_value_us_set(brawcap_timestamp_t *const pTimestamp, const UINT64 seconds, const UINT32 microseconds)
Sets the timestamp value in seconds and microseconds.
struct _brawcap_timestamp brawcap_timestamp_t
bRAWcap timestamp object.
Definition: brawcap_types_shared.h:608
brawcap_status_t brawcap_timestamp_value_ns_get(brawcap_timestamp_t *const pTimestamp, UINT64 *const pSeconds, UINT32 *const pNanoseconds)
Reads out the timestamp value in seconds and nanoseconds.
UINT32 brawcap_timestamp_resolution_ns_t
Represents the timestamp resolution in nanoseconds.
Definition: brawcap_types_shared.h:529
brawcap_timestamp_mode_t
List of different timestamp modes.
Definition: brawcap_types_shared.h:570
brawcap_status_t brawcap_timestamp_value_ms_set(brawcap_timestamp_t *const pTimestamp, const UINT64 seconds, const UINT32 milliseconds)
Sets the timestamp value in seconds and milliseconds.
brawcap_status_t brawcap_timestamp_mode_get(brawcap_timestamp_t *const pTimestamp, brawcap_timestamp_mode_t *const pMode)
Reads out the mode of the specified timestamp.
brawcap_status_t brawcap_timestamp_value_ns_set(brawcap_timestamp_t *const pTimestamp, const UINT64 seconds, const UINT32 nanoseconds)
Sets the timestamp value in seconds and nanoseconds.
_BRAWCAP_DEPRECATED brawcap_status_t brawcap_packet_payload_set(brawcap_packet_t *const pPacket, const char *const pPayload, const brawcap_packet_size_t length)
Sets the packet payload of the specified packet.
UINT16 brawcap_packet_size_t
Type for handling the number of payload bytes per packet.
Definition: brawcap_types_shared.h:666
brawcap_status_t brawcap_packet_payload_size_get(brawcap_packet_t *const pPacket, brawcap_packet_size_t *const pLength)
Reads out the captured payload byte size of the specified packet. This indicates the total byte size ...
_BRAWCAP_DEPRECATED brawcap_status_t brawcap_packet_payload_get(brawcap_packet_t *const pPacket, const char **const pPayload, brawcap_packet_size_t *const pLength)
Reads out the payload of the specified packet.
brawcap_status_t brawcap_packet_create(brawcap_packet_t **const pPacket, const brawcap_packet_size_t maxSize)
Creates a new packet.
brawcap_status_t brawcap_packet_payload_set_v2(brawcap_packet_t *const pPacket, const unsigned char *const pPayload, const brawcap_packet_size_t length)
Sets the packet payload of the specified packet.
struct _brawcap_packet brawcap_packet_t
bRAWcap packet object.
Definition: brawcap_types_shared.h:675
brawcap_status_t brawcap_packet_payload_get_v2(brawcap_packet_t *const pPacket, const unsigned char **const pPayload, brawcap_packet_size_t *const pLength)
Reads out the payload of the specified packet.
brawcap_status_t brawcap_packet_payload_max_size_get(brawcap_packet_t *const pPacket, brawcap_packet_size_t *const pMaxPayloadSize)
Reads out the max supported payload byte size of the specified packet. This value was set during pack...
brawcap_status_t brawcap_packet_length_on_wire_get(brawcap_packet_t *const pPacket, brawcap_packet_size_t *const pLengthOnWire)
Reads out the length on wire of the specified packet. This value is especially useful for received pa...
brawcap_status_t brawcap_packet_status_get(brawcap_packet_t *const pPacket, brawcap_status_t *const pStatus)
Reads out the status for the specified packet. The status will be set updated during reception/transm...
brawcap_status_t brawcap_packet_timestamp_get(brawcap_packet_t *const pPacket, brawcap_timestamp_t **const pTimestamp)
Reads out the timestamp object for the specified packet.
brawcap_status_t brawcap_packet_free(brawcap_packet_t *pPacket)
Frees the specified packet. When this function is called the specified packet becomes invalid and it´...
struct _brawcap_buffer brawcap_buffer_t
bRAWcap packet buffer object.
Definition: brawcap_types_shared.h:746
brawcap_status_t brawcap_buffer_back(brawcap_buffer_t *const pBuffer, brawcap_packet_t **const pPacket)
Reads out the last buffered packet of the specified packet buffer.
brawcap_status_t brawcap_buffer_front(brawcap_buffer_t *const pBuffer, brawcap_packet_t **const pPacket)
Reads out the first buffered packet of the specified packet buffer.
brawcap_status_t brawcap_buffer_sort(brawcap_buffer_t *const pBuffer, const brawcap_buffer_sort_order_t order, const brawcap_buffer_sort_types_t type, const brawcap_packet_size_t offset, const brawcap_packet_size_t length, const brawcap_buffer_sort_endian_t endian)
Sorts packets in a buffer by timestamp or by a payload field.
brawcap_status_t brawcap_buffer_add_back(brawcap_buffer_t *const pBuffer, const brawcap_packet_t *const pPacket)
Adds the specified packet at the end of the specified packet buffer.
brawcap_status_t brawcap_buffer_free(brawcap_buffer_t *pBuffer)
Frees the specified packet buffer. When this function is called the specified packet buffer becomes i...
UINT32 brawcap_buffer_packet_count_t
Type for handling the number of packets which can be stored in a packet buffer.
Definition: brawcap_types_shared.h:738
brawcap_status_t brawcap_buffer_clear(brawcap_buffer_t *const pBuffer)
Clears the specified packet buffer.
brawcap_buffer_sort_order_t
Buffer sort order.
Definition: brawcap_types_um.h:222
brawcap_status_t brawcap_buffer_add_front(brawcap_buffer_t *const pBuffer, const brawcap_packet_t *const pPacket)
Adds the specified packet at the front of the specified packet buffer.
brawcap_status_t brawcap_buffer_at_index(brawcap_buffer_t *const pBuffer, const brawcap_buffer_packet_count_t index, brawcap_packet_t **const pPacket)
Reads out a buffered packet at the index of the specified packet buffer.
brawcap_status_t brawcap_buffer_capacity(brawcap_buffer_t *const pBuffer, brawcap_buffer_packet_count_t *const pPacketCapacity)
Reads out the total number of packets which can be buffered by the specified packet buffer....
brawcap_status_t brawcap_buffer_count(brawcap_buffer_t *const pBuffer, brawcap_buffer_packet_count_t *const pPacketCount)
Reads out the number of currently buffered packets in the specified packet buffer.
brawcap_buffer_sort_types_t
Buffer sort types.
Definition: brawcap_types_um.h:234
brawcap_status_t brawcap_buffer_create(brawcap_buffer_t **const pBuffer, const brawcap_packet_size_t maxPacketPayloadSize, const brawcap_buffer_packet_count_t numPackets)
Creates a new packet buffer.
brawcap_status_t brawcap_buffer_add_at_index(brawcap_buffer_t *const pBuffer, const brawcap_packet_t *const pPacket, const brawcap_buffer_packet_count_t index)
Inserts the specified packet at index/position into the specified packet buffer.
brawcap_buffer_sort_endian_t
Byte order selection for payload sorting.
Definition: brawcap_types_um.h:244
brawcap_status_t brawcap_buffer_iterator_free(brawcap_buffer_iterator_t *const pIterator)
Frees the specified iterator. When this function is called the specified iterator becomes invalid and...
struct _brawcap_buffer_iterator brawcap_buffer_iterator_t
bRAWcap packet buffer iterator object.
Definition: brawcap_types_shared.h:774
brawcap_packet_t * brawcap_buffer_iterator_eval(brawcap_buffer_iterator_t *const pIterator)
Returns the buffered packet for the specified iterator.
brawcap_status_t brawcap_buffer_iterator_prev(brawcap_buffer_iterator_t *const pIterator)
Decreases the iterator to the previous buffered packet.
brawcap_status_t brawcap_buffer_iterator_create(brawcap_buffer_iterator_t **const pIterator, brawcap_buffer_t *const pBuffer, brawcap_buffer_packet_count_t startPosition)
Creates a new iterator for the specified buffer.
brawcap_status_t brawcap_buffer_iterator_next(brawcap_buffer_iterator_t *const pIterator)
Increments the iterator to the next buffered packet.
IPv4 address.
Definition: brawcap_types_um.h:307
IPv6 address.
Definition: brawcap_types_um.h:317
brawcap_status_t brawcap_adapter_mac_by_handle(brawcap_handle_t *const pHandle, brawcap_adapter_mac_t mac)
Reads out the MAC address of the specified adapter.
brawcap_status_t brawcap_adapter_notify_unregister()
Unregisters the calling process from receiving adapter change notifications.
brawcap_status_t brawcap_adapter_name_by_handle(brawcap_handle_t *const pHandle, brawcap_adapter_name_t name)
Reads out the adapter name of the specified adapter.
brawcap_status_t brawcap_adapter_mtu(const brawcap_adapter_name_t name, brawcap_adapter_mtu_t *const pMtu)
Reads out the configured MTU of the specified adapter.
brawcap_status_t brawcap_adapter_list_at(const brawcap_adapter_count_t index, brawcap_adapter_name_t name)
Reads out the adapter name of the adapter at the adapter list index.
brawcap_status_t brawcap_adapter_speed_rx(const brawcap_adapter_name_t name, brawcap_adapter_speed_t *const pSpeed)
Reads out the current receive speed of the specified adapter.
brawcap_status_t brawcap_adapter_friendly_name_by_handle(brawcap_handle_t *const pHandle, char *const friendlyName, UINT32 *const pLength)
Reads out the currently set friendly name of the specified adapter.
brawcap_status_t brawcap_adapter_list_count(brawcap_adapter_count_t *const pCount)
Reads out the current number of supported adapters in the adapter list.
brawcap_status_t brawcap_adapter_ipv4(const brawcap_adapter_name_t name, brawcap_adapter_ipv4_t *const pIpv4)
Reads out the currently set IPv4 address of the specified adapter.
brawcap_status_t brawcap_adapter_notify_handle_register(brawcap_handle_t *const pHandle, brawcap_adapter_notify_handle_callback_t const callback, void *const pUser)
Registers the specified handle for receiving adapter change notifications.
brawcap_status_t brawcap_adapter_speed_tx_by_handle(brawcap_handle_t *const pHandle, brawcap_adapter_speed_t *const pSpeed)
Reads out the current transmit speed of the specified adapter.
brawcap_status_t brawcap_adapter_friendly_name(const brawcap_adapter_name_t name, char *const friendlyName, UINT32 *const pLength)
Reads out the currently set adapter friendly name for the specified adapter.
brawcap_status_t brawcap_adapter_description(const brawcap_adapter_name_t name, char *const description, UINT32 *const pLength)
Reads out the description of the specified adapter.
brawcap_status_t brawcap_adapter_ipv6_by_handle(brawcap_handle_t *const pHandle, brawcap_adapter_ipv6_t *const pIpv6)
Reads out the currently set IPv6 address of the specified adapter.
void(* brawcap_adapter_notify_handle_callback_t)(brawcap_handle_t *const pHandle, const brawcap_adapter_notify_reason_t reason, const UINT32 properties, void *pUser)
The per handle callback for adapter change notifications. It will be called each time a change for th...
Definition: brawcap_types_um.h:456
brawcap_status_t brawcap_adapter_speed_rx_by_handle(brawcap_handle_t *const pHandle, brawcap_adapter_speed_t *const pSpeed)
Reads out the current receive speed of the specified adapter.
brawcap_status_t brawcap_adapter_operation_by_handle(brawcap_handle_t *const pHandle, brawcap_adapter_operation_state_t *const pOperation)
Reads out the current operation state of the specified adapter.
UINT8 brawcap_adapter_mac_t[BRAWCAP_ADAPTER_MAC_LENGTH]
Fixed size array describing a MAC address.
Definition: brawcap_types_um.h:293
brawcap_adapter_connection_state_t
List of adapter connection states. Values indicating the current adapter connection state (uplink/cab...
Definition: brawcap_types_um.h:350
brawcap_status_t brawcap_adapter_mtu_by_handle(brawcap_handle_t *const pHandle, brawcap_adapter_mtu_t *const pMtu)
Reads out the configured MTU of the specified adapter.
char brawcap_adapter_name_t[BRAWCAP_ADAPTER_NAME_LENGTH]
Fixed size array containing a adapter name.
Definition: brawcap_types_um.h:301
brawcap_status_t brawcap_adapter_connection(const brawcap_adapter_name_t name, brawcap_adapter_connection_state_t *const pConnection)
Reads out the current connection state of the specified adapter.
brawcap_status_t brawcap_adapter_ipv6(const brawcap_adapter_name_t name, brawcap_adapter_ipv6_t *const pIpv6)
Reads out the currently set IPv6 address of the specified adapter.
brawcap_adapter_speed_t
List of bRAWcap adapter speeds. Values indicating the current adapter uplink speed.
Definition: brawcap_types_um.h:331
brawcap_status_t brawcap_adapter_list_update()
Updates the list of supported adapters. This function searches the current machine for supported adap...
brawcap_status_t brawcap_adapter_ipv4_by_handle(brawcap_handle_t *const pHandle, brawcap_adapter_ipv4_t *const pIpv4)
Reads out the currently set IPv4 address of the specified adapter.
void(* brawcap_adapter_notify_callback_t)(const brawcap_adapter_name_t name, const brawcap_adapter_notify_reason_t reason, const UINT32 properties, void *pUser)
The general callback for adapter change notifications. It will be called each time a available and su...
Definition: brawcap_types_um.h:441
brawcap_status_t brawcap_adapter_mac(const brawcap_adapter_name_t name, brawcap_adapter_mac_t mac)
Reads out the MAC address of the specified adapter.
brawcap_status_t brawcap_adapter_connection_by_handle(brawcap_handle_t *const pHandle, brawcap_adapter_connection_state_t *const pConnection)
Reads out the current connection state of the specified adapter.
brawcap_status_t brawcap_adapter_description_by_handle(brawcap_handle_t *const pHandle, char *const description, UINT32 *const pLength)
Reads out the description of a network adapter based on the specified adapter.
brawcap_adapter_operation_state_t
List of adapter operation states. Values indicating the current adapter operation state (adapter driv...
Definition: brawcap_types_um.h:361
UINT8 brawcap_adapter_count_t
Type used for counting the available/supported adapters on a machine.
Definition: brawcap_types_um.h:286
brawcap_status_t brawcap_adapter_notify_register(brawcap_adapter_notify_callback_t const callback, void *const pUser)
Registers the calling process for receiving adapter change notifications.
brawcap_status_t brawcap_adapter_speed_tx(const brawcap_adapter_name_t name, brawcap_adapter_speed_t *const pSpeed)
Reads out the current transmit speed of the specified adapter.
UINT64 brawcap_adapter_mtu_t
Type for handling the adapter maximum transmission unit (MTU).
Definition: brawcap_types_um.h:381
brawcap_status_t brawcap_adapter_notify_handle_unregister(brawcap_handle_t *const pHandle)
Unregisters the specified handle from receiving adapter change notifications.
brawcap_status_t brawcap_adapter_operation(const brawcap_adapter_name_t name, brawcap_adapter_operation_state_t *const pOperation)
Reads out the current operation state of the specified adapter.
brawcap_status_t brawcap_rx_min_packets_set(brawcap_handle_t *const pHandle, const brawcap_rx_min_packets_t minPackets)
Sets the minimum amount of packets to receive for the specified handle.
brawcap_status_t brawcap_rx_packet(brawcap_handle_t *const pHandle, brawcap_packet_t *const pPacket)
Receives a single packet from the specified handle.
brawcap_status_t brawcap_rx_direction_get(brawcap_handle_t *const pHandle, brawcap_rx_direction_t *const pDirection)
Reads out the currently configured receive direction of the specified handle.
brawcap_status_t brawcap_rx_buffer_detach(brawcap_handle_t *const pHandle, brawcap_buffer_t *const pBuffer)
Detaches the specified bRAWcap packet buffer from the specified handle.
brawcap_status_t brawcap_rx_timeout_get(brawcap_handle_t *const pHandle, brawcap_rx_timeout_t *const pTimeout_ms)
Reads out the currently configured receive timeout for the specified handle.
brawcap_status_t brawcap_rx_start(brawcap_handle_t *const pHandle, brawcap_rx_callback_t const callback, void *const pUser, const BOOLEAN indicateNoPackets)
Starts the internal receive loop.
brawcap_status_t brawcap_rx_vlan_tagging_get(brawcap_handle_t *const pHandle, BOOLEAN *const pEnabled)
Reads out the configured VLAN tagging state for the specified handle.
brawcap_status_t brawcap_rx_driver_queue_size_set(brawcap_handle_t *const pHandle, const brawcap_queue_size_t size)
Sets the driver queue size (in number of packets) for the specified handle.
brawcap_status_t brawcap_rx_timeout_set(brawcap_handle_t *const pHandle, const brawcap_rx_timeout_t timeout_ms)
Configures the receive timeout for the specified handle.
brawcap_status_t brawcap_rx_vlan_tagging_set(brawcap_handle_t *const pHandle, const BOOLEAN enable)
Sets the current VLAN tagging flag for the specified handle.
brawcap_status_t brawcap_rx_timestamp_capabilities(brawcap_handle_t *const pHandle, brawcap_timestamp_capabilities_t *const pCapabilities)
Reads out the available receive timestamp modes for the specified handle.
brawcap_status_t brawcap_rx_direction_set(brawcap_handle_t *const pHandle, const brawcap_rx_direction_t direction)
Sets the receive direction for the specified handle.
brawcap_status_t brawcap_rx_promiscuous_mode_set(brawcap_handle_t *const pHandle, const BOOLEAN enable)
Sets the current promiscuous mode flag for the specified handle.
brawcap_status_t brawcap_rx_stop(brawcap_handle_t *const pHandle)
Stops the internal receive loop.
brawcap_status_t brawcap_rx_promiscuous_mode_get(brawcap_handle_t *const pHandle, BOOLEAN *const pEnabled, BOOLEAN *const pEnabledAdapter)
Reads out the current promiscuous mode state for the specified handle.
brawcap_status_t brawcap_rx_driver_queue_size_get(brawcap_handle_t *const pHandle, brawcap_queue_size_t *const pSize)
Reads out the currently configured driver receive queue size for the specified handle.
brawcap_status_t brawcap_rx_timestamp_mode_set(brawcap_handle_t *const pHandle, const brawcap_timestamp_mode_t mode)
Configures the used receive time stamping mode for the specified handle.
brawcap_status_t brawcap_rx_buffer_attach(brawcap_handle_t *const pHandle, brawcap_buffer_t *const pBuffer)
Attaches the specified bRAWcap packet buffer to the specified handle.
brawcap_status_t brawcap_rx_filter_set(brawcap_handle_t *const pHandle, const brawcap_filter_t *const pFilter)
Sets the specified filter to the specified handle.
brawcap_status_t brawcap_rx_min_packets_get(brawcap_handle_t *const pHandle, brawcap_rx_min_packets_t *const pMinPackets)
Reads out the currently configured number of packets to receive for the specified handle.
UINT32 brawcap_rx_min_packets_t
Type for handling the minimum amount of packets to copy before a bRAWcap receive will return....
Definition: brawcap_types_shared.h:1033
brawcap_status_t brawcap_rx_filter_get(brawcap_handle_t *const pHandle, brawcap_filter_t *const pFilter)
Reads out the currently configured filter for the specified handle.
brawcap_status_t brawcap_rx_timestamp_mode_get(brawcap_handle_t *const pHandle, brawcap_timestamp_mode_t *const pMode)
Reads out the currently configured receive time stamping mode for the specified handle.
UINT16 brawcap_rx_timeout_t
Type for handling receive timeouts in number of milliseconds. The timeout specifies the maximum block...
Definition: brawcap_types_shared.h:1023
void(* brawcap_rx_callback_t)(brawcap_handle_t *const pHandle, const brawcap_status_t status, brawcap_buffer_t *const pBuffer, void *pUser)
Receive callback which is called each time a receive has finished. Receiving can be started with braw...
Definition: brawcap_types_um.h:506
brawcap_rx_direction_t
List of supported receive directions.
Definition: brawcap_types_shared.h:1060
UINT8 brawcap_filter_mask_array_t[BRAWCAP_FILTER_BYTE_MAX_LENGTH]
Fixed size array for storing a filter byte mask.
Definition: brawcap_types_shared.h:911
brawcap_status_t brawcap_filter_bytes_to_capture_set(brawcap_filter_t *const pFilter, const brawcap_packet_size_t offset, const brawcap_packet_size_t length)
Sets the bytes to capture of the specified filter.
brawcap_status_t brawcap_filter_create(brawcap_filter_t **const pFilter, const brawcap_filter_type_t type)
Creates a new filter.
struct _brawcap_filter brawcap_filter_t
bRAWcap filter object.
Definition: brawcap_types_shared.h:959
brawcap_status_t brawcap_filter_deactivate(brawcap_filter_t *const pFilter)
Sets the specified filter to inactive.
brawcap_status_t brawcap_filter_bytes_to_capture_get(brawcap_filter_t *const pFilter, brawcap_packet_size_t *const pOffset, brawcap_packet_size_t *const pLength)
Reads out the configured bytes to capture of the specified filter.
brawcap_status_t brawcap_filter_is_activated(brawcap_filter_t *const pFilter, BOOLEAN *const pActive)
Reads out the current activation state of the specified filter.
brawcap_filter_type_t
List of filter types.
Definition: brawcap_types_shared.h:938
UINT8 brawcap_filter_ignore_bits_array_t[BRAWCAP_FILTER_BYTE_MAX_LENGTH]
Fixed size array for storing a byte wise bitfield.
Definition: brawcap_types_shared.h:923
brawcap_status_t brawcap_filter_mask_set(brawcap_filter_t *const pFilter, const brawcap_filter_byte_length_t offset, const brawcap_filter_byte_length_t length, const brawcap_filter_mask_array_t mask, const brawcap_filter_ignore_bits_array_t ignoreBits)
Sets the filter parameters for the specified filter.
brawcap_status_t brawcap_filter_indicate_get(brawcap_filter_t *const pFilter, BOOLEAN *const pIndicate)
Reads out the current network stack indication state of the specified filter.
brawcap_status_t brawcap_filter_type_get(brawcap_filter_t *const pFilter, brawcap_filter_type_t *const pType)
Reads out the type for the specified filter.
brawcap_status_t brawcap_filter_free(brawcap_filter_t *pFilter)
Frees the specified filter. When this function is called the given filter becomes invalid and it´s me...
brawcap_status_t brawcap_filter_bpf_set(brawcap_filter_t *const pFilter, const char *const filterString)
Sets the BPF filter string for the specified filter.
brawcap_status_t brawcap_filter_bpf_get(brawcap_filter_t *const pFilter, char *filterString, UINT *const pLength)
Reads the BPF filter string from the specified filter.
brawcap_packet_size_t brawcap_filter_byte_length_t
Type for specifying the byte filter length.
Definition: brawcap_types_shared.h:928
brawcap_status_t brawcap_filter_indicate_set(brawcap_filter_t *const pFilter, const BOOLEAN indicate)
Specifies if packets which matched the specified filter should be indicated to the network stack.
brawcap_status_t brawcap_filter_activate(brawcap_filter_t *const pFilter)
Sets the specified filter to active.
brawcap_status_t brawcap_filter_bpf_compile_error_get(brawcap_filter_t *const pFilter, const char *pError)
Retrieves the BPF compile error message from the specified filter.
brawcap_status_t brawcap_filter_mask_get(brawcap_filter_t *const pFilter, brawcap_filter_byte_length_t *const pOffset, brawcap_filter_byte_length_t *const pLength, brawcap_filter_mask_array_t *const pMask, brawcap_filter_ignore_bits_array_t *const pIgnoreBits)
Reads out the filter mask parameters for the specified filter.
brawcap_status_t brawcap_tx_driver_queue_size_get(brawcap_handle_t *const pHandle, brawcap_queue_size_t *const pSize)
Reads out the currently configured driver transmit queue size for the specified handle.
brawcap_status_t brawcap_tx_timestamp_capabilities(brawcap_handle_t *const pHandle, brawcap_timestamp_capabilities_t *const pCapabilities)
Reads out the available transmit timestamp modes for the specified handle.
brawcap_status_t brawcap_tx_packet(brawcap_handle_t *const pHandle, brawcap_packet_t *const pPacket)
Transmits a single packet on the specified handle.
brawcap_status_t brawcap_tx_timestamp_mode_set(brawcap_handle_t *const pHandle, const brawcap_timestamp_mode_t mode)
Configures the used transmit time stamping mode for the specified handle.
brawcap_status_t brawcap_tx_timestamp_mode_get(brawcap_handle_t *const pHandle, brawcap_timestamp_mode_t *const pMode)
Reads out the currently configured transmit time stamping mode for the specified handle.
brawcap_status_t brawcap_tx_stop(brawcap_handle_t *const pHandle)
Stops the internal transmit loop.
brawcap_status_t brawcap_tx_start(brawcap_handle_t *const pHandle, brawcap_tx_callback_t const callback, void *pUser)
Starts the internal transmit loop.
void(* brawcap_tx_callback_t)(brawcap_handle_t *const pHandle, const brawcap_status_t status, brawcap_buffer_t *const pBuffer, void *pUser)
Transmit callback which is called each time a transmission initiated with brawcap_tx_buffer_send has ...
Definition: brawcap_types_um.h:533
brawcap_status_t brawcap_tx_driver_queue_size_set(brawcap_handle_t *const pHandle, const brawcap_queue_size_t size)
Sets the driver queue size (in number of packets) for the specified handle.
brawcap_status_t brawcap_tx_buffer_send(brawcap_handle_t *const pHandle, brawcap_buffer_t *const pBuffer, const BOOLEAN synchronized)
Pushes the specified buffer to the specified handle transmit queue.
The bRAWcap receive statistics.
Definition: brawcap_types_shared.h:1302
The bRAWcap transmit statistics.
Definition: brawcap_types_shared.h:1420
brawcap_status_t brawcap_stats_rx(brawcap_handle_t *const pHandle, brawcap_stats_rx_t *const pStats)
Reads out the available receive statistic counters for the specified handle.
brawcap_status_t brawcap_stats_tx(brawcap_handle_t *const pHandle, brawcap_stats_tx_t *const pStats)
Reads out the available transmit statistic counters for the specified handle.
#define _BRAWCAP_API_FUNC(returnType)
Dynamic/automatic function import for loading/including.
Definition: brawcap_types_um.h:51
brawcap_status_t brawcap_log_level_get(const brawcap_log_type_t type, brawcap_log_level_t *const pLevel)
Reads the level(s) for the given log type.
brawcap_log_type_t
List of bRAWcap log types.
Definition: brawcap_types_um.h:135
brawcap_status_t brawcap_log_levels_set(const UINT32 type, const UINT32 level, const char *pKey)
Sets the current log levels for the given log types to the specified log levels.
brawcap_status_t brawcap_log_level_set(const brawcap_log_type_t type, const brawcap_log_level_t level, const char *pKey)
Sets the current log level for the given log type to the specified log level.
brawcap_log_level_t
List of bRAWcap log levels.
Definition: brawcap_types_um.h:83