|
Lines 47-56
Link Here
|
| 47 |
.Nm ksocket |
47 |
.Nm ksocket |
| 48 |
node is both a netgraph node and a |
48 |
node is both a netgraph node and a |
| 49 |
.Bx |
49 |
.Bx |
| 50 |
socket. The |
50 |
socket. |
|
|
51 |
The |
| 51 |
.Nm |
52 |
.Nm |
| 52 |
node type allows one to open a socket inside the kernel and have |
53 |
node type allows one to open a socket inside the kernel and have |
| 53 |
it appear as a Netgraph node. The |
54 |
it appear as a Netgraph node. |
|
|
55 |
The |
| 54 |
.Nm |
56 |
.Nm |
| 55 |
node type is the reverse of the socket node type (see |
57 |
node type is the reverse of the socket node type (see |
| 56 |
.Xr ng_socket 4 ) : |
58 |
.Xr ng_socket 4 ) : |
|
Lines 63-70
Link Here
|
| 63 |
.Pp |
65 |
.Pp |
| 64 |
A |
66 |
A |
| 65 |
.Nm |
67 |
.Nm |
| 66 |
node allows at most one hook connection. Connecting to the node is |
68 |
node allows at most one hook connection. |
| 67 |
equivalent to opening the associated socket. The name given to the hook |
69 |
Connecting to the node is |
|
|
70 |
equivalent to opening the associated socket. |
| 71 |
The name given to the hook |
| 68 |
determines what kind of socket the node will open (see below). |
72 |
determines what kind of socket the node will open (see below). |
| 69 |
When the hook is disconnected and/or the node is shutdown, the |
73 |
When the hook is disconnected and/or the node is shutdown, the |
| 70 |
associated socket is closed. |
74 |
associated socket is closed. |
|
Lines 80-86
Link Here
|
| 80 |
are the decimal equivalent of the same arguments to |
84 |
are the decimal equivalent of the same arguments to |
| 81 |
.Xr socket 2 . |
85 |
.Xr socket 2 . |
| 82 |
Alternately, aliases for the commonly used values are accepted as |
86 |
Alternately, aliases for the commonly used values are accepted as |
| 83 |
well. For example |
87 |
well. |
|
|
88 |
For example |
| 84 |
.Dv inet/dgram/udp |
89 |
.Dv inet/dgram/udp |
| 85 |
is a more readable but equivalent version of |
90 |
is a more readable but equivalent version of |
| 86 |
.Dv 2/2/17 . |
91 |
.Dv 2/2/17 . |
|
Lines 90-108
Link Here
|
| 90 |
.It Dv NGM_KSOCKET_BIND |
95 |
.It Dv NGM_KSOCKET_BIND |
| 91 |
This functions exactly like the |
96 |
This functions exactly like the |
| 92 |
.Xr bind 2 |
97 |
.Xr bind 2 |
| 93 |
system call. The |
98 |
system call. |
|
|
99 |
The |
| 94 |
.Dv "struct sockaddr" |
100 |
.Dv "struct sockaddr" |
| 95 |
socket address parameter should be supplied as an argument. |
101 |
socket address parameter should be supplied as an argument. |
| 96 |
.It Dv NGM_KSOCKET_LISTEN |
102 |
.It Dv NGM_KSOCKET_LISTEN |
| 97 |
This functions exactly like the |
103 |
This functions exactly like the |
| 98 |
.Xr listen 2 |
104 |
.Xr listen 2 |
| 99 |
system call. The backlog paramter (a single 32 bit |
105 |
system call. |
|
|
106 |
The backlog parameter (a single 32 bit |
| 100 |
.Dv int ) |
107 |
.Dv int ) |
| 101 |
should be supplied as an argument. |
108 |
should be supplied as an argument. |
| 102 |
.It Dv NGM_KSOCKET_CONNECT |
109 |
.It Dv NGM_KSOCKET_CONNECT |
| 103 |
This functions exactly like the |
110 |
This functions exactly like the |
| 104 |
.Xr connect 2 |
111 |
.Xr connect 2 |
| 105 |
system call. The |
112 |
system call. |
|
|
113 |
The |
| 106 |
.Dv "struct sockaddr" |
114 |
.Dv "struct sockaddr" |
| 107 |
destination address parameter should be supplied as an argument. |
115 |
destination address parameter should be supplied as an argument. |
| 108 |
.It Dv NGM_KSOCKET_ACCEPT |
116 |
.It Dv NGM_KSOCKET_ACCEPT |
|
Lines 110-122
Link Here
|
| 110 |
.It Dv NGM_KSOCKET_GETNAME |
118 |
.It Dv NGM_KSOCKET_GETNAME |
| 111 |
Equivalent to the |
119 |
Equivalent to the |
| 112 |
.Xr getsockname 2 |
120 |
.Xr getsockname 2 |
| 113 |
system call. The name is returned as a |
121 |
system call. |
|
|
122 |
The name is returned as a |
| 114 |
.Dv "struct sockaddr" |
123 |
.Dv "struct sockaddr" |
| 115 |
in the arguments field of the reply. |
124 |
in the arguments field of the reply. |
| 116 |
.It Dv NGM_KSOCKET_GETPEERNAME |
125 |
.It Dv NGM_KSOCKET_GETPEERNAME |
| 117 |
Equivalent to the |
126 |
Equivalent to the |
| 118 |
.Xr getpeername 2 |
127 |
.Xr getpeername 2 |
| 119 |
system call. The name is returned as a |
128 |
system call. |
|
|
129 |
The name is returned as a |
| 120 |
.Dv "struct sockaddr" |
130 |
.Dv "struct sockaddr" |
| 121 |
in the arguments field of the reply. |
131 |
in the arguments field of the reply. |
| 122 |
.It Dv NGM_KSOCKET_SETOPT |
132 |
.It Dv NGM_KSOCKET_SETOPT |
|
Lines 140-152
Link Here
|
| 140 |
in the argument field, the normal |
150 |
in the argument field, the normal |
| 141 |
.Tn ASCII |
151 |
.Tn ASCII |
| 142 |
equivalent of the C structure |
152 |
equivalent of the C structure |
| 143 |
is an acceptable form. For the |
153 |
is an acceptable form. |
|
|
154 |
For the |
| 144 |
.Dv PF_INET |
155 |
.Dv PF_INET |
| 145 |
and |
156 |
and |
| 146 |
.Dv PF_LOCAL |
157 |
.Dv PF_LOCAL |
| 147 |
address families, a more convenient form is also used, which is |
158 |
address families, a more convenient form is also used, which is |
| 148 |
the protocol family name, followed by a slash, followed by the actual |
159 |
the protocol family name, followed by a slash, followed by the actual |
| 149 |
address. For |
160 |
address. |
|
|
161 |
For |
| 150 |
.Dv PF_INET , |
162 |
.Dv PF_INET , |
| 151 |
the address is an IP address followed by an optional colon and port number. |
163 |
the address is an IP address followed by an optional colon and port number. |
| 152 |
For |
164 |
For |
|
Lines 167-173
Link Here
|
| 167 |
.Dv "struct ng_ksocket_sockopt" , |
179 |
.Dv "struct ng_ksocket_sockopt" , |
| 168 |
the normal |
180 |
the normal |
| 169 |
.Tn ASCII |
181 |
.Tn ASCII |
| 170 |
form for that structure is used. In the future, more |
182 |
form for that structure is used. |
|
|
183 |
In the future, more |
| 171 |
convenient encoding of the more common socket options may be supported. |
184 |
convenient encoding of the more common socket options may be supported. |
| 172 |
.Sh SHUTDOWN |
185 |
.Sh SHUTDOWN |
| 173 |
This node shuts down upon receipt of a |
186 |
This node shuts down upon receipt of a |