bRAWcap 1.0.1
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 * @param[in] pPacket The packet to read from.
586 *
587 * @param[out] pPayload Will contain a pointer to the beginning of the packet payload, afterwards.
588 *
589 * @param[out] pLength Will contain the total length of the packet payload, afterwards.
590 *
591 * @return
592 * Status | Description
593 * ---------------------------------------------- | ------------------------------------------------------------------
594 * @ref BRAWCAP_STATUS_SUCCESS | Success.
595 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
596 */
598brawcap_packet_payload_get(brawcap_packet_t* const pPacket, const char** const pPayload,
599 brawcap_packet_size_t* const pLength);
600
601/**
602 * @brief Sets the packet payload of the specified packet.
603 *
604 * @note It is not allowed to set a larger payload than the max byte payload size
605 * (specified during @ref brawcap_packet_create "packet creation" or
606 * @ref brawcap_buffer_create "buffer creation").
607 * If a larger payload is specified the function will fail and return an error.
608 *
609 * @param[in] pPacket The packet to be modified.
610 *
611 * @param[in] pPayload Pointer to the beginning of the payload to set.
612 *
613 * @param[in] length Total byte size of the payload to set.
614 *
615 * @return
616 * Status | Description
617 * ---------------------------------------------- | ------------------------------------------------------------------
618 * @ref BRAWCAP_STATUS_SUCCESS | Success.
619 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
620 * @ref BRAWCAP_STATUS_ERROR_PARAM_OUT_OF_RANGE | The specified payload size exceeds the packet max payload size.
621 */
623brawcap_packet_payload_set(brawcap_packet_t* const pPacket, const char* const pPayload,
624 const brawcap_packet_size_t length);
625
626/**@}*/
627#endif
628
629/************************************************* BUFFER ************************************************************/
630#if 1
631/**
632 * @addtogroup brawcap_buffer
633 * @{
634 */
635
636/**
637 * @brief Creates a new packet buffer.
638 *
639 * The created buffer can be used for:
640 * - Receiving by @ref brawcap_rx_buffer_attach "attaching" it.
641 * - Transmitting by @ref brawcap_tx_buffer_send "sending" it.
642 *
643 * If a buffer is not required anymore it shall be @ref brawcap_buffer_free "freed".
644 *
645 * @param[out] pBuffer Will contain the new created packet buffer, afterwards.
646 *
647 * @param[in] maxPacketPayloadSize Specifies the max payload byte size for each packet in the buffer.
648 * This cannot be changed after buffer creation and controls the memory size required for each packet in the buffer.
649 * When trying to set the packet payload of any buffered packet which exceeds this value, it will fail.
650 * The value has to be between @ref BRAWCAP_PACKET_SIZE_MIN and @ref BRAWCAP_PACKET_SIZE_MAX.
651 *
652 * @param[in] numPackets Specifies how many packets can be stored in the buffer.
653 * This value, together with the max packet payload size, will control the total amount of memory required for
654 * the packet buffer and cannot be changed after buffer creation.
655 * The value has to be between @ref BRAWCAP_BUFFER_PACKETS_MIN and @ref BRAWCAP_BUFFER_PACKETS_MAX.
656 *
657 * @return
658 * Status | Description
659 * ---------------------------------------------- | ------------------------------------------------------------------
660 * @ref BRAWCAP_STATUS_SUCCESS | Success.
661 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
662 * @ref BRAWCAP_STATUS_ERROR_PARAM_OUT_OF_RANGE | The specified packet payload or number of packets is invalid.
663 * @ref BRAWCAP_STATUS_ERROR_FAILED | System error occurred (e.g. out of memory).
664 */
666brawcap_buffer_create(brawcap_buffer_t** const pBuffer, const brawcap_packet_size_t maxPacketPayloadSize,
667 const brawcap_buffer_packet_count_t numPackets);
668
669/**
670 * @brief Frees the specified packet buffer.
671 * When this function is called the specified packet buffer becomes invalid and it´s memory will be released.
672 *
673 * @warning Freeing a buffer is not thread safe and the user is responsible for synchronization.
674 *
675 * @param[in] pBuffer The packet buffer to be freed.
676 *
677 * @return
678 * Status | Description
679 * ---------------------------------------------- | ------------------------------------------------------------------
680 * @ref BRAWCAP_STATUS_SUCCESS | Success.
681 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
682 * @ref BRAWCAP_STATUS_ERROR_IN_USE | Buffer is still in use/pending (receive/transmit).
683 */
686
687/**
688 * @brief Clears the specified packet buffer.
689 *
690 * All buffered packets will be cleared.
691 * It may be used to reuse a already created packet buffer.
692 * For example this can be useful after transmission of the packet buffer has finished.
693 * Reusing a buffer improves performance and should be preferred instead of always creating and freeing packet
694 * buffers.
695 *
696 * @warning After calling this function all buffered packets in the packet buffer become invalid and shall not be used
697 * anymore.
698 *
699 * @param[in] pBuffer The packet buffer to be cleared.
700 *
701 * @return
702 * Status | Description
703 * ---------------------------------------------- | ------------------------------------------------------------------
704 * @ref BRAWCAP_STATUS_SUCCESS | Success.
705 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
706 * @ref BRAWCAP_STATUS_ERROR_IN_USE | Buffer is still in use/pending (receive/transmit).
707 */
710
711/**
712 * @brief Adds the specified packet at the end of the specified packet buffer.
713 *
714 * @param[in] pBuffer The packet buffer to be modified.
715 *
716 * @param[in] pPacket The packet to insert into the buffer.
717 *
718 * @return
719 * Status | Description
720 * ---------------------------------------------- | ------------------------------------------------------------------
721 * @ref BRAWCAP_STATUS_SUCCESS | Success.
722 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
723 * @ref BRAWCAP_STATUS_ERROR_IN_USE | Buffer is still in use/pending (receive/transmit).
724 * @ref BRAWCAP_STATUS_ERROR_OVERRUN | The max number of packets for the buffer is reached.
725 * @ref BRAWCAP_STATUS_ERROR_PARAM_OUT_OF_RANGE | The packet payload length is to long for the buffer.
726 */
728brawcap_buffer_add_back(brawcap_buffer_t* const pBuffer, const brawcap_packet_t* const pPacket);
729
730/**
731 * @brief Adds the specified packet at the front of the specified packet buffer.
732 *
733 * @param[in] pBuffer The packet buffer to be modified.
734 *
735 * @param[in] pPacket The packet to insert into the buffer.
736 *
737 * @return
738 * Status | Description
739 * ---------------------------------------------- | ------------------------------------------------------------------
740 * @ref BRAWCAP_STATUS_SUCCESS | Success.
741 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
742 * @ref BRAWCAP_STATUS_ERROR_IN_USE | Buffer is still in use/pending (receive/transmit).
743 * @ref BRAWCAP_STATUS_ERROR_OVERRUN | The max number of packets for the buffer is reached.
744 * @ref BRAWCAP_STATUS_ERROR_PARAM_OUT_OF_RANGE | The packet payload length is to long for the buffer.
745 */
747brawcap_buffer_add_front(brawcap_buffer_t* const pBuffer, const brawcap_packet_t* const pPacket);
748
749/**
750 * @brief Inserts the specified packet at index/position into the specified packet buffer.
751 *
752 * @param[in] pBuffer The packet buffer to be modified.
753 *
754 * @param[in] pPacket The packet to insert into the buffer.
755 *
756 * @param[in] index Index at which the packet should be inserted.
757 *
758 * @return
759 * Status | Description
760 * ---------------------------------------------- | ------------------------------------------------------------------
761 * @ref BRAWCAP_STATUS_SUCCESS | Success.
762 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
763 * @ref BRAWCAP_STATUS_ERROR_IN_USE | Buffer is still in use/pending (receive/transmit).
764 * @ref BRAWCAP_STATUS_ERROR_OVERRUN | The max number of packets for the buffer is reached.
765 * @ref BRAWCAP_STATUS_ERROR_PARAM_OUT_OF_RANGE | The packet payload length is to long for the buffer.
766 * @ref BRAWCAP_STATUS_ERROR_INVALID_PARAM | The given index is invalid (exceeds buffer).
767 */
771
772/**
773 * @brief Reads out a buffered packet at the index of the specified packet buffer.
774 *
775 * @param[in] pBuffer The packet buffer to read from.
776 *
777 * @param[in] index The index of the packet.
778 *
779 * @param[out] pPacket Will contain the buffered packet, afterwards.
780 *
781 * @return
782 * Status | Description
783 * ---------------------------------------------- | ------------------------------------------------------------------
784 * @ref BRAWCAP_STATUS_SUCCESS | Success.
785 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
786 * @ref BRAWCAP_STATUS_ERROR_IN_USE | Buffer is still in use/pending (receive/transmit).
787 * @ref BRAWCAP_STATUS_ERROR_INVALID_PARAM | The given index is invalid (exceeds buffer).
788 */
791 brawcap_packet_t** const pPacket);
792
793/**
794 * @brief Reads out the first buffered packet of the specified packet buffer.
795 *
796 * @param[in] pBuffer The packet buffer to read from.
797 *
798 * @param[out] pPacket Will contain the buffered packet, afterwards.
799 *
800 * @return
801 * Status | Description
802 * ---------------------------------------------- | ------------------------------------------------------------------
803 * @ref BRAWCAP_STATUS_SUCCESS | Success.
804 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
805 * @ref BRAWCAP_STATUS_ERROR_IN_USE | Buffer is still in use/pending (receive/transmit).
806 */
809
810/**
811 * @brief Reads out the last buffered packet of the specified packet buffer.
812 *
813 * @param[in] pBuffer The packet buffer to read from.
814 *
815 * @param[out] pPacket Will contain the buffered packet, afterwards.
816 *
817 * @return
818 * Status | Description
819 * ---------------------------------------------- | ------------------------------------------------------------------
820 * @ref BRAWCAP_STATUS_SUCCESS | Success.
821 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
822 * @ref BRAWCAP_STATUS_ERROR_IN_USE | Buffer is still in use/pending (receive/transmit).
823 */
826
827/**
828 * @brief Reads out the number of currently buffered packets in the specified packet buffer.
829 *
830 * @param[in] pBuffer The packet buffer to read from.
831 *
832 * @param[out] pPacketCount Will contain the number of buffered packets, afterwards.
833 *
834 * @return
835 * Status | Description
836 * ---------------------------------------------- | ------------------------------------------------------------------
837 * @ref BRAWCAP_STATUS_SUCCESS | Success.
838 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
839 * @ref BRAWCAP_STATUS_ERROR_IN_USE | Buffer is still in use/pending (receive/transmit).
840 */
843
844/**
845 * @brief Reads out the total number of packets which can be buffered by the specified packet buffer.
846 * This value represents the packet buffer capacity, which is set during buffer creation.
847 *
848 * @param[in] pBuffer The packet buffer to read from.
849 *
850 * @param[out] pPacketCapacity Will contain the total number of packets which can be buffered, afterwards.
851 *
852 * @return
853 * Status | Description
854 * ---------------------------------------------- | ------------------------------------------------------------------
855 * @ref BRAWCAP_STATUS_SUCCESS | Success.
856 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
857 * @ref BRAWCAP_STATUS_ERROR_IN_USE | Buffer is still in use/pending (receive/transmit).
858 */
861
862/********************************************* BUFFER ITERATOR ********************************************************/
863#if 1
864/**
865 * @addtogroup brawcap_buffer_iterator
866 * @{
867 */
868
869/**
870 * @brief Creates a new iterator for the specified buffer.
871 *
872 * If a iterator is not required anymore it shall be @ref brawcap_buffer_iterator_free "freed".
873 *
874 * @param[out] pIterator Will contain the new created iterator.
875 *
876 * @param[in] pBuffer The buffer for which to create the iterator.
877 *
878 * @param[in] startPosition The start position of the iterator (packet buffer index/position).
879 * The specified position must be below the number of currently buffered packets,
880 * which can be resolved with @ref brawcap_buffer_count.
881 *
882 * @return
883 * Status | Description
884 * ---------------------------------------------- | ------------------------------------------------------------------
885 * @ref BRAWCAP_STATUS_SUCCESS | Success.
886 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
887 * @ref BRAWCAP_STATUS_ERROR_IN_USE | Buffer is still in use/pending (receive/transmit).
888 * @ref BRAWCAP_STATUS_ERROR_INVALID_PARAM | Start position exceeds number of buffered packets.
889 * @ref BRAWCAP_STATUS_ERROR_FAILED | System error occurred (e.g. out of memory).
890 */
893 brawcap_buffer_packet_count_t startPosition);
894
895/**
896 * @brief Frees the specified iterator.
897 * When this function is called the specified iterator becomes invalid and it´s memory will be released.
898 *
899 * @warning Freeing a iterator is not thread safe and the user is responsible for synchronization.
900 *
901 * @param[in] pIterator The iterator to be freed.
902 *
903 * @return
904 * Status | Description
905 * ---------------------------------------------- | ------------------------------------------------------------------
906 * @ref BRAWCAP_STATUS_SUCCESS | Success.
907 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
908 */
911
912/**
913 * @brief Increments the iterator to the next buffered packet.
914 *
915 * @param[in] pIterator The iterator to be incremented.
916 *
917 * @return
918 * Status | Description
919 * ---------------------------------------------- | ------------------------------------------------------------------
920 * @ref BRAWCAP_STATUS_SUCCESS | Success.
921 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
922 */
925
926/**
927 * @brief Decreases the iterator to the previous buffered packet.
928 *
929 * @param[in] pIterator The iterator to be decremented.
930 *
931 * @return
932 * Status | Description
933 * ---------------------------------------------- | ------------------------------------------------------------------
934 * @ref BRAWCAP_STATUS_SUCCESS | Success.
935 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
936 */
939
940/**
941 * @brief Returns the buffered packet for the specified iterator.
942 *
943 * @param[in] pIterator The iterator to read from.
944 *
945 * @return
946 * Pointer | Description
947 * ---------------------------------------------- | ------------------------------------------------------------------
948 * @ref brawcap_packet_t | On success a valid bRAWcap packet object pointer.
949 * NULL | Invalid iterator (e.g. beyond the last or first packet).
950 */
953
954/**@}*/
955#endif
956
957/**@}*/
958#endif
959
960/************************************************ ADAPTER ************************************************************/
961#if 1
962/**
963 * @addtogroup brawcap_adapter
964 * @{
965 */
966
967/**
968 * @brief Updates the list of supported adapters.
969 * This function searches the current machine for supported adapters and add them to the adapter list.
970 *
971 * @note The list will be initialized when calling the first bRAWcap function and not update automatically after that.
972 * To update the list later on use this function.
973 * A alternative to detect new/removed adapters is
974 * @ref brawcap_adapter_notify_register "registering for change notifications".
975 *
976 * @attention The adapter list is not thread safe.
977 * Therefore parallel calls to this function, @ref brawcap_adapter_list_count and @ref brawcap_adapter_list_at
978 * should be avoided or at least synchronized.
979 * If the list is changed by this function and another thread is currently retrieving information from the list
980 * it may lead to undefined behavior or even a crash if the number of entries is reduced.
981 *
982 * @return
983 * Status | Description
984 * ---------------------------------------------- | ------------------------------------------------------------------
985 * @ref BRAWCAP_STATUS_SUCCESS | Success.
986 */
989
990/**
991 * @brief Reads out the current number of supported adapters in the adapter list.
992 *
993 * @note The count is only updated after a call to @ref brawcap_adapter_list_update.
994 *
995 * @attention Updating the list and retrieving information from it is not thread safe.
996 * Therefore accessing it from different threads shall be avoided or synchronized.
997 *
998 * @param[out] pCount Will contain the current number of adapters in the list, afterwards.
999 *
1000 * @return
1001 * Status | Description
1002 * ---------------------------------------------- | ------------------------------------------------------------------
1003 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1004 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
1005 */
1008
1009/**
1010 * @brief Reads out the adapter name of the adapter at the adapter list index.
1011 *
1012 * @note The adapter list is only updated after a call to @ref brawcap_adapter_list_update.
1013 *
1014 * @attention Updating the list and retrieving information from it is not thread safe.
1015 * Therefore accessing it from different threads shall be avoided or synchronized.
1016 *
1017 * @param[in] index The index of the adapter in the adapter list..
1018 *
1019 * @param[out] name Will contain the name of the adapter, afterwards.
1020 *
1021 * @return
1022 * Status | Description
1023 * ---------------------------------------------- | ------------------------------------------------------------------
1024 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1025 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
1026 * @ref BRAWCAP_STATUS_ERROR_PARAM_OUT_OF_RANGE | Specified index exceeds adapter list length.
1027 */
1030
1031/**
1032 * @brief Registers the calling process for receiving adapter change notifications.
1033 *
1034 * The given callback function will be called each time a adapter change is recognized by bRAWcap for any of the
1035 * supported adapters on the current machine.
1036 *
1037 * @attention Blocking for long periods within the callback function can lead to incorrect behavior
1038 * and should be avoided.
1039 * If you need to process a lot on adapter changes it is recommended to do the processing in
1040 * another thread rather than directly within the callback.
1041 *
1042 * @note Calls to the registered callback function are serialized.
1043 * This means that the callback can not be called in parallel and
1044 * one call has to be finished before another one is received.
1045 *
1046 * @note Each process can only register for notifications once.
1047 *
1048 * @param[in] callback Function pointer to the callback function which should be executed each time
1049 * a adapter change is registered.
1050 *
1051 * @param[in] pUser Pointer to a user defined context.
1052 * This allows access to user specific data within the callback.
1053 *
1054 * @return
1055 * Status | Description
1056 * ---------------------------------------------- | ------------------------------------------------------------------
1057 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1058 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
1059 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1060 * @ref BRAWCAP_STATUS_INFO_ALREADY_REGISTERED | Calling process has already registered for this notification.
1061 */
1064
1065/**
1066 * @brief Unregisters the calling process from receiving adapter change notifications.
1067 *
1068 * @return
1069 * Status | Description
1070 * ---------------------------------------------- | ------------------------------------------------------------------
1071 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1072 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1073 * @ref BRAWCAP_STATUS_INFO_NOT_REGISTERED | Calling process was not registered for this notification.
1074 */
1077
1078/**
1079 * @brief Registers the specified handle for receiving adapter change notifications.
1080 *
1081 * This registration only receives adapter change notifications related to the underlying adapter of the given
1082 * bRAWcap handle.
1083 * Whereas @ref brawcap_adapter_notify_register notifies about adapter changes for all supported adapters on the
1084 * current machine.
1085 *
1086 * Each bRAWcap handle can register for this notification once.
1087 *
1088 * @attention Blocking for long periods within the callback function can lead to incorrect behavior
1089 * and should be avoided. If you need to process a lot on adapter changes it is recommended to do the processing in
1090 * another thread rather than directly within the callback.
1091 *
1092 * @note Calls to the registered callback function are serialized.
1093 * This means that the callback can not be called in parallel and
1094 * one call has to be finished before another one is received.
1095 *
1096 * @param[in] pHandle Handle to register for adapter notifications.
1097 *
1098 * @param[in] pUser Pointer to a user defined context.
1099 * This allows access to user specific data within the callback.
1100 *
1101 * @param[in] callback Function pointer to the callback function which should be executed each time
1102 * a adapter change is registered.
1103 *
1104 * @return
1105 * Status | Description
1106 * ---------------------------------------------- | ------------------------------------------------------------------
1107 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1108 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
1109 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1110 * @ref BRAWCAP_STATUS_INFO_ALREADY_REGISTERED | Specified handle has already registered for this notification.
1111 */
1114 brawcap_adapter_notify_handle_callback_t const callback, void* const pUser);
1115
1116/**
1117 * @brief Unregisters the specified handle from receiving adapter change notifications.
1118 *
1119 * @param[in] pHandle Handle to unregister for adapter notifications.
1120 *
1121 * @return
1122 * Status | Description
1123 * ---------------------------------------------- | ------------------------------------------------------------------
1124 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1125 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
1126 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1127 * @ref BRAWCAP_STATUS_INFO_NOT_REGISTERED | Specified handle was not registered for this notification.
1128 */
1131
1132/**
1133 * @brief Reads out the adapter name of the specified adapter.
1134 *
1135 * @param[in] pHandle The bRAWcap handle to read from.
1136 *
1137 * @param[out] name Will contain the adapter name, afterwards.
1138 *
1139 * @return
1140 * Status | Description
1141 * ---------------------------------------------- | ------------------------------------------------------------------
1142 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1143 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
1144 */
1147
1148/**
1149 * @brief Reads out the currently set adapter friendly name for the specified adapter.
1150 *
1151 * @param[in] name Name of the adapter.
1152 *
1153 * @param[out] friendlyName Pointer to a buffer which will contain the currently set adapter friendly name, afterwards.
1154 * This parameter can be NULL.
1155 * If it is NULL the function will set the required buffer length in pLength and
1156 * return @ref BRAWCAP_STATUS_ERROR_OVERRUN.
1157 *
1158 * @param[inout] pLength Length of the provided buffer.
1159 * If the specified length is to short,
1160 * it will be set to the required length and @ref BRAWCAP_STATUS_ERROR_OVERRUN is returned.
1161 *
1162 * @return
1163 * Status | Description
1164 * ---------------------------------------------- | ------------------------------------------------------------------
1165 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1166 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1167 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1168 * @ref BRAWCAP_STATUS_ERROR_NOT_FOUND | Adapter name not found/not available.
1169 * @ref BRAWCAP_STATUS_ERROR_OVERRUN | Given buffer length was to short.
1170 */
1172brawcap_adapter_friendly_name(const brawcap_adapter_name_t name, char* const friendlyName, UINT32* const pLength);
1173
1174/**
1175 * @brief Reads out the currently set friendly name of the specified adapter.
1176 *
1177 * @param[in] pHandle The bRAWcap handle to read from.
1178 *
1179 * @param[out] friendlyName Pointer to a buffer which will contain the currently set friendly name, afterwards.
1180 * This parameter can be NULL.
1181 * If it is NULL the function will set the required buffer length in pLength and
1182 * return @ref BRAWCAP_STATUS_ERROR_OVERRUN.
1183 *
1184 * @param[inout] pLength Length of the provided buffer.
1185 * If the specified length is to short,
1186 * it will be set to the required length and @ref BRAWCAP_STATUS_ERROR_OVERRUN is returned.
1187 *
1188 * @return
1189 * Status | Description
1190 * ---------------------------------------------- | -----------------------------------------------------------
1191 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1192 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1193 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1194 * @ref BRAWCAP_STATUS_ERROR_OVERRUN | Given buffer length was to short.
1195 */
1197brawcap_adapter_friendly_name_by_handle(brawcap_handle_t* const pHandle, char* const friendlyName,
1198 UINT32* const pLength);
1199
1200/**
1201 * @brief Reads out the description of the specified adapter.
1202 *
1203 * @note Adapter descriptions are set depending on the loaded network adapter driver.
1204 * This means it will not change as long as the network driver is not changed.
1205 *
1206 * @param[in] name Name of the adapter.
1207 *
1208 * @param[out] description Pointer to a buffer which will contain the description, afterwards.
1209 * This parameter can be NULL.
1210 * If it is NULL the function will set the required buffer length in pLength and
1211 * return @ref BRAWCAP_STATUS_ERROR_OVERRUN.
1212 *
1213 * @param[inout] pLength Length of the provided buffer.
1214 * If the specified length is to short,
1215 * it will be set to the required length and @ref BRAWCAP_STATUS_ERROR_OVERRUN is returned.
1216 *
1217 * @return
1218 * Status | Description
1219 * ---------------------------------------------- | -----------------------------------------------------------
1220 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1221 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1222 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1223 * @ref BRAWCAP_STATUS_ERROR_NOT_FOUND | Adapter name not found/not available.
1224 * @ref BRAWCAP_STATUS_ERROR_OVERRUN | Given buffer length was to short.
1225 */
1227brawcap_adapter_description(const brawcap_adapter_name_t name, char* const description, UINT32* const pLength);
1228
1229/**
1230 * @brief Reads out the description of a network adapter based on the specified adapter.
1231 *
1232 * @note Adapter descriptions are set depending on the loaded network adapter driver.
1233 * This means it will not change as long as the network driver is not changed.
1234 *
1235 * @param[in] pHandle The bRAWcap handle to read from.
1236 *
1237 * @param[out] description Pointer to a buffer which will contain the description, afterwards.
1238 * This parameter can be NULL.
1239 * If it is NULL the required buffer length will be set for pLength and the
1240 * function will return @ref BRAWCAP_STATUS_ERROR_OVERRUN.
1241 *
1242 * @param[inout] pLength Length of the provided buffer.
1243 * If the specified length is to short,
1244 * it will be set to the required length and @ref BRAWCAP_STATUS_ERROR_OVERRUN is returned.
1245 *
1246 * @return
1247 * Status | Description
1248 * ---------------------------------------------- | -----------------------------------------------------------
1249 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1250 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1251 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1252 * @ref BRAWCAP_STATUS_ERROR_OVERRUN | Given buffer length was to short.
1253 */
1255brawcap_adapter_description_by_handle(brawcap_handle_t* const pHandle, char* const description, UINT32* const pLength);
1256
1257/**
1258 * @brief Reads out the currently set IPv4 address of the specified adapter.
1259 *
1260 * @param[in] name Name of the adapter.
1261 *
1262 * @param[out] pIpv4 Will contain the currently set IPv4 address, afterwards.
1263 *
1264 * @return
1265 * Status | Description
1266 * ---------------------------------------------- | -----------------------------------------------------------
1267 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1268 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1269 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1270 * @ref BRAWCAP_STATUS_ERROR_NOT_FOUND | Adapter name not found/not available.
1271 */
1274
1275/**
1276 * @brief Reads out the currently set IPv4 address of the specified adapter.
1277 *
1278 * @param[in] pHandle The bRAWcap handle to read from.
1279 *
1280 * @param[out] pIpv4 Will contain the currently set IPv4 address, afterwards.
1281 *
1282 * @return
1283 * Status | Description
1284 * ---------------------------------------------- | -----------------------------------------------------------
1285 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1286 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1287 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1288 */
1291
1292/**
1293 * @brief Reads out the currently set IPv6 address of the specified adapter.
1294 *
1295 * @param[in] name Name of the adapter.
1296 *
1297 * @param[out] pIpv6 Will contain the currently set IPv6 address, afterwards.
1298 *
1299 * @return
1300 * Status | Description
1301 * ---------------------------------------------- | -----------------------------------------------------------
1302 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1303 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1304 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1305 * @ref BRAWCAP_STATUS_ERROR_NOT_FOUND | Adapter name not found/not available.
1306 */
1309
1310/**
1311 * @brief Reads out the currently set IPv6 address of the specified adapter.
1312 *
1313 * @param[in] pHandle The bRAWcap handle to read from.
1314 *
1315 * @param[out] pIpv6 Will contain the currently set IPv6 address, afterwards.
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 */
1326
1327/**
1328 * @brief Reads out the MAC address of the specified adapter.
1329 *
1330 * @param[in] name Name of the adapter.
1331 *
1332 * @param[out] mac Will contain the MAC address, afterwards.
1333 *
1334 * @return
1335 * Status | Description
1336 * ---------------------------------------------- | -----------------------------------------------------------
1337 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1338 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1339 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1340 * @ref BRAWCAP_STATUS_ERROR_NOT_FOUND | Adapter name not found/not available.
1341 */
1344
1345/**
1346 * @brief Reads out the MAC address of the specified adapter.
1347 *
1348 * @param[in] pHandle The bRAWcap handle to read from.
1349 *
1350 * @param[out] mac Will contain the MAC address, afterwards.
1351 *
1352 * @return
1353 * Status | Description
1354 * ---------------------------------------------- | -----------------------------------------------------------
1355 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1356 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1357 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1358 */
1361
1362/**
1363 * @brief Reads out the current receive speed of the specified adapter.
1364 *
1365 * @param[in] name Name of the adapter.
1366 *
1367 * @param[out] pSpeed Will contain the current receive speed, afterwards.
1368 *
1369 * @return
1370 * Status | Description
1371 * ---------------------------------------------- | -----------------------------------------------------------
1372 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1373 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1374 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1375 * @ref BRAWCAP_STATUS_ERROR_NOT_FOUND | Adapter name not found/not available.
1376 */
1379
1380/**
1381 * @brief Reads out the current receive speed of the specified adapter.
1382 *
1383 * @param[in] pHandle The bRAWcap handle to read from.
1384 *
1385 * @param[out] pSpeed Will contain the current receive speed, afterwards.
1386 *
1387 * @return
1388 * Status | Description
1389 * ---------------------------------------------- | -----------------------------------------------------------
1390 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1391 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1392 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1393 */
1396
1397/**
1398 * @brief Reads out the current transmit speed of the specified adapter.
1399 *
1400 * @param[in] name Name of the adapter.
1401 *
1402 * @param[out] pSpeed Will contain the current transmit speed, afterwards.
1403 *
1404 * @return
1405 * Status | Description
1406 * ---------------------------------------------- | -----------------------------------------------------------
1407 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1408 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1409 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1410 * @ref BRAWCAP_STATUS_ERROR_NOT_FOUND | Adapter name not found/not available.
1411 */
1414
1415/**
1416 * @brief Reads out the current transmit speed of the specified adapter.
1417 *
1418 * @param[in] pHandle The bRAWcap handle to read from.
1419 *
1420 * @param[out] pSpeed Will contain the current transmit speed, afterwards.
1421 *
1422 * @return
1423 * Status | Description
1424 * ---------------------------------------------- | -----------------------------------------------------------
1425 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1426 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1427 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1428 */
1431
1432/**
1433 * @brief Reads out the current connection state of the specified adapter.
1434 *
1435 * @param[in] name Name of the adapter.
1436 *
1437 * @param[out] pConnection Will contain the current connection state, afterwards.
1438 *
1439 * @return
1440 * Status | Description
1441 * ---------------------------------------------- | -----------------------------------------------------------
1442 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1443 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1444 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1445 * @ref BRAWCAP_STATUS_ERROR_NOT_FOUND | Adapter name not found/not available.
1446 */
1449
1450/**
1451 * @brief Reads out the current connection state of the specified adapter.
1452 *
1453 * @param[in] pHandle The bRAWcap handle to read from.
1454 *
1455 * @param[out] pConnection Will contain the current connection state, afterwards.
1456 *
1457 * @return
1458 * Status | Description
1459 * ---------------------------------------------- | -----------------------------------------------------------
1460 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1461 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1462 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1463 */
1466 brawcap_adapter_connection_state_t* const pConnection);
1467
1468/**
1469 * @brief Reads out the current operation state of the specified adapter.
1470 *
1471 * @param[in] name Name of the adapter.
1472 *
1473 * @param[out] pOperation Will contain the current operation state, afterwards.
1474 *
1475 * @return
1476 * Status | Description
1477 * ---------------------------------------------- | -----------------------------------------------------------
1478 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1479 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1480 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1481 * @ref BRAWCAP_STATUS_ERROR_NOT_FOUND | Adapter name not found/not available.
1482 */
1485
1486/**
1487 * @brief Reads out the current operation state of the specified adapter.
1488 *
1489 * @param[in] pHandle The bRAWcap handle to read from.
1490 *
1491 * @param[out] pOperation Will contain the current operation state, afterwards.
1492 *
1493 * @return
1494 * Status | Description
1495 * ---------------------------------------------- | -----------------------------------------------------------
1496 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1497 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1498 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1499 */
1502 brawcap_adapter_operation_state_t* const pOperation);
1503
1504/**
1505 * @brief Reads out the configured MTU of the specified adapter.
1506 *
1507 * @param[in] name Name of the adapter.
1508 *
1509 * @param[out] pMtu Will contain the configured MTU, afterwards.
1510 *
1511 * @return
1512 * Status | Description
1513 * ---------------------------------------------- | -----------------------------------------------------------
1514 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1515 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1516 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1517 * @ref BRAWCAP_STATUS_ERROR_NOT_FOUND | Adapter name not found/not available.
1518 */
1521
1522/**
1523 * @brief Reads out the configured MTU of the specified adapter.
1524 *
1525 * @param[in] pHandle The bRAWcap handle to read from.
1526 *
1527 * @param[out] pMtu Will contain the configured MTU, afterwards.
1528 *
1529 * @return
1530 * Status | Description
1531 * ---------------------------------------------- | -----------------------------------------------------------
1532 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1533 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1534 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Not available in demo mode (no license).
1535 */
1538
1539/**@}*/
1540#endif
1541
1542/************************************************ RECEIVE ************************************************************/
1543#if 1
1544/**
1545 * @addtogroup brawcap_receive
1546 * @{
1547 */
1548
1549/********************************************** RECEIVE FILTER *******************************************************/
1550#if 1
1551/**
1552 * @addtogroup brawcap_filter
1553 * @{
1554 */
1555
1556/**
1557 * @brief Creates a new filter.
1558 *
1559 * The created filter can be used for filtering received packets by applying it to a bRAWcap handle with
1560 * @ref brawcap_rx_filter_set.
1561 *
1562 * If a created filter is not required anymore it should be freed with @ref brawcap_filter_free.
1563 *
1564 * @note Currently only the @ref BRAWCAP_FILTER_TYPE_BYTE_MASK filter type is supported.
1565 * Support for @ref BRAWCAP_FILTER_TYPE_BPF may be added later on.
1566 *
1567 * @param[in] pFilter Will contain the new created filter.
1568 *
1569 * @param[in] type Specifies the type of the created filter.
1570 *
1571 * @return
1572 * Status | Description
1573 * ---------------------------------------------- | ------------------------------------------------------------------
1574 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1575 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
1576 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Specified filter type is not supported.
1577 * @ref BRAWCAP_STATUS_ERROR_FAILED | System error occurred (e.g. out of memory).
1578 */
1581
1582/**
1583 * @brief Frees the specified filter.
1584 * When this function is called the given filter becomes invalid and it´s memory will be released.
1585 *
1586 * @warning Freeing a filter is not thread safe and the user is responsible for synchronization.
1587 *
1588 * @param[in] pFilter The filter to be freed.
1589 *
1590 * @return
1591 * Status | Description
1592 * ---------------------------------------------- | ------------------------------------------------------------------
1593 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1594 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
1595 */
1598
1599/**
1600 * @brief Reads out the type for the specified filter.
1601 *
1602 * @param[in] pFilter The filter to read from.
1603 *
1604 * @param[out] pType Will contain the filter type, afterwards.
1605 *
1606 * @return
1607 * Status | Description
1608 * ---------------------------------------------- | ------------------------------------------------------------------
1609 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1610 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
1611 */
1614
1615/**
1616 * @brief Sets the filter parameters for the specified filter.
1617 *
1618 * @note Changes will only effect after applying the modified filter to a handle with @ref brawcap_rx_filter_set.
1619 *
1620 * @param[in] pFilter The filter to be modified.
1621 *
1622 * @param[in] offset Byte offset of the filter.
1623 * This value specifies at which packet byte offset the first filter byte shall be applied.
1624 *
1625 * @param[in] length Byte length of the filter.
1626 * Specifies the number of bytes used by the filter.
1627 * This value is limited to @ref BRAWCAP_FILTER_BYTE_MAX_LENGTH.
1628 *
1629 * @param[in] mask The byte mask for the filter.
1630 * This is a fixed size byte array.
1631 * Set the byte values to the filter you want to apply.
1632 * Only bytes up to the specified filter length are used and following bytes will be ignored.
1633 *
1634 * @param[in] ignoreBits A fixed size bitfield byte array.
1635 * The bytes in this array has to be interpreted/used as bitfields.
1636 * This allows to select if a single bit at the corresponding mask position shall be ignored.
1637 * To ignore the value of a bit set it´s value to 1.
1638 * Like the mask, only bytes up to the specified filter length are used and following bytes will be ignored.
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 pointer parameters was invalid.
1645 * @ref BRAWCAP_STATUS_ERROR_INVALID_PARAM | Specified filter is not of type @ref BRAWCAP_FILTER_TYPE_BYTE_MASK.
1646 * @ref BRAWCAP_STATUS_ERROR_PARAM_OUT_OF_RANGE | Specified offset+length exceeds @ref BRAWCAP_FILTER_BYTE_MAX_LENGTH.
1647 */
1651 const brawcap_filter_ignore_bits_array_t ignoreBits);
1652
1653/**
1654 * @brief Reads out the filter mask parameters for the specified filter.
1655 *
1656 * @param[in] pFilter The filter to read from.
1657 *
1658 * @param[out] pOffset Will contain the filter byte offset, afterwards.
1659 *
1660 * @param[out] pLength Will contain the filter byte length, afterwards.
1661 *
1662 * @param[out] pMask Will contain the filter mask bytes, afterwards.
1663 *
1664 * @param[out] pIgnoreBits Will contain the filter bits to ignore, afterwards
1665 *
1666 * @return
1667 * Status | Description
1668 * ---------------------------------------------- | ------------------------------------------------------------------
1669 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1670 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
1671 * @ref BRAWCAP_STATUS_ERROR_INVALID_PARAM | Specified filter is not of type @ref BRAWCAP_FILTER_TYPE_BYTE_MASK.
1672 */
1675 brawcap_filter_byte_length_t* const pLength, brawcap_filter_mask_array_t* const pMask,
1676 brawcap_filter_ignore_bits_array_t* const pIgnoreBits);
1677
1678/**
1679 * @brief Sets the specified filter to active.
1680 *
1681 * @note Changes will only effect after applying the modified filter to a handle with @ref brawcap_rx_filter_set.
1682 *
1683 * @param[in] pFilter The filter to be modified.
1684 *
1685 * @return
1686 * Status | Description
1687 * ---------------------------------------------- | ------------------------------------------------------------------
1688 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1689 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
1690 */
1693
1694/**
1695 * @brief Sets the specified filter to inactive.
1696 *
1697 * @note Changes will only effect after applying the modified filter to a handle with @ref brawcap_rx_filter_set.
1698 *
1699 * @param[in] pFilter The filter to be modified.
1700 *
1701 * @return
1702 * Status | Description
1703 * ---------------------------------------------- | ------------------------------------------------------------------
1704 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1705 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
1706 */
1709
1710/**
1711 * @brief Reads out the current activation state of the specified filter.
1712 *
1713 * @param[in] pFilter The filter to read from.
1714 *
1715 * @param[out] pActive Will contain the activation state, afterwards.
1716 *
1717 * @return
1718 * Status | Description
1719 * ---------------------------------------------- | ------------------------------------------------------------------
1720 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1721 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
1722 */
1724brawcap_filter_is_activated(brawcap_filter_t* const pFilter, BOOLEAN* const pActive);
1725
1726/**
1727 * @brief Sets the bytes to capture of the specified filter.
1728 *
1729 * @note Changes will only effect after applying the modified filter to a handle with @ref brawcap_rx_filter_set.
1730 *
1731 * @param[in] pFilter The filter to be modified.
1732 *
1733 * @param[in] offset The byte offset, from packet payload beginning, to begin capturing the payload bytes.
1734 *
1735 * @param[in] length The number of bytes to be captured - beginning at offset.
1736 *
1737 * @return
1738 * Status | Description
1739 * ---------------------------------------------- | ------------------------------------------------------------------
1740 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1741 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
1742 * @ref BRAWCAP_STATUS_ERROR_PARAM_OUT_OF_RANGE | Specified offset+length exceeds @ref BRAWCAP_PACKET_SIZE_MAX.
1743 */
1746 const brawcap_packet_size_t length);
1747
1748/**
1749 * @brief Reads out the configured bytes to capture of the specified filter.
1750 *
1751 * @param[in] pFilter The filter to read from.
1752 *
1753 * @param[out] pOffset Will contain the byte offset of the bytes to capture, afterwards.
1754 *
1755 * @param[out] pLength Will contain the number of bytes to capture, afterwards.
1756 *
1757 * @return
1758 * Status | Description
1759 * ---------------------------------------------- | ------------------------------------------------------------------
1760 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1761 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
1762 */
1765 brawcap_packet_size_t* const pLength);
1766
1767/**
1768 * @brief Specifies if packets which matched the specified filter should be indicated to the network stack.
1769 *
1770 * @note Changes will only effect after applying the modified filter to a handle with @ref brawcap_rx_filter_set.
1771 *
1772 * @param[in] pFilter The filter to be modified.
1773 *
1774 * @param[in] indicate Flag specifying the network stack indication.
1775 * If true filtered packets are forwarded to the network stack.
1776 * If false filtered packets are not forwarded to the network stack, they are only visible for bRAWcap handles.
1777 *
1778 * @return
1779 * Status | Description
1780 * ---------------------------------------------- | ------------------------------------------------------------------
1781 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1782 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
1783 */
1785brawcap_filter_indicate_set(brawcap_filter_t* const pFilter, const BOOLEAN indicate);
1786
1787/**
1788 * @brief Reads out the current network stack indication state of the specified filter.
1789 *
1790 * @param[in] pFilter The filter to read from.
1791 *
1792 * @param[out] pIndicate Will contain the current network stack indication, afterwards.
1793 *
1794 * @return
1795 * Status | Description
1796 * ---------------------------------------------- | ------------------------------------------------------------------
1797 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1798 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid.
1799 */
1801brawcap_filter_indicate_get(brawcap_filter_t* const pFilter, BOOLEAN* const pIndicate);
1802
1803/**@}*/
1804#endif
1805
1806/**
1807 * @brief Receives a single packet from the specified handle.
1808 *
1809 * The caller must provide a valid packet were bRAWcap will store the received data.
1810 * To create a packet use @ref brawcap_packet_create or use a buffered packet which was returned by a
1811 * valid buffer with @ref brawcap_buffer_at_index.
1812 *
1813 * @note Parallel receives per handle are not allowed. This means that if there is any other receive pending on the
1814 * handle each further initiated receive will fail until the pending operation has finished.
1815 *
1816 * @param[in] pHandle bRAWcap handle to receive from.
1817 *
1818 * @param[out] pPacket Packet were the received data will be stored.
1819 *
1820 * @return
1821 * Status | Description
1822 * ---------------------------------------------- | -----------------------------------------------------------
1823 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1824 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1825 * @ref BRAWCAP_STATUS_WARNING_PENDING | Another receive is still pending/active.
1826 * @ref BRAWCAP_STATUS_ERROR_DRIVER_NOT_AVAILABLE | bRAWcap driver is not active (anymore) on the adapter.
1827 * @ref BRAWCAP_STATUS_WARNING_DEMO_MODE | Running in demo mode (no license).
1828 * @ref BRAWCAP_STATUS_ERROR_DRIVER_IO_FAILED | Communicating with bRAWcap driver failed.
1829 * @ref BRAWCAP_STATUS_INFO_NO_DATA | Returned without any data received (due to timeout).
1830 */
1833
1834/**
1835 * @brief Starts the internal receive loop.
1836 *
1837 * To receive data using this method it is necessary to attach memory to the
1838 * bRAWcap handle were received data can be stored. This can be done by attaching (with @ref brawcap_rx_buffer_attach)
1839 * a previously created bRAWcap packet buffer (with @ref brawcap_buffer_create).
1840 *
1841 * When a reception has finished (due to timeout, min packets or full buffer) the receive callback will be called
1842 * for this handle (@ref brawcap_rx_callback_t). In this callback the user application can do it´s post
1843 * processing on the received data. If the user application does not detach the buffer
1844 * (with @ref brawcap_rx_buffer_detach) it will be reused for receiving after callback has completed.
1845 *
1846 * The user application should do it´s post processing anyway, as fast as possible. Depending on the current
1847 * bandwidth the attached buffers may be filled up very fast. If the user application takes to long it
1848 * will lead to a bottleneck in the reception and the driver runs out of resources. This may result in performance
1849 * degradation or packet loss.
1850 *
1851 * It is possible to attach more than only one buffer to a single handle. This ensures that the bRAWcap driver can
1852 * toggle the buffers during the reception. This reduces the time gap the driver has to buffer data internally (because
1853 * there is no user buffer available). With more than one buffer the driver can still fill up another buffer while the
1854 * user application does it´s post processing. Therefore in general, using more than one buffer increases the
1855 * performance.
1856 *
1857 * @note Due to the focus on optimized throughput with minimal CPU load bRAWcap does not fill up the packets in the
1858 * buffer with the same sequence they were received by the adapter.
1859 * Here we want to give some additional information on the topic of "packet sequence/timestamp":
1860 * - First of all it should be known that the receive sequence may not be equal to the sending sequence.
1861 * Due to several senders or some network managers in between (switches and so on...).
1862 * For any protocols which require a ordered packet stream, there will be at least one field in the packet
1863 * payload which allows to sort the packets on the receiver side.
1864 * This is a "higher" layer topic and not part of bRAWcap.
1865 * - With the bRAWcap supported timestamp mechanisms it is possible to sort the received packets corresponding to
1866 * their receive timestamps. But keep in mind that only the @ref BRAWCAP_TIMESTAMP_MODE_ADAPTER_HARDWARE guarantees
1867 * that the receive timestamps really match the received packet sequence on the adapter. To use the named timestamp
1868 * mechanism, the underlying network adapter must support it. Any other timestamp is generated by software. Windows
1869 * is not a realtime operation system, and therefore due to multithreading, scheduling (...) it could happen
1870 * that some packets are processed before other packets which was received earlier.
1871 * Especially the Windows network stack feature called "receive side scaling" can also increase the issue
1872 * of incorrect packet sequences.
1873 *
1874 * @invariant The user parameter allows access to user defined context.
1875 * The given pointer is not used and validated by bRAWcap. Therefore the user is responsible for validating
1876 * the context in the callback before accessing it.
1877 *
1878 * @attention After starting receive @ref brawcap_rx_packet can not be used until you stop the receive
1879 * with @ref brawcap_rx_stop, because parallel receives are not allowed.
1880 *
1881 * @param[in] pHandle bRAWcap handle to receive from.
1882 *
1883 * @param[in] callback Function pointer to user application receive callback.
1884 *
1885 * @param[in] pUser Pointer to a user defined context. Can be NULL if no user context is required.
1886 *
1887 * @param[in] indicateNoPackets Specifies if callback is called even without any received data.
1888 *
1889 * @return
1890 * Status | Description
1891 * ---------------------------------------------- | -----------------------------------------------------------
1892 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1893 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1894 * @ref BRAWCAP_STATUS_WARNING_PENDING | Another receive is pending or reception is already started.
1895 */
1897brawcap_rx_start(brawcap_handle_t* const pHandle, brawcap_rx_callback_t const callback, void* const pUser,
1898 const BOOLEAN indicateNoPackets);
1899
1900/**
1901 * @brief Stops the internal receive loop.
1902 *
1903 * @param[in] pHandle bRAWcap handle to stop reception.
1904 *
1905 * @return
1906 * Status | Description
1907 * ---------------------------------------------- | -----------------------------------------------------------
1908 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1909 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1910 * @ref BRAWCAP_STATUS_INFO_NOT_RUNNING | There was no receive running.
1911 */
1914
1915/**
1916 * @brief Attaches the specified bRAWcap packet buffer to the specified handle.
1917 *
1918 * After attaching a packet buffer to a handle it will be used for receiving data on that handle.
1919 * Data is only received if the internal receive loop was started/is running (with @ref brawcap_rx_start).
1920 *
1921 * The buffer is locked until:
1922 * - It is detached from the handle with @ref brawcap_rx_buffer_detach.
1923 * - A receive has finished and the receive callback is called (buffer is not locked during callback execution).
1924 *
1925 * @note A buffer can be attached only once and is than locked down by the handle it is attached to.
1926 * This means that it has to be detached before it can be used again for another handle.
1927 *
1928 * @param[in] pHandle bRAWcap handle for attaching the buffer.
1929 *
1930 * @param[in] pBuffer Packet buffer to be attached.
1931 *
1932 * @return
1933 * Status | Description
1934 * ---------------------------------------------- | -----------------------------------------------------------
1935 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1936 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1937 * @ref BRAWCAP_STATUS_ERROR_IN_USE | The buffer is already in use / locked down by another operation.
1938 * @ref BRAWCAP_STATUS_WARNING_LIMIT_REACHED | Limitation of buffer per handle reached (@ref BRAWCAP_RX_BUFFERS_PER_HANDLE_MAX)
1939 */
1942
1943/**
1944 * @brief Detaches the specified bRAWcap packet buffer from the specified handle.
1945 *
1946 * After detaching a buffer it is unlocked and can be accessed/modified.
1947 * It can also be reused for another operation or freed with @ref brawcap_buffer_free if it is not required anymore.
1948 *
1949 * @param[in] pHandle bRAWcap handle from which the buffer is to be detached.
1950 *
1951 * @param[in] pBuffer Packet buffer to be detached.
1952 *
1953 * @return
1954 * Status | Description
1955 * ---------------------------------------------- | -----------------------------------------------------------
1956 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1957 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1958 * @ref BRAWCAP_STATUS_INFO_NOT_ATTACHED | The buffer was not attached.
1959 */
1962
1963/**
1964 * @brief Sets the receive direction for the specified handle.
1965 *
1966 * Possible directions are:
1967 * - @ref BRAWCAP_RX_DIRECTION_UNKNOWN
1968 * - @ref BRAWCAP_RX_DIRECTION_IN
1969 * - @ref BRAWCAP_RX_DIRECTION_OUT
1970 * - @ref BRAWCAP_RX_DIRECTION_BOTH
1971 *
1972 * @param[in] pHandle bRAWcap handle to be configured.
1973 *
1974 * @param[in] direction The direction to be set.
1975 *
1976 * @return
1977 * Status | Description
1978 * ---------------------------------------------- | -----------------------------------------------------------
1979 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1980 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1981 * @ref BRAWCAP_STATUS_ERROR_DRIVER_IO_FAILED | Communicating with bRAWcap driver failed.
1982 */
1985
1986/**
1987 * @brief Reads out the currently configured receive direction of the specified handle.
1988 *
1989 * @param[in] pHandle bRAWcap handle to read from.
1990 *
1991 * @param[out] pDirection Will contain the currently configured receive direction, afterwards.
1992 *
1993 * @return
1994 * Status | Description
1995 * ---------------------------------------------- | -----------------------------------------------------------
1996 * @ref BRAWCAP_STATUS_SUCCESS | Success.
1997 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
1998 */
2001
2002/**
2003 * @brief Sets the minimum amount of packets to receive for the specified handle.
2004 *
2005 * This value influences how often the bRAWcap driver will return pending receives.
2006 * It forces the driver to stay in the request as long as not the minimum amount of packets were captured.
2007 * Setting a higher value here can reduce the overall system load but increases also the responsiveness/latency
2008 * when the packet was received by the adapter and the indication of the packet to the caller.
2009 * The initial/default value is set to @ref BRAWCAP_RX_COPY_PACKETS_DEFAULT.
2010 *
2011 * @invariant If high receive rates should be reached (and many packets coming in), a high value is preferred.
2012 * Otherwise if low latency is required the best effort would be to set this value to zero.
2013 *
2014 * @note Independent from this value the receive will at least return if it pends for 10 times the configured
2015 * receive timeout. This avoid infinite blocking (infinite blocking is only the possible if the receive timeout is zero).
2016 * If this value is set to zero it will always return after the first receive timeout.
2017 * And if the given buffer becomes filled up before the timeout is reached it will return when the buffer is full.
2018 *
2019 * @param[in] pHandle bRAWcap handle to be configured.
2020 *
2021 * @param[in] minPackets The minimum amount of packets to receive.
2022 *
2023 * @return
2024 * Status | Description
2025 * ---------------------------------------------- | -----------------------------------------------------------
2026 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2027 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2028 * @ref BRAWCAP_STATUS_ERROR_DRIVER_IO_FAILED | Communicating with bRAWcap driver failed.
2029 */
2032
2033/**
2034 * @brief Reads out the currently configured number of packets to receive for the specified handle.
2035 *
2036 * @param[in] pHandle bRAWcap handle to read from.
2037 *
2038 * @param[out] pMinPackets Will contain the configured minimum amount of packets per receive, afterwards.
2039 *
2040 * @return
2041 * Status | Description
2042 * ---------------------------------------------- | -----------------------------------------------------------
2043 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2044 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2045 */
2048
2049/**
2050 * @brief Configures the receive timeout for the specified handle.
2051 *
2052 * It´s guaranteed that receive functions will return at least after the specified timeout value,
2053 * if the configured amount of packets value @ref brawcap_rx_min_packets_t is reached before.
2054 * If the configured amount of packets are not reached until the timeout occurs, the driver will stay in the request
2055 * for up to 10 times of the specified timeout time until it final returns.
2056 * It is also possible to specify a timeout of zero. A timeout of zero is equivalent to "no timeout".
2057 *
2058 * @note Default timeout value is @ref BRAWCAP_RX_TIMEOUT_MS_DEFAULT.
2059 * And the max supported timeout is @ref BRAWCAP_RX_TIMEOUT_MS_MAX.
2060 *
2061 * @attention Be careful in using infinite timeouts.
2062 * It could lead to a endless blocking behaviour.
2063 * For example if there are no packets received which meet your configured filter on the underlying adapter.
2064 *
2065 * @param[in] pHandle bRAWcap handle to be configured.
2066 *
2067 * @param[in] timeout_ms Receive timeout in milliseconds to be set.
2068 *
2069 * @return
2070 * Status | Description
2071 * ---------------------------------------------- | -----------------------------------------------------------
2072 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2073 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2074 * @ref BRAWCAP_STATUS_ERROR_PARAM_OUT_OF_RANGE | The specified timeout value is invalid/out of range.
2075 * @ref BRAWCAP_STATUS_ERROR_DRIVER_IO_FAILED | Communicating with bRAWcap driver failed.
2076 */
2079
2080/**
2081 * @brief Reads out the currently configured receive timeout for the specified handle
2082 *
2083 * @param[in] pHandle bRAWcap handle to read from.
2084 *
2085 * @param[out] pTimeout_ms Will contain the configured receive timeout in milliseconds, afterwards.
2086 *
2087 * @return
2088 * Status | Description
2089 * ---------------------------------------------- | -----------------------------------------------------------
2090 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2091 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2092 */
2095
2096/**
2097 * @brief Sets the specified filter to the specified handle.
2098 *
2099 * For more information on filters see @ref brawcap_filter_t.
2100 *
2101 * @note Each handle can have exactly one filter applied.
2102 * If several filters shall be applied to the same adapter,
2103 * it is required to open several bRAWcap handles to the same adapter.
2104 *
2105 * @param[in] pHandle bRAWcap handle to be modified.
2106 *
2107 * @param[in] pFilter The filter to set.
2108 *
2109 * @return
2110 * Status | Description
2111 * ---------------------------------------------- | -----------------------------------------------------------
2112 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2113 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2114 * @ref BRAWCAP_STATUS_ERROR_DRIVER_IO_FAILED | Communicating with bRAWcap driver failed.
2115 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Specified filter type is not available.
2116 */
2118brawcap_rx_filter_set(brawcap_handle_t* const pHandle, const brawcap_filter_t* const pFilter);
2119
2120/**
2121 * @brief Reads out the currently configured filter for the specified handle.
2122 *
2123 * @param[in] pHandle bRAWcap handle to read from.
2124 *
2125 * @param[out] pFilter Will contain the currently configured filter, afterwards.
2126 *
2127 * @return
2128 * Status | Description
2129 * ---------------------------------------------- | -----------------------------------------------------------
2130 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2131 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2132 */
2135
2136/**
2137 * @brief Sets the current promiscuous mode flag for the specified handle.
2138 *
2139 * If a adapter is set into promiscuous mode it receives not only packages which directly address the adapter.
2140 * This can be used for recording/sniffing purposes but increases the local system load.
2141 * Promiscuous mode is a network adapter feature and which can only be modified by bRAWcap.
2142 * Therefore it is not specific to a bRAWcap handle. Instead it is a per adapter setting which can also be
2143 * modified from another application.
2144 *
2145 * @note Promiscuous mode will be reset automatically upon deleting the corresponding handle.
2146 * Which means if it was activated due to the bRAWcap handle it will be disabled again when the handle is closed.
2147 *
2148 * @attention Because of the per adapter scope, promiscuous mode can not explicitly modified by bRAWcap.
2149 * Instead if at least one application or another bRAWcap handle activated it, it will stay enabled until the last
2150 * application/handle which has activated it, is closed or deactivates it again.
2151 *
2152 * @param[in] pHandle bRAWcap handle to be modified.
2153 *
2154 * @param[in] enable Promiscuous mode state to be set.
2155 *
2156 * @return
2157 * Status | Description
2158 * ---------------------------------------------- | -----------------------------------------------------------
2159 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2160 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2161 * @ref BRAWCAP_STATUS_ERROR_DRIVER_IO_FAILED | Communicating with bRAWcap driver failed.
2162 */
2164brawcap_rx_promiscuous_mode_set(brawcap_handle_t* const pHandle, const BOOLEAN enable);
2165
2166/**
2167 * @brief Reads out the current promiscuous mode state for the specified handle.
2168 *
2169 * Additionally to the promiscuous state of the handle itself it also reads the current promiscuous state of to the
2170 * underlying adapter.
2171 *
2172 * @param[in] pHandle bRAWcap handle to read from.
2173 *
2174 * @param[out] pEnabled Will contain the current promiscuous mode state of the handle, afterwards.
2175 *
2176 * @param[out] pEnabledAdapter Will contain the current promiscuous mode state of the underlying adapter, afterwards.
2177 *
2178 * @return
2179 * Status | Description
2180 * ---------------------------------------------- | -----------------------------------------------------------
2181 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2182 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2183 * @ref BRAWCAP_STATUS_ERROR_DRIVER_IO_FAILED | Communicating with bRAWcap driver failed.
2184 */
2186brawcap_rx_promiscuous_mode_get(brawcap_handle_t* const pHandle, BOOLEAN* const pEnabled,
2187 BOOLEAN* const pEnabledAdapter);
2188
2189/**
2190 * @brief Reads out the available receive timestamp modes for the specified handle.
2191 *
2192 * Some of the timestamp capabilites depend on the features provided by the underlying adapter.
2193 * Those modes are named with "adapter".
2194 *
2195 * @param[in] pHandle bRAWcap handle to read from.
2196 *
2197 * @param[out] pCapabilities Will contain the available receive timestamp modes, afterwards.
2198 *
2199 * @return
2200 * Status | Description
2201 * ---------------------------------------------- | -----------------------------------------------------------
2202 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2203 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2204 * @ref BRAWCAP_STATUS_ERROR_DRIVER_IO_FAILED | Communicating with bRAWcap driver failed.
2205 */
2208 brawcap_timestamp_capabilities_t* const pCapabilities);
2209
2210/**
2211 * @brief Reads out the currently configured receive time stamping mode for the specified handle.
2212 *
2213 * @param[in] pHandle bRAWcap handle to read from.
2214 *
2215 * @param[out] pMode Will contain the currently used receive time stamping mode, afterwards.
2216 *
2217 * @return
2218 * Status | Description
2219 * ---------------------------------------------- | -----------------------------------------------------------
2220 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2221 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2222 */
2225
2226/**
2227 * @brief Configures the used receive time stamping mode for the specified handle.
2228 *
2229 *
2230 * @note Only available timestamp modes are accepted. It is recommended to check if a timestamp mode is supported
2231 * before setting it. To check if a timestamp mode is available use @ref brawcap_rx_timestamp_capabilities.
2232 *
2233 * @param[in] pHandle bRAWcap handle to be configured.
2234 *
2235 * @param[out] mode The receive timestamp mode to be configured.
2236 *
2237 * @return
2238 * Status | Description
2239 * ---------------------------------------------- | -----------------------------------------------------------
2240 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2241 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2242 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Specified timestamp mode not available.
2243 * @ref BRAWCAP_STATUS_ERROR_DRIVER_IO_FAILED | Communicating with bRAWcap driver failed.
2244 */
2247
2248/**
2249 * @brief Sets the current VLAN tagging flag for the specified handle.
2250 *
2251 * If VLAN tagging is enabled, the VLAN Header (defined by IEEE 802.1Q) will be part of the packet payload.
2252 * By default, the VLAN header is not included in the packet payload.
2253 *
2254 * @param[in] pHandle bRAWcap handle to be configured.
2255 *
2256 * @param[in] enable VLAN tagging state to be set.
2257 *
2258 * @return
2259 * Status | Description
2260 * ---------------------------------------------- | -----------------------------------------------------------
2261 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2262 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2263 * @ref BRAWCAP_STATUS_ERROR_DRIVER_IO_FAILED | Communicating with bRAWcap driver failed.
2264 */
2266brawcap_rx_vlan_tagging_set(brawcap_handle_t* const pHandle, const BOOLEAN enable);
2267
2268/**
2269 * @brief Reads out the configured VLAN tagging state for the specified handle.
2270 *
2271 * @param[in] pHandle bRAWcap handle to read from.
2272 *
2273 * @param[out] pEnabled Will contain the currently configured VLAN tagging state, afterwards.
2274 *
2275 * @return
2276 * Status | Description
2277 * ---------------------------------------------- | -----------------------------------------------------------
2278 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2279 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2280 */
2282brawcap_rx_vlan_tagging_get(brawcap_handle_t* const pHandle, BOOLEAN* const pEnabled);
2283
2284/**
2285 * @brief Sets the driver queue size (in number of packets) for the specified handle.
2286 *
2287 * A larger driver queue can avoid packet drops for time gaps were no packet buffer is available.
2288 * But setting large driver queues should only be done if really necessary, because it can consume a lot of memory.
2289 * Because driver queues exist per handle, the total amount of consumed memory has to summed up for all open handles
2290 * and their current configuration.
2291 *
2292 * The driver queue size can be adjusted at any time.
2293 *
2294 * @note The default queue size is @see BRAWCAP_RX_DRIVER_QUEUE_SIZE_DEFAULT (in number of packets).
2295 * And its max limitation is @see BRAWCAP_RX_DRIVER_QUEUE_SIZE_MAX (in number of packets).
2296 *
2297 * @attention Reducing the queue size during runtime may result in packet loss.
2298 * This may be the case if there are more packets stored in the queue than the new size can accommodate.
2299 *
2300 * @param[in] pHandle bRAWcap handle to be configured.
2301 *
2302 * @param[in] size Driver receive queue size to be set.
2303 *
2304 * @return
2305 * Status | Description
2306 * ---------------------------------------------- | -----------------------------------------------------------
2307 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2308 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2309 * @ref BRAWCAP_STATUS_ERROR_PARAM_OUT_OF_RANGE | Specified queue size is out of range/invalid.
2310 * @ref BRAWCAP_STATUS_ERROR_DRIVER_IO_FAILED | Communicating with bRAWcap driver failed.
2311 */
2314
2315/**
2316 * @brief Reads out the currently configured driver receive queue size for the specified handle.
2317 *
2318 * @param[in] pHandle bRAWcap handle to read from.
2319 *
2320 * @param[out] pSize Will contain the currently configured driver receive queue size, afterwards.
2321 *
2322 * @return
2323 * Status | Description
2324 * ---------------------------------------------- | -----------------------------------------------------------
2325 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2326 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2327 */
2330
2331/**@}*/
2332#endif
2333
2334/*********************************************** TRANSMIT ************************************************************/
2335#if 1
2336/**
2337 * @addtogroup brawcap_transmit
2338 * @{
2339 */
2340
2341/**
2342 * @brief Transmits a single packet on the specified handle.
2343 *
2344 * The caller must provide a valid packet filled up with the payload to transmit.
2345 *
2346 * For creating a packet use @ref brawcap_packet_create. After creating the packet set all the required packet fields
2347 * and than call this function to initiate a transmission.
2348 *
2349 * When transmission has finished (the function returns) the packet fields are updated.
2350 *
2351 * To check if the transmission was successful check for the function return status or the packet status itself
2352 * with @ref brawcap_packet_status_get. If the packet was transmitted and transmit time stamping was enabled the packet
2353 * timestamp will contain the transmission time, which be accessed with @ref brawcap_packet_timestamp_get.
2354 *
2355 * @param[in] pHandle bRAWcap handle to transmit on.
2356 *
2357 * @param[inout] pPacket Packet to be transmitted.
2358 *
2359 * @return
2360 * Status | Description
2361 * ---------------------------------------------- | -----------------------------------------------------------
2362 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2363 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2364 * @ref BRAWCAP_STATUS_ERROR_DRIVER_NOT_AVAILABLE | bRAWcap driver is not active (anymore) on the adapter.
2365 * @ref BRAWCAP_STATUS_WARNING_DEMO_MODE | Running in demo mode (no license).
2366 * @ref BRAWCAP_STATUS_ERROR_DRIVER_IO_FAILED | Communicating with bRAWcap driver failed.
2367 * @ref BRAWCAP_STATUS_WARNING_NOT_ALL_PROCESSED | The transmission failed (or payload was not fully transmitted).
2368 */
2371
2372/**
2373 * @brief Starts the internal transmit loop.
2374 *
2375 * To transmit data using this method push previously filled packet buffers to the handle by using
2376 * @ref brawcap_tx_buffer_send. After that the buffer will be locked down by the handle and added to it´s transmission
2377 * queue.
2378 *
2379 * For creating a new packet buffer which can be used for transmission use @ref brawcap_buffer_create.
2380 *
2381 * When a packet buffer transmission has completed the @ref brawcap_tx_callback_t "transmit callback" will be
2382 * called for this handle and with the corresponding packet buffer. From within the callback the buffer can be
2383 * accessed for post processing (it is unlocked before entering the callback). It is also possible to do
2384 * post processing from a different thread and after the callback.
2385 *
2386 * In general executing to long in the callback can lead to a bottleneck in the transmission.
2387 * It´s not as critical as it is for receiving but it should be still kept in mind.
2388 *
2389 * Like @ref brawcap_tx_packet does, also each packet in transmitted packet buffers will be updated (e.g. packet status,
2390 * transmission timestamp). The user application can access those updated information after transmission has completed.
2391 *
2392 * A completed packet buffer transmission will automatically detach the buffer from the handle.
2393 * It is not needed to detach it explicitly (which would be required for receive buffers).
2394 *
2395 * @note The buffers are transmitted in the same order they have been added by the user application with
2396 * @ref brawcap_tx_buffer_send.
2397 *
2398 * @invariant The user parameter allows access to user defined context.
2399 * The given pointer is not used and validated by bRAWcap. Therefore the user is responsible for validating
2400 * the context in the callback before accessing it.
2401 *
2402 * @attention After starting transmission, @ref brawcap_tx_packet can not be used - on this handle - until tranmission
2403 * is stopped with @ref brawcap_tx_stop, because parallel transmissions are not allowed
2404 *
2405 * @param[in] pHandle bRAWcap handle to transmit on.
2406 *
2407 * @param[in] callback Function pointer to user application transmit callback.
2408 *
2409 * @param[in] pUser Pointer to a user defined context. Can be NULL if no user context is required.
2410 *
2411 * @return
2412 * Status | Description
2413 * ---------------------------------------------- | -----------------------------------------------------------
2414 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2415 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2416 * @ref BRAWCAP_STATUS_WARNING_PENDING | Another transmit is pending or transmission is already started.
2417 */
2419brawcap_tx_start(brawcap_handle_t* const pHandle, brawcap_tx_callback_t const callback, void* pUser);
2420
2421/**
2422 * @brief Stops the internal transmit loop.
2423 *
2424 * @param[in] pHandle bRAWcap handle to stop transmission on.
2425 *
2426 * @return
2427 * Status | Description
2428 * ---------------------------------------------- | -----------------------------------------------------------
2429 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2430 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2431 * @ref BRAWCAP_STATUS_INFO_NOT_RUNNING | There was no transmission running.
2432 */
2435
2436/**
2437 * @brief Pushes the specified buffer to the specified handle transmit queue.
2438 *
2439 * After pushing a packet buffer to the handle for transmission it is locked down by the handle until transmission
2440 * has completed (and the @ref brawcap_tx_callback_t "transmit callback" is called).
2441 *
2442 * With the synchronized flag it is possible to activate a synchronized transmission of the specified packet buffer.
2443 * This means that the driver reads the time gap between each packet in the packet buffer and waits until it has been
2444 * elapsed before initiating transmission.
2445 *
2446 * @attention For synchronized transmission it is necessary to sort the packets in the buffer by rising timestamp.
2447 * Furthermore, it is currently not supported to specify a "start time" when the first packet should be transmitted.
2448 * Therefore if you want to start transmission depending on the first packet timestamp you should wait until the
2449 * time is reached and after this initiate the transmission by calling this function. The driver itself only
2450 * evaluates the time gaps between each packet in the buffer.
2451 *
2452 * @note Packet buffers are transmitted in the same order they was pushed to the handle.
2453 *
2454 * @invariant Keep in mind that the packet timestamp is updated after transmission has been completed by the
2455 * transmission timestamp (depending on the configured timestamp mode). Therefore if there was a packet timestamp set
2456 * for example to send synchronized, this timestamp will be overwritten.
2457 *
2458 * @param[in] pHandle bRAWcap handle for sending the buffer.
2459 *
2460 * @param[in] pBuffer Packet buffer to be sent.
2461 *
2462 * @param[in] synchronized Flag indicating if the packets in the packet buffer should be sent synchronized.
2463 *
2464 * @return
2465 * Status | Description
2466 * ---------------------------------------------- | -----------------------------------------------------------
2467 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2468 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2469 * @ref BRAWCAP_STATUS_ERROR_IN_USE | The buffer is already in use / locked down by another operation.
2470 */
2472brawcap_tx_buffer_send(brawcap_handle_t* const pHandle, brawcap_buffer_t* const pBuffer, const BOOLEAN synchronized);
2473
2474/**
2475 * @brief Sets the driver queue size (in number of packets) for the specified handle.
2476 *
2477 * For transmission the driver queue size may be increased if high data rates should be reached (for example 10GBit/s).
2478 * With a larger transmission queue the driver can forward more packets to the network adapter at the same time.
2479 * Therefore if the transmission rate is below the expected value it may be solved by a larger driver queue size.
2480 *
2481 * The driver queue size can be adjusted at any time.
2482 *
2483 * @note The default queue size is @see BRAWCAP_TX_DRIVER_QUEUE_SIZE_DEFAULT (in number of packets).
2484 * And its max limitation is @see BRAWCAP_TX_DRIVER_QUEUE_SIZE_MAX (in number of packets).
2485 *
2486 * @attention Reducing the queue size during runtime may result in packet transmission cancellation.
2487 * This may be the case if there are more packets pending for transmission than the new size can accommodate.
2488 *
2489 * @param[in] pHandle bRAWcap handle to be configured.
2490 *
2491 * @param[in] size Driver transmit queue size to be set.
2492 *
2493 * @return
2494 * Status | Description
2495 * ---------------------------------------------- | -----------------------------------------------------------
2496 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2497 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2498 * @ref BRAWCAP_STATUS_ERROR_PARAM_OUT_OF_RANGE | Specified queue size is out of range/invalid.
2499 * @ref BRAWCAP_STATUS_ERROR_DRIVER_IO_FAILED | Communicating with bRAWcap driver failed.
2500 */
2503
2504/**
2505 * @brief Reads out the currently configured driver transmit queue size for the specified handle.
2506 *
2507 * @param[in] pHandle bRAWcap handle to read from.
2508 *
2509 * @param[out] pSize Will contain the currently configured driver transmit queue size, afterwards.
2510 *
2511 * @return
2512 * Status | Description
2513 * ---------------------------------------------- | -----------------------------------------------------------
2514 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2515 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2516 */
2519
2520/**
2521 * @brief Reads out the available transmit timestamp modes for the specified handle.
2522 *
2523 * Some of the timestamp capabilities depend on the features provided by the underlying adapter.
2524 * Those modes are named with "adapter".
2525 *
2526 * @param[in] pHandle bRAWcap handle to read from.
2527 *
2528 * @param[out] pCapabilities Will contain the available transmit timestamp modes, afterwards.
2529 *
2530 * @return
2531 * Status | Description
2532 * ---------------------------------------------- | -----------------------------------------------------------
2533 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2534 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2535 * @ref BRAWCAP_STATUS_ERROR_DRIVER_IO_FAILED | Communicating with bRAWcap driver failed.
2536 */
2539 brawcap_timestamp_capabilities_t* const pCapabilities);
2540
2541/**
2542 * @brief Configures the used transmit time stamping mode for the specified handle.
2543 *
2544 * @note Only available timestamp modes are accepted. It is recommended to check if a timestamp mode is supported
2545 * before setting it. To check if a timestamp mode is available use @ref brawcap_tx_timestamp_capabilities.
2546 *
2547 * @param[in] pHandle bRAWcap handle to be configured.
2548 *
2549 * @param[in] mode The transmit timestamp mode to be configured.
2550 *
2551 * @return
2552 * Status | Description
2553 * ---------------------------------------------- | -----------------------------------------------------------
2554 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2555 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2556 * @ref BRAWCAP_STATUS_ERROR_NOT_AVAILABLE | Specified timestamp mode not available.
2557 * @ref BRAWCAP_STATUS_ERROR_DRIVER_IO_FAILED | Communicating with bRAWcap driver failed.
2558 */
2561
2562/**
2563 * @brief Reads out the currently configured transmit time stamping mode for the specified handle.
2564 *
2565 * @param[in] pHandle bRAWcap handle to read from.
2566 *
2567 * @param[out] pMode Will contain the currently used transmit time stamping mode, afterwards.
2568 *
2569 * @return
2570 * Status | Description
2571 * ---------------------------------------------- | -----------------------------------------------------------
2572 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2573 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2574 */
2577
2578/**@}*/
2579#endif
2580
2581/************************************************* STATS **************************************************************/
2582#if 1
2583/**
2584 * @addtogroup brawcap_stats
2585 * @{
2586 */
2587
2588/**
2589 * @brief Reads out the available receive statistic counters for the specified handle.
2590 *
2591 * @param[in] pHandle bRAWcap handle to read from.
2592 *
2593 * @param[inout] pStats Will contain the current receive statistic counters, afterwards.
2594 * The header of the statistic struct hast to be filled by the caller, before calling this function.
2595 * If it is not filled or contains invalid data, the function will fail and return a error.
2596 *
2597 * @return
2598 * Status | Description
2599 * ---------------------------------------------- | -----------------------------------------------------------
2600 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2601 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2602 * @ref BRAWCAP_STATUS_ERROR_INVALID_PARAM | The header was invalid (type or revision).
2603 * @ref BRAWCAP_STATUS_ERROR_PARAM_OUT_OF_RANGE | The specified size in the header was invalid.
2604 * @ref BRAWCAP_STATUS_ERROR_DRIVER_IO_FAILED | Communicating with bRAWcap driver failed.
2605 */
2608
2609/**
2610 * @brief Reads out the available transmit statistic counters for the specified handle.
2611 *
2612 * @param[in] pHandle bRAWcap handle to read from.
2613 *
2614 * @param[inout] pStats Will contain the current transmit statistic counters, afterwards.
2615 * The header of the statistic struct hast to be filled by the caller, before calling this function.
2616 * If it is not filled or contains invalid data, the function will fail and return a error.
2617 *
2618 * @return
2619 * Status | Description
2620 * ---------------------------------------------- | -----------------------------------------------------------
2621 * @ref BRAWCAP_STATUS_SUCCESS | Success.
2622 * @ref BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the given pointer parameters was invalid.
2623 * @ref BRAWCAP_STATUS_ERROR_INVALID_PARAM | The header was invalid (type or revision).
2624 * @ref BRAWCAP_STATUS_ERROR_PARAM_OUT_OF_RANGE | The specified size in the header was invalid.
2625 * @ref BRAWCAP_STATUS_ERROR_DRIVER_IO_FAILED | Communicating with bRAWcap driver failed.
2626 */
2629
2630/**@}*/
2631#endif
2632
2633#if defined(__cplusplus)
2634}
2635#endif //(__cplusplus)
2636
2637#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:94
struct _brawcap_handle brawcap_handle_t
A bRAWcap handle.
Definition: brawcap_types_um.h:173
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:150
bRAWcap version.
Definition: brawcap_types_shared.h:426
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:524
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:612
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:533
brawcap_timestamp_mode_t
List of different timestamp modes.
Definition: brawcap_types_shared.h:574
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.
UINT16 brawcap_packet_size_t
Type for handling the number of payload bytes per packet.
Definition: brawcap_types_shared.h:670
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.
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_status_t brawcap_packet_create(brawcap_packet_t **const pPacket, const brawcap_packet_size_t maxSize)
Creates a new packet.
struct _brawcap_packet brawcap_packet_t
bRAWcap packet object.
Definition: brawcap_types_shared.h:679
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_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_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:742
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_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:734
brawcap_status_t brawcap_buffer_clear(brawcap_buffer_t *const pBuffer)
Clears the specified packet buffer.
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_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_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:770
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:263
IPv6 address.
Definition: brawcap_types_um.h:273
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:418
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:249
brawcap_adapter_connection_state_t
List of adapter connection states. Values indicating the current adapter connection state (uplink/cab...
Definition: brawcap_types_um.h:306
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:257
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:287
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:400
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:317
UINT8 brawcap_adapter_count_t
Type used for counting the available/supported adapters on a machine.
Definition: brawcap_types_um.h:242
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:337
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:1047
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:1037
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:471
brawcap_rx_direction_t
List of supported receive directions.
Definition: brawcap_types_shared.h:1074
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:900
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:973
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:927
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:912
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_packet_size_t brawcap_filter_byte_length_t
Type for specifying the byte filter length.
Definition: brawcap_types_shared.h:917
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_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:501
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:1303
The bRAWcap transmit statistics.
Definition: brawcap_types_shared.h:1421
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:45
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:129
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:77