{"id":22065998,"url":"https://github.com/iij/mruby-bpf","last_synced_at":"2025-10-11T08:48:03.431Z","repository":{"id":146123533,"uuid":"74109071","full_name":"iij/mruby-bpf","owner":"iij","description":"BPF (Berkeley Packet Filter) interface for mruby","archived":false,"fork":false,"pushed_at":"2016-11-18T08:12:43.000Z","size":3,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-09-12T03:02:18.122Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iij.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-11-18T08:11:53.000Z","updated_at":"2017-03-01T03:40:24.000Z","dependencies_parsed_at":"2023-09-10T19:01:02.741Z","dependency_job_id":null,"html_url":"https://github.com/iij/mruby-bpf","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/iij/mruby-bpf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iij%2Fmruby-bpf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iij%2Fmruby-bpf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iij%2Fmruby-bpf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iij%2Fmruby-bpf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iij","download_url":"https://codeload.github.com/iij/mruby-bpf/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iij%2Fmruby-bpf/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279006643,"owners_count":26084149,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-30T19:23:12.460Z","updated_at":"2025-10-11T08:48:03.417Z","avatar_url":"https://github.com/iij.png","language":"C","readme":"# mruby-bpf\n\"mruby-bpf\" provides BPF (Berkeley Packet Filter) API to mruby.\n\n## Example\n```rb\nbpf = BPF.open(\"em1\", 2000)\nbpf.immediate = true\n\nwhile IO.select([bpf])\n  pkt = bpf.sysread(bpf.buffer_length)\n  p pkt\nend\nbpf.close\n```\n\n## API\n\n- BPF.open(ifname, buflen=nil)\n  - Open a BPF device file.  `ifname` is the name of the hardware interface that the BPF object will listen on.  `buflen` is the buffer length for reads.  The default value of `buflen` varies per systems.\n- BPF#buffer_length\n  - Returns the required buffer length (BIOCGBLEN)\n- BPF#buffer_length=\n  - Sets the buffer length for reads (BIOCSBLEN)\n- BPF#header_complete\n  - Get the status of the \"header complete\" flag (BIOCGHDRCMPLT)\n- BPF#header_complete=\n  - Set the status of the \"header complete\" flag (BIOCSHDRCMPLT)\n- BPF#immediate=\n  - Enables or disables \"immediate mode\" (BIOCIMMEDIATE).\n    Note: BPF does not provide an API to get the status of \"immediate mode\".\n- BPF#interface\n  - Returns the name of the hardware interface that the BPF object is\n    listening on (BIOCGETIF)\n- BPF#interface=\n  - Sets the hardware interface (BIOCSETIF)\n- BPF#see_sent\n  - Get the status of the \"see sent\" flag (BIOCGSEESENT)\n- BPF#see_sent=\n  - Set the status of the \"see sent\" flag (BIOCSSEESENT)\n- BPF#set_filter(prog)\n  - Sets the filter program used by the kernel to discard uninteresting packets\n    (BIOCSETF).  `prog` is expected to be an output of `tcpdump -ddd`.\n- BPF#set_promisc\n  - Forces the interface into promiscuous mode (BIOCPROMISC)\n- BPF.wordalign(x)\n  - Returns `BPF_WORDALIGN(x)` (see bpf(4)).\n\n\n## License\n\nCopyright (c) 2015 Internet Initiative Japan Inc.\n\nPermission is hereby granted, free of charge, to any person obtaining a\ncopy of this software and associated documentation files (the \"Software\"),\nto deal in the Software without restriction, including without limitation\nthe rights to use, copy, modify, merge, publish, distribute, sublicense,\nand/or sell copies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\nDEALINGS IN THE SOFTWARE.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiij%2Fmruby-bpf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiij%2Fmruby-bpf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiij%2Fmruby-bpf/lists"}