cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

rose.h (7838B)


      1/* SPDX-License-Identifier: GPL-2.0 */
      2/*
      3 *	Declarations of Rose type objects.
      4 *
      5 *	Jonathan Naylor G4KLX	25/8/96
      6 */
      7
      8#ifndef _ROSE_H
      9#define _ROSE_H 
     10
     11#include <linux/rose.h>
     12#include <net/sock.h>
     13
     14#define	ROSE_ADDR_LEN			5
     15
     16#define	ROSE_MIN_LEN			3
     17
     18#define	ROSE_CALL_REQ_ADDR_LEN_OFF	3
     19#define	ROSE_CALL_REQ_ADDR_LEN_VAL	0xAA	/* each address is 10 digits */
     20#define	ROSE_CALL_REQ_DEST_ADDR_OFF	4
     21#define	ROSE_CALL_REQ_SRC_ADDR_OFF	9
     22#define	ROSE_CALL_REQ_FACILITIES_OFF	14
     23
     24#define	ROSE_GFI			0x10
     25#define	ROSE_Q_BIT			0x80
     26#define	ROSE_D_BIT			0x40
     27#define	ROSE_M_BIT			0x10
     28
     29#define	ROSE_CALL_REQUEST		0x0B
     30#define	ROSE_CALL_ACCEPTED		0x0F
     31#define	ROSE_CLEAR_REQUEST		0x13
     32#define	ROSE_CLEAR_CONFIRMATION		0x17
     33#define	ROSE_DATA			0x00
     34#define	ROSE_INTERRUPT			0x23
     35#define	ROSE_INTERRUPT_CONFIRMATION	0x27
     36#define	ROSE_RR				0x01
     37#define	ROSE_RNR			0x05
     38#define	ROSE_REJ			0x09
     39#define	ROSE_RESET_REQUEST		0x1B
     40#define	ROSE_RESET_CONFIRMATION		0x1F
     41#define	ROSE_REGISTRATION_REQUEST	0xF3
     42#define	ROSE_REGISTRATION_CONFIRMATION	0xF7
     43#define	ROSE_RESTART_REQUEST		0xFB
     44#define	ROSE_RESTART_CONFIRMATION	0xFF
     45#define	ROSE_DIAGNOSTIC			0xF1
     46#define	ROSE_ILLEGAL			0xFD
     47
     48/* Define Link State constants. */
     49
     50enum {
     51	ROSE_STATE_0,			/* Ready */
     52	ROSE_STATE_1,			/* Awaiting Call Accepted */
     53	ROSE_STATE_2,			/* Awaiting Clear Confirmation */
     54	ROSE_STATE_3,			/* Data Transfer */
     55	ROSE_STATE_4,			/* Awaiting Reset Confirmation */
     56	ROSE_STATE_5			/* Deferred Call Acceptance */
     57};
     58
     59#define ROSE_DEFAULT_T0			180000		/* Default T10 T20 value */
     60#define ROSE_DEFAULT_T1			200000		/* Default T11 T21 value */
     61#define ROSE_DEFAULT_T2			180000		/* Default T12 T22 value */
     62#define	ROSE_DEFAULT_T3			180000		/* Default T13 T23 value */
     63#define	ROSE_DEFAULT_HB			5000		/* Default Holdback value */
     64#define	ROSE_DEFAULT_IDLE		0		/* No Activity Timeout - none */
     65#define	ROSE_DEFAULT_ROUTING		1		/* Default routing flag */
     66#define	ROSE_DEFAULT_FAIL_TIMEOUT	120000		/* Time until link considered usable */
     67#define	ROSE_DEFAULT_MAXVC		50		/* Maximum number of VCs per neighbour */
     68#define	ROSE_DEFAULT_WINDOW_SIZE	7		/* Default window size */
     69
     70#define ROSE_MODULUS 			8
     71#define	ROSE_MAX_PACKET_SIZE		251		/* Maximum packet size */
     72
     73#define	ROSE_COND_ACK_PENDING		0x01
     74#define	ROSE_COND_PEER_RX_BUSY		0x02
     75#define	ROSE_COND_OWN_RX_BUSY		0x04
     76
     77#define	FAC_NATIONAL			0x00
     78#define	FAC_CCITT			0x0F
     79
     80#define	FAC_NATIONAL_RAND		0x7F
     81#define	FAC_NATIONAL_FLAGS		0x3F
     82#define	FAC_NATIONAL_DEST_DIGI		0xE9
     83#define	FAC_NATIONAL_SRC_DIGI		0xEB
     84#define	FAC_NATIONAL_FAIL_CALL		0xED
     85#define	FAC_NATIONAL_FAIL_ADD		0xEE
     86#define	FAC_NATIONAL_DIGIS			0xEF
     87
     88#define	FAC_CCITT_DEST_NSAP		0xC9
     89#define	FAC_CCITT_SRC_NSAP		0xCB
     90
     91struct rose_neigh {
     92	struct rose_neigh	*next;
     93	ax25_address		callsign;
     94	ax25_digi		*digipeat;
     95	ax25_cb			*ax25;
     96	struct net_device		*dev;
     97	unsigned short		count;
     98	unsigned short		use;
     99	unsigned int		number;
    100	char			restarted;
    101	char			dce_mode;
    102	char			loopback;
    103	struct sk_buff_head	queue;
    104	struct timer_list	t0timer;
    105	struct timer_list	ftimer;
    106};
    107
    108struct rose_node {
    109	struct rose_node	*next;
    110	rose_address		address;
    111	unsigned short		mask;
    112	unsigned char		count;
    113	char			loopback;
    114	struct rose_neigh	*neighbour[3];
    115};
    116
    117struct rose_route {
    118	struct rose_route	*next;
    119	unsigned int		lci1, lci2;
    120	rose_address		src_addr, dest_addr;
    121	ax25_address		src_call, dest_call;
    122	struct rose_neigh 	*neigh1, *neigh2;
    123	unsigned int		rand;
    124};
    125
    126struct rose_sock {
    127	struct sock		sock;
    128	rose_address		source_addr,   dest_addr;
    129	ax25_address		source_call,   dest_call;
    130	unsigned char		source_ndigis, dest_ndigis;
    131	ax25_address		source_digis[ROSE_MAX_DIGIS];
    132	ax25_address		dest_digis[ROSE_MAX_DIGIS];
    133	struct rose_neigh	*neighbour;
    134	struct net_device		*device;
    135	unsigned int		lci, rand;
    136	unsigned char		state, condition, qbitincl, defer;
    137	unsigned char		cause, diagnostic;
    138	unsigned short		vs, vr, va, vl;
    139	unsigned long		t1, t2, t3, hb, idle;
    140#ifdef M_BIT
    141	unsigned short		fraglen;
    142	struct sk_buff_head	frag_queue;
    143#endif
    144	struct sk_buff_head	ack_queue;
    145	struct rose_facilities_struct facilities;
    146	struct timer_list	timer;
    147	struct timer_list	idletimer;
    148};
    149
    150#define rose_sk(sk) ((struct rose_sock *)(sk))
    151
    152/* af_rose.c */
    153extern ax25_address rose_callsign;
    154extern int  sysctl_rose_restart_request_timeout;
    155extern int  sysctl_rose_call_request_timeout;
    156extern int  sysctl_rose_reset_request_timeout;
    157extern int  sysctl_rose_clear_request_timeout;
    158extern int  sysctl_rose_no_activity_timeout;
    159extern int  sysctl_rose_ack_hold_back_timeout;
    160extern int  sysctl_rose_routing_control;
    161extern int  sysctl_rose_link_fail_timeout;
    162extern int  sysctl_rose_maximum_vcs;
    163extern int  sysctl_rose_window_size;
    164
    165int rosecmp(const rose_address *, const rose_address *);
    166int rosecmpm(const rose_address *, const rose_address *, unsigned short);
    167char *rose2asc(char *buf, const rose_address *);
    168struct sock *rose_find_socket(unsigned int, struct rose_neigh *);
    169void rose_kill_by_neigh(struct rose_neigh *);
    170unsigned int rose_new_lci(struct rose_neigh *);
    171int rose_rx_call_request(struct sk_buff *, struct net_device *,
    172			 struct rose_neigh *, unsigned int);
    173void rose_destroy_socket(struct sock *);
    174
    175/* rose_dev.c */
    176void rose_setup(struct net_device *);
    177
    178/* rose_in.c */
    179int rose_process_rx_frame(struct sock *, struct sk_buff *);
    180
    181/* rose_link.c */
    182void rose_start_ftimer(struct rose_neigh *);
    183void rose_stop_ftimer(struct rose_neigh *);
    184void rose_stop_t0timer(struct rose_neigh *);
    185int rose_ftimer_running(struct rose_neigh *);
    186void rose_link_rx_restart(struct sk_buff *, struct rose_neigh *,
    187			  unsigned short);
    188void rose_transmit_clear_request(struct rose_neigh *, unsigned int,
    189				 unsigned char, unsigned char);
    190void rose_transmit_link(struct sk_buff *, struct rose_neigh *);
    191
    192/* rose_loopback.c */
    193void rose_loopback_init(void);
    194void rose_loopback_clear(void);
    195int rose_loopback_queue(struct sk_buff *, struct rose_neigh *);
    196
    197/* rose_out.c */
    198void rose_kick(struct sock *);
    199void rose_enquiry_response(struct sock *);
    200
    201/* rose_route.c */
    202extern struct rose_neigh *rose_loopback_neigh;
    203extern const struct seq_operations rose_neigh_seqops;
    204extern const struct seq_operations rose_node_seqops;
    205extern struct seq_operations rose_route_seqops;
    206
    207void rose_add_loopback_neigh(void);
    208int __must_check rose_add_loopback_node(const rose_address *);
    209void rose_del_loopback_node(const rose_address *);
    210void rose_rt_device_down(struct net_device *);
    211void rose_link_device_down(struct net_device *);
    212struct net_device *rose_dev_first(void);
    213struct net_device *rose_dev_get(rose_address *);
    214struct rose_route *rose_route_free_lci(unsigned int, struct rose_neigh *);
    215struct rose_neigh *rose_get_neigh(rose_address *, unsigned char *,
    216				  unsigned char *, int);
    217int rose_rt_ioctl(unsigned int, void __user *);
    218void rose_link_failed(ax25_cb *, int);
    219int rose_route_frame(struct sk_buff *, ax25_cb *);
    220void rose_rt_free(void);
    221
    222/* rose_subr.c */
    223void rose_clear_queues(struct sock *);
    224void rose_frames_acked(struct sock *, unsigned short);
    225void rose_requeue_frames(struct sock *);
    226int rose_validate_nr(struct sock *, unsigned short);
    227void rose_write_internal(struct sock *, int);
    228int rose_decode(struct sk_buff *, int *, int *, int *, int *, int *);
    229int rose_parse_facilities(unsigned char *, unsigned int,
    230			  struct rose_facilities_struct *);
    231void rose_disconnect(struct sock *, int, int, int);
    232
    233/* rose_timer.c */
    234void rose_start_heartbeat(struct sock *);
    235void rose_start_t1timer(struct sock *);
    236void rose_start_t2timer(struct sock *);
    237void rose_start_t3timer(struct sock *);
    238void rose_start_hbtimer(struct sock *);
    239void rose_start_idletimer(struct sock *);
    240void rose_stop_heartbeat(struct sock *);
    241void rose_stop_timer(struct sock *);
    242void rose_stop_idletimer(struct sock *);
    243
    244/* sysctl_net_rose.c */
    245void rose_register_sysctl(void);
    246void rose_unregister_sysctl(void);
    247
    248#endif