Ilias Apalodimas(apalos) replied on github web page:

platform/linux-generic/include/odp_pcapng.h
line 20
@@ -0,0 +1,56 @@
+/* Copyright (c) 2018, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#include <protocols/eth.h>
+#include <protocols/ip.h>
+#include <odp/api/plat/packet_inlines.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/fcntl.h>
+#include <unistd.h>
+#include <pthread.h>
+
+#define PCAPNG_BLOCK_TYPE_EPB 0x00000006UL
+#define PCAPNG_BLOCK_TYPE_SHB 0x0A0D0D0AUL
+#define PCAPNG_BLOCK_TYPE_IDB 0x00000001UL
+#define PCAPNG_ENDIAN_MAGIC 0x1A2B3C4DUL
+#define PCAP_DATA_ALIGN (4)


Comment:
wireshark re-defines them in every c file they want to use them. Keeping in 
mind this is the pcapng file format specification, these are high unlikely to 
change.

The only relevant library i found is 
ntar(https://www.winpcap.org/ntar/changelog.htm) but it seems abandoned for 
many many years.

> Ilias Apalodimas(apalos) wrote:
> will update


>> Ilias Apalodimas(apalos) wrote:
>> This essentially "reads" the inotify triggers for opening/closing the fifos 
>> and sets the appropriate variables for starting/stopping the pcapng dump on 
>> fifos. Will try to make it easier to read on the final PR


>>> Ilias Apalodimas(apalos) wrote:
>>> will fix


>>>> Ilias Apalodimas(apalos) wrote:
>>>> will fix


>>>>> Ilias Apalodimas(apalos) wrote:
>>>>> I'll check and update for the final PR


>>>>>> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
>>>>>> General cleanup should be part of `odp_term_global()` processing. 
>>>>>> Presumably `odp_pktio_close()` should also do cleanup for specific 
>>>>>> pktios.


>>>>>>> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
>>>>>>> A few comments about what this routine is doing would be very helpful 
>>>>>>> here. This is not easy code to follow. Modularizing it into some  
>>>>>>> `static inline` helpers might also make the logic simpler.


>>>>>>>> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
>>>>>>>> This is redundant. If `len > 0` then by definition `len != -1`.


>>>>>>>>> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
>>>>>>>>> This fails for multi-segment packets. `odp_packet_data(pkt)` is 
>>>>>>>>> shorthand for `odp_packet_offset(pkt, 0, NULL, NULL)` so you don't 
>>>>>>>>> know how long the first segment really is. First cut would be to only 
>>>>>>>>> dump the first segment, so correct code is:
>>>>>>>>> ```
>>>>>>>>> uint32_t seg_len;
>>>>>>>>> char *buf = (char *)odp_packet_offset(packets[i], 0, &seg_len, NULL);
>>>>>>>>> ```
>>>>>>>>> And use `seg_len` rather than `pkt_len` in this routine.


>>>>>>>>>> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
>>>>>>>>>> Does pcapng not supply a `.h` file for these "magic numbers" and 
>>>>>>>>>> associated structs?


>>>>>>>>>>> Ilias Apalodimas(apalos) wrote:
>>>>>>>>>>> Will fix. This will also remove the requirement of manually 
>>>>>>>>>>> deleting the fifos


>>>>>>>>>>>> muvarov wrote
>>>>>>>>>>>> odp_global_data_s->main_pid needs to be here.


https://github.com/Linaro/odp/pull/435#discussion_r165633289
updated_at 2018-02-02 12:46:49

Reply via email to