sgx_socket.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * Copyright (C) 2019 Intel Corporation. All rights reserved.
  3. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. */
  5. #ifndef _SGX_SOCKET_H
  6. #define _SGX_SOCKET_H
  7. #include "sgx_file.h"
  8. #ifdef __cplusplus
  9. extern "C" {
  10. #endif
  11. #define SOL_SOCKET 1
  12. #define SOCK_STREAM 1
  13. #define SOCK_DGRAM 2
  14. #define SO_TYPE 3
  15. #define MSG_OOB 0x0001
  16. #define MSG_PEEK 0x0002
  17. #define MSG_DONTROUTE 0x0004
  18. #define MSG_CTRUNC 0x0008
  19. #define MSG_PROXY 0x0010
  20. #define MSG_TRUNC 0x0020
  21. #define MSG_DONTWAIT 0x0040
  22. #define MSG_EOR 0x0080
  23. #define MSG_WAITALL 0x0100
  24. #define MSG_FIN 0x0200
  25. #define MSG_SYN 0x0400
  26. #define MSG_CONFIRM 0x0800
  27. #define MSG_RST 0x1000
  28. #define MSG_ERRQUEUE 0x2000
  29. #define MSG_NOSIGNAL 0x4000
  30. #define MSG_MORE 0x8000
  31. #define MSG_WAITFORONE 0x10000
  32. #define MSG_BATCH 0x40000
  33. #define MSG_FASTOPEN 0x20000000
  34. #define MSG_CMSG_CLOEXEC 0x40000000
  35. #define SHUT_RD 0
  36. #define SHUT_WR 1
  37. #define SHUT_RDWR 2
  38. struct msghdr {
  39. void *msg_name;
  40. socklen_t msg_namelen;
  41. struct iovec *msg_iov;
  42. int msg_iovlen;
  43. void *msg_control;
  44. socklen_t msg_controllen;
  45. int msg_flags;
  46. };
  47. int socket(int domain, int type, int protocol);
  48. int getsockopt(int sockfd, int level, int optname,
  49. void *optval, socklen_t *optlen);
  50. ssize_t sendmsg(int sockfd, const struct msghdr *msg, int flags);
  51. ssize_t recvmsg(int sockfd, struct msghdr *msg, int flags);
  52. int shutdown(int sockfd, int how);
  53. #ifdef __cplusplus
  54. }
  55. #endif
  56. #endif /* end of _SGX_SOCKET_H */