svcsock.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * linux/include/linux/sunrpc/svcsock.h
  3. *
  4. * RPC server socket I/O.
  5. *
  6. * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
  7. */
  8. #ifndef SUNRPC_SVCSOCK_H
  9. #define SUNRPC_SVCSOCK_H
  10. #include <linux/sunrpc/svc.h>
  11. #include <linux/sunrpc/svc_xprt.h>
  12. /*
  13. * RPC server socket.
  14. */
  15. struct svc_sock {
  16. struct svc_xprt sk_xprt;
  17. struct socket * sk_sock; /* berkeley socket layer */
  18. struct sock * sk_sk; /* INET layer */
  19. spinlock_t sk_lock; /* protects sk_deferred and
  20. * sk_info_authunix */
  21. struct list_head sk_deferred; /* deferred requests that need to
  22. * be revisted */
  23. /* We keep the old state_change and data_ready CB's here */
  24. void (*sk_ostate)(struct sock *);
  25. void (*sk_odata)(struct sock *, int bytes);
  26. void (*sk_owspace)(struct sock *);
  27. /* private TCP part */
  28. int sk_reclen; /* length of record */
  29. int sk_tcplen; /* current read length */
  30. time_t sk_lastrecv; /* time of last received request */
  31. /* cache of various info for TCP sockets */
  32. void *sk_info_authunix;
  33. struct sockaddr_storage sk_local; /* local address */
  34. struct sockaddr_storage sk_remote; /* remote peer's address */
  35. int sk_remotelen; /* length of address */
  36. };
  37. /*
  38. * Function prototypes.
  39. */
  40. void svc_close_all(struct list_head *);
  41. int svc_recv(struct svc_rqst *, long);
  42. int svc_send(struct svc_rqst *);
  43. void svc_drop(struct svc_rqst *);
  44. void svc_sock_update_bufs(struct svc_serv *serv);
  45. int svc_sock_names(char *buf, struct svc_serv *serv, char *toclose);
  46. int svc_addsock(struct svc_serv *serv,
  47. int fd,
  48. char *name_return,
  49. int *proto);
  50. void svc_init_xprt_sock(void);
  51. void svc_cleanup_xprt_sock(void);
  52. /*
  53. * svc_makesock socket characteristics
  54. */
  55. #define SVC_SOCK_DEFAULTS (0U)
  56. #define SVC_SOCK_ANONYMOUS (1U << 0) /* don't register with pmap */
  57. #define SVC_SOCK_TEMPORARY (1U << 1) /* flag socket as temporary */
  58. #endif /* SUNRPC_SVCSOCK_H */