Skip to content

Instantly share code, notes, and snippets.

View SysMan-One's full-sized avatar
💭
Ready for any project on C!

Ruslan R. Laishev SysMan-One

💭
Ready for any project on C!
View GitHub Profile
anonymous
anonymous / Makefile
Created October 9, 2017 21:21
EXTRA_CFLAGS += -D_GNU_SOURCE
obj-m := vraid.o
all:
make -C /usr/src/linux-headers-$(shell uname -r) SUBDIRS=$(PWD) modules
clean:
make -C /usr/src/linux-headers-$(shell uname -r) SUBDIRS=$(PWD) clean
@pavel-odintsov
pavel-odintsov / af_packet_rx_ring.c
Last active June 27, 2024 19:28
af_packet_rx_ring_habrahabr.c
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <unistd.h>
#include <boost/thread.hpp>
#include <sys/mman.h>
#include <poll.h>
#include <arpa/inet.h>
@pavel-odintsov
pavel-odintsov / af_packet_classic.c
Last active June 27, 2024 19:19
af_packet_classic_habrahabr
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <unistd.h>
#include <boost/thread.hpp>
#include <arpa/inet.h>
#include <sys/socket.h>
// C program for Red-Black Tree insertion
#include<stdio.h>
#include<stdlib.h>
//A Red-Black tree node structure
struct node
{
int data; // for data part
char color; // for color property
@alan-mushi
alan-mushi / json_parser.c
Last active March 25, 2024 19:23
Examples for the json-c tutorial.
/*
* A simple example of json string parsing with json-c.
*
* clang -Wall -g -I/usr/include/json-c/ -o json_parser json_parser.c -ljson-c
*/
#include <json.h>
#include <stdio.h>
int main() {
struct json_object *jobj;
@fqrouter
fqrouter / nfq_example.c
Created March 13, 2013 13:04
A minimal application using libnetfilter_queue
#include <iostream>
#include <cstdlib>
#include <netinet/in.h>
extern "C" {
#include <linux/netfilter.h>
#include <libnetfilter_queue/libnetfilter_queue.h>
}
using namespace std;
@prashants
prashants / filter.c
Created October 5, 2012 11:48
Filter driver
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/fs.h>
#include <linux/blkdev.h>
#include <linux/cdev.h>
#include <linux/kthread.h>
#include <linux/interrupt.h>
#include <linux/bio.h>
#include <linux/blkdev.h>
@austinmarton
austinmarton / sendRawEth.c
Created February 27, 2012 08:40
Send a raw Ethernet frame in Linux
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*/
#include <arpa/inet.h>
#include <linux/if_packet.h>
#include <stdio.h>