Lines Matching defs:sock
48 #include <net/sock.h>
64 struct sock sk;
72 static int backlog_rcv(struct sock *sk, struct sk_buff *skb);
137 static void advance_rx_queue(struct sock *sk)
149 static void discard_rx_queue(struct sock *sk)
165 static void reject_rx_queue(struct sock *sk)
178 * @sock: pre-allocated socket structure
188 static int tipc_create(struct net *net, struct socket *sock, int protocol,
193 struct sock *sk;
204 switch (sock->type) {
239 sock->ops = ops;
240 sock->state = state;
242 sock_init_data(sock, sk);
249 if (sock->state == SS_READY) {
251 if (sock->type == SOCK_DGRAM)
261 * @sock: socket to destroy
276 static int release(struct socket *sock)
278 struct sock *sk = sock->sk;
299 while (sock->state != SS_DISCONNECTING) {
307 if ((sock->state == SS_CONNECTING) ||
308 (sock->state == SS_CONNECTED)) {
309 sock->state = SS_DISCONNECTING;
329 sock->state = SS_DISCONNECTING;
333 sock->sk = NULL;
341 * @sock: socket structure
355 static int bind(struct socket *sock, struct sockaddr *uaddr, int uaddr_len)
358 u32 portref = tipc_sk_port(sock->sk)->ref;
380 * @sock: socket structure
392 static int get_name(struct socket *sock, struct sockaddr *uaddr,
396 struct tipc_sock *tsock = tipc_sk(sock->sk);
399 if ((sock->state != SS_CONNECTED) &&
400 ((peer != 2) || (sock->state != SS_DISCONNECTING)))
420 * @sock: socket for which to calculate the poll bits
443 static unsigned int poll(struct file *file, struct socket *sock,
446 struct sock *sk = sock->sk;
452 (sock->state == SS_UNCONNECTED) ||
453 (sock->state == SS_DISCONNECTING))
458 if (sock->state == SS_DISCONNECTING)
499 * @sock: socket structure
511 static int send_msg(struct kiocb *iocb, struct socket *sock,
514 struct sock *sk = sock->sk;
529 needs_conn = (sock->state != SS_READY);
531 if (sock->state == SS_LISTENING) {
535 if (sock->state != SS_UNCONNECTED) {
540 ((sock->type == SOCK_STREAM) && (total_len != 0))) {
585 sock->state = SS_CONNECTING;
610 * @sock: socket structure
619 static int send_packet(struct kiocb *iocb, struct socket *sock,
622 struct sock *sk = sock->sk;
630 return send_msg(iocb, sock, m, total_len);
636 if (unlikely(sock->state != SS_CONNECTED)) {
637 if (sock->state == SS_DISCONNECTING)
668 * @sock: socket structure
678 static int send_stream(struct kiocb *iocb, struct socket *sock,
681 struct sock *sk = sock->sk;
698 if (unlikely(sock->state != SS_CONNECTED)) {
699 if (sock->state == SS_UNCONNECTED) {
700 res = send_packet(NULL, sock, m, total_len);
702 } else if (sock->state == SS_DISCONNECTING) {
746 if ((res = send_packet(NULL, sock, &my_msg, 0)) < 0) {
766 * @sock: socket structure
772 static int auto_connect(struct socket *sock, struct tipc_msg *msg)
774 struct tipc_sock *tsock = tipc_sk(sock->sk);
777 sock->state = SS_DISCONNECTING;
785 sock->state = SS_CONNECTED;
894 static int recv_msg(struct kiocb *iocb, struct socket *sock,
897 struct sock *sk = sock->sk;
915 if (unlikely(sock->state == SS_UNCONNECTED)) {
925 if (sock->state == SS_DISCONNECTING) {
936 (sock->state == SS_DISCONNECTING)));
951 if (unlikely(sock->state == SS_CONNECTING)) {
952 res = auto_connect(sock, msg);
988 if ((sock->state == SS_READY) ||
998 if ((sock->state != SS_READY) &&
1021 static int recv_stream(struct kiocb *iocb, struct socket *sock,
1024 struct sock *sk = sock->sk;
1047 if (unlikely((sock->state == SS_UNCONNECTED) ||
1048 (sock->state == SS_CONNECTING))) {
1058 if (sock->state == SS_DISCONNECTING) {
1069 (sock->state == SS_DISCONNECTING)));
1193 static u32 filter_rcv(struct sock *sk, struct sk_buff *buf)
1195 struct socket *sock = sk->sk_socket;
1207 if (sock->state == SS_READY) {
1217 if (sock->state == SS_CONNECTED) {
1223 else if (sock->state == SS_CONNECTING) {
1229 else if (sock->state == SS_LISTENING) {
1235 else if (sock->state == SS_DISCONNECTING) {
1239 else /* (sock->state == SS_UNCONNECTED) */ {
1269 if (unlikely(msg_errcode(msg) && (sock->state == SS_CONNECTED))) {
1270 sock->state = SS_DISCONNECTING;
1289 static int backlog_rcv(struct sock *sk, struct sk_buff *buf)
1311 struct sock *sk = (struct sock *)tport->usr_handle;
1344 struct sock *sk = (struct sock *)tport->usr_handle;
1352 * @sock: socket structure
1360 static int connect(struct socket *sock, struct sockaddr *dest, int destlen,
1363 struct sock *sk = sock->sk;
1374 if (sock->state == SS_READY) {
1388 if (sock->state == SS_LISTENING) {
1392 if (sock->state == SS_CONNECTING) {
1396 if (sock->state != SS_UNCONNECTED) {
1421 res = send_msg(NULL, sock, &m, 0);
1431 (sock->state != SS_CONNECTING)),
1439 res = auto_connect(sock, msg);
1445 if (sock->state == SS_CONNECTED) {
1456 sock->state = SS_DISCONNECTING;
1466 * @sock: socket structure
1472 static int listen(struct socket *sock, int len)
1474 struct sock *sk = sock->sk;
1479 if (sock->state == SS_READY)
1481 else if (sock->state != SS_UNCONNECTED)
1484 sock->state = SS_LISTENING;
1494 * @sock: listening socket
1501 static int accept(struct socket *sock, struct socket *new_sock, int flags)
1503 struct sock *sk = sock->sk;
1509 if (sock->state == SS_READY) {
1513 if (sock->state != SS_LISTENING) {
1533 res = tipc_create(sock_net(sock->sk), new_sock, 0, 0);
1535 struct sock *new_sk = new_sock->sk;
1587 * @sock: socket structure
1595 static int shutdown(struct socket *sock, int how)
1597 struct sock *sk = sock->sk;
1607 switch (sock->state) {
1626 sock->state = SS_DISCONNECTING;
1650 * @sock: socket structure
1662 static int setsockopt(struct socket *sock,
1665 struct sock *sk = sock->sk;
1670 if ((lvl == IPPROTO_TCP) && (sock->type == SOCK_STREAM))
1686 if (sock->type != SOCK_STREAM)
1709 * @sock: socket structure
1721 static int getsockopt(struct socket *sock,
1724 struct sock *sk = sock->sk;
1730 if ((lvl == IPPROTO_TCP) && (sock->type == SOCK_STREAM))