• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /*
3  * Copyright (c) 2022 Huawei Device Co., Ltd.
4  *
5  * Description: Definitions for the structure
6  * associated with NewIP.
7  *
8  * Author: Yang Yanjun <yangyanjun@huawei.com>
9  *
10  * Data: 2022-09-06
11  */
12 #ifndef _NIP_UAPI_H
13 #define _NIP_UAPI_H
14 
15 #include "nip.h"
16 
17 /* The following structure must be larger than V4. System calls use V4.
18  * If the definition is smaller than V4, the read process will have memory overruns
19  * v4: include\linux\socket.h --> sockaddr (16Byte)
20  */
21 #define POD_SOCKADDR_SIZE 3
22 struct sockaddr_nin {
23 	unsigned short sin_family; /* [2Byte] AF_NINET */
24 	unsigned short sin_port;   /* [2Byte] Transport layer port, big-endian */
25 	struct nip_addr sin_addr;  /* [9Byte] NIP address */
26 
27 	unsigned char sin_zero[POD_SOCKADDR_SIZE]; /* [3Byte] Byte alignment */
28 };
29 
30 struct nip_ifreq {
31 	struct nip_addr ifrn_addr;
32 	int ifrn_ifindex;
33 };
34 
35 struct thread_args {
36 	int cfd;
37 	struct sockaddr_nin si_server;
38 };
39 
40 #endif /* _NIP_UAPI_H */
41