Skip to content

Added wrapper functions#29

Merged
shaharyarn merged 6 commits intomasterfrom
feature/expose-wrapper-functions
Aug 23, 2020
Merged

Added wrapper functions#29
shaharyarn merged 6 commits intomasterfrom
feature/expose-wrapper-functions

Conversation

@shaharyarn
Copy link
Copy Markdown
Collaborator

No description provided.

Copy link
Copy Markdown
Collaborator

@yehonatanz yehonatanz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean and simple :)
However, I'd like to have module level functions (not methods), this would be much more comfortable.
Consult Omer and me about it, since that's bound to be a rather delicate case of singleton, and might require slight modifications after we address the packaging of marine.

@shaharyarn shaharyarn force-pushed the feature/expose-wrapper-functions branch from a3f8c75 to 0e4a23f Compare May 27, 2020 13:35
@shaharyarn shaharyarn requested a review from yehonatanz May 27, 2020 13:42
Copy link
Copy Markdown
Owner

@tomlegkov tomlegkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want tests for the API? @yehonatanz

import sys
import os.path

marine_instance = {}
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is more than one instance needed? I'm pretty sure it actually won't work (only one instance per process)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also what is the use case of loading Marine from multiple paths?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on recommendations changed so that marine is loaded from default .so location (DL_LIBRARY_PATH).

@shaharyarn shaharyarn force-pushed the feature/expose-wrapper-functions branch from 89098a5 to 83e39a5 Compare May 31, 2020 14:53
@shaharyarn shaharyarn requested a review from tomlegkov May 31, 2020 14:54
@yehonatanz
Copy link
Copy Markdown
Collaborator

Do we want tests for the API? @yehonatanz

Static analysis is fine for me in this case, tests seem like a waste of effort.

Copy link
Copy Markdown
Collaborator

@yehonatanz yehonatanz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks real good

@shaharyarn shaharyarn force-pushed the feature/expose-wrapper-functions branch from 83e39a5 to 5f3d051 Compare June 1, 2020 07:06
Copy link
Copy Markdown
Collaborator

@yehonatanz yehonatanz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, but there are common typing errors (assuming your None pr is merged).
Mostly encap_type and the result dict.

packet: bytes,
fields: Optional[List[str]] = None,
macros: Optional[Dict[str, List[str]]] = None,
encapsulation_type: int = encap_consts.ENCAP_ETHERNET,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those are changes that are indeed related to the encap-detection PR, which is why the typing changes are made there.

packet: bytes,
bpf: Optional[str] = None,
display_filter: Optional[str] = None,
encapsulation_type: int = encap_consts.ENCAP_ETHERNET,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None

self,
packet: bytes,
fields: Optional[List[str]] = None,
encapsulation_type: int = encap_consts.ENCAP_ETHERNET,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None

fields: Optional[List[str]] = None,
encapsulation_type: int = encap_consts.ENCAP_ETHERNET,
macros: Optional[Dict[str, List[str]]] = None,
) -> Dict[str, str]:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dict[str, Optional[str]]

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those are changes that are related to the empty-fields-type PR so it would be nice if they were noted there as I indeed forgot to switch the typing :)

fields: Optional[List[str]] = None,
encapsulation_type: int = encap_consts.ENCAP_ETHERNET,
macros: Optional[Dict[str, List[str]]] = None,
) -> (bool, Dict[str, str]):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dict[str, Optional[str]]

packet: bytes,
bpf: Optional[str] = None,
display_filter: Optional[str] = None,
encapsulation_type: int = encap_consts.ENCAP_ETHERNET,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None

@yehonatanz yehonatanz linked an issue Jun 24, 2020 that may be closed by this pull request
@shaharyarn shaharyarn requested a review from yehonatanz July 20, 2020 11:52
Base automatically changed from feature/macros to master August 17, 2020 17:44
@shaharyarn shaharyarn force-pushed the feature/expose-wrapper-functions branch from 5f3d051 to c811d0d Compare August 23, 2020 08:11
@shaharyarn shaharyarn merged commit 9e081b6 into master Aug 23, 2020
@shaharyarn shaharyarn deleted the feature/expose-wrapper-functions branch August 23, 2020 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose wrapper functions

3 participants