Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const c = @cImport({
- @cInclude("stdio.h");
- @cInclude("sys/types.h");
- @cInclude("sys/socket.h");
- @cInclude("arpa/inet.h");
- @cInclude("netinet/in.h");
- @cInclude("string.h");
- @cInclude("stdio.h");
- @cInclude("unistd.h");
- @cInclude("pthread.h");
- @cInclude("semaphore.h");
- @cInclude("libnetfilter_queue/libnetfilter_queue.h");
- });
- const std = @import("std");
- const ChildProcess = std.os.ChildProcess;
- const warn = std.debug.warn;
- pub fn main() void {
- const h = c.nfq_open();
- // ~/Downloads/zig-linux-x86_64-0.2.0.b65203f5/zig build-exe zf.zig --library c --library netfilter_queue
- // /home/juturnas/Desktop/zigfilter/zf.zig:45:16: error: cast discards const qualifier
- const cb = @ptrCast(?[*]extern fn(?*c.nfq_q_handle, ?[*]c.nfgenmsg, ?*c.nfq_data, ?*c_void) c_int, callback);
- const queue_handle = c.nfq_create_queue(h, 0, cb, null);
- if (queue_handle == null) {
- warn("nfq_create_queue() failed");
- return;
- }
- }
- extern fn callback(qh: ?*c.nfq_q_handle, nfmsg: ?[*]c.nfgenmsg, nfa: ?*c.nfq_data, data: ?*c_void) c_int {
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement