1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 #ifndef _SOCKINET_H
29 #define _SOCKINET_H
30
31 #ifndef _SOCK_H
32 #include "socket/sock.h"
33 #endif
34
35 #ifndef _PROTOCOL_H_
36 #include "protocol.h"
37 #endif
38
39 struct proto {
40 void *(*wmalloc)(struct sock *sk,
41 unsigned long size, int force,
42 int priority);
43 void *(*rmalloc)(struct sock *sk,
44 unsigned long size, int force,
45 int priority);
46 void (*wfree)(struct sock *sk, void *mem,
47 unsigned long size);
48 void (*rfree)(struct sock *sk, void *mem,
49 unsigned long size);
50 unsigned long (*rspace)(struct sock *sk);
51 unsigned long (*wspace)(struct sock *sk);
52 void (*close)(struct sock *sk, int timeout);
53 int (*read)(struct sock *sk, unsigned char *to,
54 int len, int nonblock, unsigned flags);
55 int (*write)(struct sock *sk, unsigned char *to,
56 int len, int nonblock, unsigned flags);
57 int (*sendto)(struct sock *sk,
58 unsigned char *from, int len, int noblock,
59 unsigned flags, struct sockaddr_in *usin,
60 int addr_len);
61 int (*recvfrom)(struct sock *sk,
62 unsigned char *from, int len, int noblock,
63 unsigned flags, struct sockaddr_in *usin,
64 int *addr_len);
65 int (*build_header)(struct sk_buff *skb,
66 unsigned long saddr,
67 unsigned long daddr,
68 struct device **dev, int type,
69 struct options *opt, int len,
70 int ttl, int tos);
71 int (*connect)(struct sock *sk,
72 struct sockaddr_in *usin, int addr_len);
73 struct sock *(*accept) (struct sock *sk, int flags);
74 void (*queue_xmit)(struct sock *sk,
75 struct device *dev, struct sk_buff *skb,
76 int free);
77 void (*retransmit)(struct sock *sk, int all);
78 void (*write_wakeup)(struct sock *sk);
79 void (*read_wakeup)(struct sock *sk);
80 int (*rcv)(struct sk_buff *buff, struct device *dev,
81 struct options *opt, unsigned long daddr,
82 unsigned short len, unsigned long saddr,
83 int redo, struct inet_protocol *protocol);
84 int (*select)(struct sock *sk, int which,
85 select_table *wait);
86 int (*ioctl)(struct sock *sk, int cmd,
87 unsigned long arg);
88 int (*init)(struct sock *sk);
89 void (*shutdown)(struct sock *sk, int how);
90 int (*setsockopt)(struct sock *sk, int level, int optname,
91 char *optval, int optlen);
92 int (*getsockopt)(struct sock *sk, int level, int optname,
93 char *optval, int *option);
94 unsigned short max_header;
95 unsigned long retransmits;
96 struct sock *sock_array[SOCK_ARRAY_SIZE];
97 char name[80];
98 };
99
100 extern void destroy_sock(struct sock *sk);
101 extern unsigned short get_new_socknum(struct proto *, unsigned short);
102 extern void put_sock(unsigned short, struct sock *);
103 extern void release_sock(struct sock *sk);
104 extern struct sock *get_sock(struct proto *, unsigned short,
105 unsigned long, unsigned short,
106 unsigned long);
107
108
109
110 extern struct sock *timer_base;
111
112 void delete_timer (struct sock *);
113 void reset_timer (struct sock *, int, unsigned long);
114 void net_timer (unsigned long);
115
116
117
118 #endif