Skip to content

Commit 7b3d45f

Browse files
committed
Add rules for ip and socket
1 parent 5f136d8 commit 7b3d45f

7 files changed

Lines changed: 81 additions & 0 deletions

File tree

rules/ip/ir_unsafe.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"f1": {
3+
"body": [
4+
{
5+
"text": "libc::IPPROTO_TCP"
6+
}
7+
],
8+
"return_type": {
9+
"type": "i32"
10+
}
11+
},
12+
"f2": {
13+
"body": [
14+
{
15+
"text": "libc::IPPROTO_UDP"
16+
}
17+
],
18+
"return_type": {
19+
"type": "i32"
20+
}
21+
},
22+
"f3": {
23+
"body": [
24+
{
25+
"text": "libc::IPPROTO_IP"
26+
}
27+
],
28+
"return_type": {
29+
"type": "i32"
30+
}
31+
}
32+
}

rules/ip/src.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#include <netinet/in.h>
2+
3+
int f1() {
4+
return IPPROTO_TCP;
5+
}
6+
7+
int f2() {
8+
return IPPROTO_UDP;
9+
}
10+
11+
int f3() {
12+
return IPPROTO_IP;
13+
}

rules/ip/tgt_unsafe.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
unsafe fn f1() -> i32 {
2+
libc::IPPROTO_TCP
3+
}
4+
5+
unsafe fn f2() -> i32 {
6+
libc::IPPROTO_UDP
7+
}
8+
9+
unsafe fn f3() -> i32 {
10+
libc::IPPROTO_IP
11+
}

rules/socket/ir_unsafe.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"f1": {
3+
"body": [
4+
{
5+
"text": "libc::MSG_NOSIGNAL"
6+
}
7+
],
8+
"return_type": {
9+
"type": "i32"
10+
}
11+
}
12+
}

rules/socket/src.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#include <sys/types.h>
2+
#include <sys/socket.h>
3+
4+
int f1() {
5+
return MSG_NOSIGNAL;
6+
}

rules/socket/tgt_unsafe.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
unsafe fn f1() -> i32 {
2+
libc::MSG_NOSIGNAL
3+
}

rules/src/modules.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ pub mod iomanip_tgt_unsafe;
4646
pub mod iostream_tgt_refcount;
4747
#[path = r#"../iostream/tgt_unsafe.rs"#]
4848
pub mod iostream_tgt_unsafe;
49+
#[path = r#"../ip/tgt_unsafe.rs"#]
50+
pub mod ip_tgt_unsafe;
4951
#[path = r#"../limits/tgt_unsafe.rs"#]
5052
pub mod limits_tgt_unsafe;
5153
#[path = r#"../map/tgt_refcount.rs"#]
@@ -58,6 +60,8 @@ pub mod math_tgt_unsafe;
5860
pub mod pair_tgt_refcount;
5961
#[path = r#"../pair/tgt_unsafe.rs"#]
6062
pub mod pair_tgt_unsafe;
63+
#[path = r#"../socket/tgt_unsafe.rs"#]
64+
pub mod socket_tgt_unsafe;
6165
#[path = r#"../stdio/tgt_refcount.rs"#]
6266
pub mod stdio_tgt_refcount;
6367
#[path = r#"../stdio/tgt_unsafe.rs"#]

0 commit comments

Comments
 (0)