Skip to content

Conversation

@Vineet1101
Copy link

No description provided.

Signed-off-by: Vineet1101 <[email protected]>
@Vineet1101
Copy link
Author

@antoninbas @jafingerhut can you provide some guidance and suggestion on this task

@antoninbas
Copy link
Member

There is an issue for this task, with more details: #1249

However, I would say that this is not a trivial task in my mind. It should not be a "basic" 1-1 rewrite from C to C++. And this is a key part of the code base for which we do not really have CI test coverage (and for which writing tests is not super straightforward), so any PR will need to be carefully reviewed.

@Vineet1101
Copy link
Author

`int bmi_interface_create(bmi_interface_t **bmi, const char *device) {
bmi_interface_t *bmi_ = malloc(sizeof(bmi_interface_t));

if(!bmi_) return -1;

bmi_->pcap_input_dumper = NULL;
bmi_->pcap_output_dumper = NULL;

char errbuf[PCAP_ERRBUF_SIZE];
bmi_->pcap = pcap_create(device, errbuf);

if(!bmi_->pcap) {
free(bmi_);
return -1;
}

if(pcap_set_promisc(bmi_->pcap, 1) != 0) {
pcap_close(bmi_->pcap);
free(bmi_);
return -1;
}` in this code it initializes the attributes using pointer so in c++ code what should i use RAII or a unique pointer
@antoninbas

@Vineet1101
Copy link
Author

@antoninbas should I also update the .h file to .hpp file and modify its code also. I have completed the conversion of .c file to .cpp file

@github-actions
Copy link

This PR is stale because it has been open 180 days with no activity. Remove stale label or comment, or this will be closed in 180 days

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants