/src/open5gs/lib/core/ogs-pkbuf.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> |
3 | | * |
4 | | * This file is part of Open5GS. |
5 | | * |
6 | | * This program is free software: you can redistribute it and/or modify |
7 | | * it under the terms of the GNU Affero General Public License as published by |
8 | | * the Free Software Foundation, either version 3 of the License, or |
9 | | * (at your option) any later version. |
10 | | * |
11 | | * This program is distributed in the hope that it will be useful, |
12 | | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | | * GNU General Public License for more details. |
15 | | * |
16 | | * You should have received a copy of the GNU General Public License |
17 | | * along with this program. If not, see <https://www.gnu.org/licenses/>. |
18 | | */ |
19 | | |
20 | | #if !defined(OGS_CORE_INSIDE) && !defined(OGS_CORE_COMPILATION) |
21 | | #error "This header cannot be included directly." |
22 | | #endif |
23 | | |
24 | | #ifndef OGS_PKBUF_H |
25 | | #define OGS_PKBUF_H |
26 | | |
27 | | #ifdef __cplusplus |
28 | | extern "C" { |
29 | | #endif |
30 | | |
31 | | typedef struct ogs_cluster_s { |
32 | | unsigned char *buffer; |
33 | | unsigned int size; |
34 | | |
35 | | unsigned int reference_count; |
36 | | } ogs_cluster_t; |
37 | | |
38 | | #if OGS_USE_TALLOC == 1 |
39 | | typedef void ogs_pkbuf_pool_t; |
40 | | #else |
41 | | typedef struct ogs_pkbuf_pool_s ogs_pkbuf_pool_t; |
42 | | #endif |
43 | | typedef struct ogs_pkbuf_s { |
44 | | ogs_lnode_t lnode; |
45 | | |
46 | | /* Currently it is used in SCTP stream number and PPID. */ |
47 | | uint64_t param[2]; |
48 | | |
49 | | ogs_cluster_t *cluster; |
50 | | |
51 | | unsigned int len; |
52 | | |
53 | | unsigned char *head; |
54 | | unsigned char *tail; |
55 | | unsigned char *data; |
56 | | unsigned char *end; |
57 | | |
58 | | const char *file_line; |
59 | | |
60 | | ogs_pkbuf_pool_t *pool; |
61 | | |
62 | | unsigned char _data[0]; /*!< optional immediate data array */ |
63 | | } ogs_pkbuf_t; |
64 | | |
65 | | typedef struct ogs_pkbuf_config_s { |
66 | | int cluster_128_pool; |
67 | | int cluster_256_pool; |
68 | | int cluster_512_pool; |
69 | | int cluster_1024_pool; |
70 | | int cluster_2048_pool; |
71 | | int cluster_8192_pool; |
72 | | int cluster_32768_pool; |
73 | | int cluster_big_pool; |
74 | | } ogs_pkbuf_config_t; |
75 | | |
76 | | void ogs_pkbuf_init(void); |
77 | | void ogs_pkbuf_final(void); |
78 | | |
79 | | void ogs_pkbuf_default_init(ogs_pkbuf_config_t *config); |
80 | | void ogs_pkbuf_default_create(ogs_pkbuf_config_t *config); |
81 | | void ogs_pkbuf_default_destroy(void); |
82 | | |
83 | | ogs_pkbuf_pool_t *ogs_pkbuf_pool_create(ogs_pkbuf_config_t *config); |
84 | | void ogs_pkbuf_pool_destroy(ogs_pkbuf_pool_t *pool); |
85 | | |
86 | | #define ogs_pkbuf_alloc(pool, size) \ |
87 | 468 | ogs_pkbuf_alloc_debug(pool, size, OGS_FILE_LINE) |
88 | | ogs_pkbuf_t *ogs_pkbuf_alloc_debug( |
89 | | ogs_pkbuf_pool_t *pool, unsigned int size, const char *file_line); |
90 | | void ogs_pkbuf_free(ogs_pkbuf_t *pkbuf); |
91 | | |
92 | | void *ogs_pkbuf_put_data( |
93 | | ogs_pkbuf_t *pkbuf, const void *data, unsigned int len); |
94 | | #define ogs_pkbuf_copy(pkbuf) \ |
95 | | ogs_pkbuf_copy_debug(pkbuf, OGS_FILE_LINE) |
96 | | ogs_pkbuf_t *ogs_pkbuf_copy_debug(ogs_pkbuf_t *pkbuf, const char *file_line); |
97 | | |
98 | | static ogs_inline int ogs_pkbuf_tailroom(const ogs_pkbuf_t *pkbuf) |
99 | 468 | { |
100 | 468 | return pkbuf->end - pkbuf->tail; |
101 | 468 | } Unexecuted instantiation: gtp-message-fuzz.c:ogs_pkbuf_tailroom Unexecuted instantiation: context.c:ogs_pkbuf_tailroom Unexecuted instantiation: xact.c:ogs_pkbuf_tailroom Unexecuted instantiation: conv.c:ogs_pkbuf_tailroom Unexecuted instantiation: message.c:ogs_pkbuf_tailroom Unexecuted instantiation: path.c:ogs_pkbuf_tailroom Unexecuted instantiation: build.c:ogs_pkbuf_tailroom Unexecuted instantiation: types.c:ogs_pkbuf_tailroom Unexecuted instantiation: ogs-abort.c:ogs_pkbuf_tailroom Unexecuted instantiation: ogs-strings.c:ogs_pkbuf_tailroom Unexecuted instantiation: ogs-conv.c:ogs_pkbuf_tailroom Unexecuted instantiation: ogs-log.c:ogs_pkbuf_tailroom ogs-pkbuf.c:ogs_pkbuf_tailroom Line | Count | Source | 99 | 468 | { | 100 | 468 | return pkbuf->end - pkbuf->tail; | 101 | 468 | } |
Unexecuted instantiation: ogs-memory.c:ogs_pkbuf_tailroom Unexecuted instantiation: ogs-timer.c:ogs_pkbuf_tailroom Unexecuted instantiation: ogs-sockaddr.c:ogs_pkbuf_tailroom Unexecuted instantiation: ogs-socket.c:ogs_pkbuf_tailroom Unexecuted instantiation: ogs-socknode.c:ogs_pkbuf_tailroom Unexecuted instantiation: ogs-udp.c:ogs_pkbuf_tailroom Unexecuted instantiation: ogs-poll.c:ogs_pkbuf_tailroom Unexecuted instantiation: ogs-tlv-msg.c:ogs_pkbuf_tailroom Unexecuted instantiation: ogs-core.c:ogs_pkbuf_tailroom Unexecuted instantiation: ogs-epoll.c:ogs_pkbuf_tailroom Unexecuted instantiation: ogs-errno.c:ogs_pkbuf_tailroom Unexecuted instantiation: ogs-time.c:ogs_pkbuf_tailroom Unexecuted instantiation: ogs-rbtree.c:ogs_pkbuf_tailroom Unexecuted instantiation: ogs-sockopt.c:ogs_pkbuf_tailroom Unexecuted instantiation: ogs-notify.c:ogs_pkbuf_tailroom Unexecuted instantiation: ogs-tlv.c:ogs_pkbuf_tailroom Unexecuted instantiation: ogs-hash.c:ogs_pkbuf_tailroom Unexecuted instantiation: ogs-yaml.c:ogs_pkbuf_tailroom Unexecuted instantiation: ogs-context.c:ogs_pkbuf_tailroom Unexecuted instantiation: ogs-config.c:ogs_pkbuf_tailroom Unexecuted instantiation: ogs-init.c:ogs_pkbuf_tailroom Unexecuted instantiation: ogs-queue.c:ogs_pkbuf_tailroom Unexecuted instantiation: ogs-env.c:ogs_pkbuf_tailroom |
102 | | |
103 | | static ogs_inline int ogs_pkbuf_headroom(const ogs_pkbuf_t *pkbuf) |
104 | 463 | { |
105 | 463 | return pkbuf->data - pkbuf->head; |
106 | 463 | } Unexecuted instantiation: gtp-message-fuzz.c:ogs_pkbuf_headroom Unexecuted instantiation: context.c:ogs_pkbuf_headroom Unexecuted instantiation: xact.c:ogs_pkbuf_headroom Unexecuted instantiation: conv.c:ogs_pkbuf_headroom message.c:ogs_pkbuf_headroom Line | Count | Source | 104 | 463 | { | 105 | 463 | return pkbuf->data - pkbuf->head; | 106 | 463 | } |
Unexecuted instantiation: path.c:ogs_pkbuf_headroom Unexecuted instantiation: build.c:ogs_pkbuf_headroom Unexecuted instantiation: types.c:ogs_pkbuf_headroom Unexecuted instantiation: ogs-abort.c:ogs_pkbuf_headroom Unexecuted instantiation: ogs-strings.c:ogs_pkbuf_headroom Unexecuted instantiation: ogs-conv.c:ogs_pkbuf_headroom Unexecuted instantiation: ogs-log.c:ogs_pkbuf_headroom Unexecuted instantiation: ogs-pkbuf.c:ogs_pkbuf_headroom Unexecuted instantiation: ogs-memory.c:ogs_pkbuf_headroom Unexecuted instantiation: ogs-timer.c:ogs_pkbuf_headroom Unexecuted instantiation: ogs-sockaddr.c:ogs_pkbuf_headroom Unexecuted instantiation: ogs-socket.c:ogs_pkbuf_headroom Unexecuted instantiation: ogs-socknode.c:ogs_pkbuf_headroom Unexecuted instantiation: ogs-udp.c:ogs_pkbuf_headroom Unexecuted instantiation: ogs-poll.c:ogs_pkbuf_headroom Unexecuted instantiation: ogs-tlv-msg.c:ogs_pkbuf_headroom Unexecuted instantiation: ogs-core.c:ogs_pkbuf_headroom Unexecuted instantiation: ogs-epoll.c:ogs_pkbuf_headroom Unexecuted instantiation: ogs-errno.c:ogs_pkbuf_headroom Unexecuted instantiation: ogs-time.c:ogs_pkbuf_headroom Unexecuted instantiation: ogs-rbtree.c:ogs_pkbuf_headroom Unexecuted instantiation: ogs-sockopt.c:ogs_pkbuf_headroom Unexecuted instantiation: ogs-notify.c:ogs_pkbuf_headroom Unexecuted instantiation: ogs-tlv.c:ogs_pkbuf_headroom Unexecuted instantiation: ogs-hash.c:ogs_pkbuf_headroom Unexecuted instantiation: ogs-yaml.c:ogs_pkbuf_headroom Unexecuted instantiation: ogs-context.c:ogs_pkbuf_headroom Unexecuted instantiation: ogs-config.c:ogs_pkbuf_headroom Unexecuted instantiation: ogs-init.c:ogs_pkbuf_headroom Unexecuted instantiation: ogs-queue.c:ogs_pkbuf_headroom Unexecuted instantiation: ogs-env.c:ogs_pkbuf_headroom |
107 | | |
108 | | static ogs_inline void ogs_pkbuf_reserve(ogs_pkbuf_t *pkbuf, int len) |
109 | 0 | { |
110 | 0 | pkbuf->data += len; |
111 | 0 | pkbuf->tail += len; |
112 | 0 | } Unexecuted instantiation: gtp-message-fuzz.c:ogs_pkbuf_reserve Unexecuted instantiation: context.c:ogs_pkbuf_reserve Unexecuted instantiation: xact.c:ogs_pkbuf_reserve Unexecuted instantiation: conv.c:ogs_pkbuf_reserve Unexecuted instantiation: message.c:ogs_pkbuf_reserve Unexecuted instantiation: path.c:ogs_pkbuf_reserve Unexecuted instantiation: build.c:ogs_pkbuf_reserve Unexecuted instantiation: types.c:ogs_pkbuf_reserve Unexecuted instantiation: ogs-abort.c:ogs_pkbuf_reserve Unexecuted instantiation: ogs-strings.c:ogs_pkbuf_reserve Unexecuted instantiation: ogs-conv.c:ogs_pkbuf_reserve Unexecuted instantiation: ogs-log.c:ogs_pkbuf_reserve Unexecuted instantiation: ogs-pkbuf.c:ogs_pkbuf_reserve Unexecuted instantiation: ogs-memory.c:ogs_pkbuf_reserve Unexecuted instantiation: ogs-timer.c:ogs_pkbuf_reserve Unexecuted instantiation: ogs-sockaddr.c:ogs_pkbuf_reserve Unexecuted instantiation: ogs-socket.c:ogs_pkbuf_reserve Unexecuted instantiation: ogs-socknode.c:ogs_pkbuf_reserve Unexecuted instantiation: ogs-udp.c:ogs_pkbuf_reserve Unexecuted instantiation: ogs-poll.c:ogs_pkbuf_reserve Unexecuted instantiation: ogs-tlv-msg.c:ogs_pkbuf_reserve Unexecuted instantiation: ogs-core.c:ogs_pkbuf_reserve Unexecuted instantiation: ogs-epoll.c:ogs_pkbuf_reserve Unexecuted instantiation: ogs-errno.c:ogs_pkbuf_reserve Unexecuted instantiation: ogs-time.c:ogs_pkbuf_reserve Unexecuted instantiation: ogs-rbtree.c:ogs_pkbuf_reserve Unexecuted instantiation: ogs-sockopt.c:ogs_pkbuf_reserve Unexecuted instantiation: ogs-notify.c:ogs_pkbuf_reserve Unexecuted instantiation: ogs-tlv.c:ogs_pkbuf_reserve Unexecuted instantiation: ogs-hash.c:ogs_pkbuf_reserve Unexecuted instantiation: ogs-yaml.c:ogs_pkbuf_reserve Unexecuted instantiation: ogs-context.c:ogs_pkbuf_reserve Unexecuted instantiation: ogs-config.c:ogs_pkbuf_reserve Unexecuted instantiation: ogs-init.c:ogs_pkbuf_reserve Unexecuted instantiation: ogs-queue.c:ogs_pkbuf_reserve Unexecuted instantiation: ogs-env.c:ogs_pkbuf_reserve |
113 | | |
114 | | static ogs_inline void *ogs_pkbuf_put(ogs_pkbuf_t *pkbuf, unsigned int len) |
115 | 468 | { |
116 | 468 | void *tmp = pkbuf->tail; |
117 | | |
118 | 468 | if (ogs_unlikely(ogs_pkbuf_tailroom(pkbuf) < (int)len)) |
119 | 0 | ogs_assert_if_reached(); |
120 | | |
121 | 468 | pkbuf->tail += len; |
122 | 468 | pkbuf->len += len; |
123 | | |
124 | 468 | return tmp; |
125 | 468 | } Unexecuted instantiation: gtp-message-fuzz.c:ogs_pkbuf_put Unexecuted instantiation: context.c:ogs_pkbuf_put Unexecuted instantiation: xact.c:ogs_pkbuf_put Unexecuted instantiation: conv.c:ogs_pkbuf_put Unexecuted instantiation: message.c:ogs_pkbuf_put Unexecuted instantiation: path.c:ogs_pkbuf_put Unexecuted instantiation: build.c:ogs_pkbuf_put Unexecuted instantiation: types.c:ogs_pkbuf_put Unexecuted instantiation: ogs-abort.c:ogs_pkbuf_put Unexecuted instantiation: ogs-strings.c:ogs_pkbuf_put Unexecuted instantiation: ogs-conv.c:ogs_pkbuf_put Unexecuted instantiation: ogs-log.c:ogs_pkbuf_put ogs-pkbuf.c:ogs_pkbuf_put Line | Count | Source | 115 | 468 | { | 116 | 468 | void *tmp = pkbuf->tail; | 117 | | | 118 | 468 | if (ogs_unlikely(ogs_pkbuf_tailroom(pkbuf) < (int)len)) | 119 | 0 | ogs_assert_if_reached(); | 120 | | | 121 | 468 | pkbuf->tail += len; | 122 | 468 | pkbuf->len += len; | 123 | | | 124 | 468 | return tmp; | 125 | 468 | } |
Unexecuted instantiation: ogs-memory.c:ogs_pkbuf_put Unexecuted instantiation: ogs-timer.c:ogs_pkbuf_put Unexecuted instantiation: ogs-sockaddr.c:ogs_pkbuf_put Unexecuted instantiation: ogs-socket.c:ogs_pkbuf_put Unexecuted instantiation: ogs-socknode.c:ogs_pkbuf_put Unexecuted instantiation: ogs-udp.c:ogs_pkbuf_put Unexecuted instantiation: ogs-poll.c:ogs_pkbuf_put Unexecuted instantiation: ogs-tlv-msg.c:ogs_pkbuf_put Unexecuted instantiation: ogs-core.c:ogs_pkbuf_put Unexecuted instantiation: ogs-epoll.c:ogs_pkbuf_put Unexecuted instantiation: ogs-errno.c:ogs_pkbuf_put Unexecuted instantiation: ogs-time.c:ogs_pkbuf_put Unexecuted instantiation: ogs-rbtree.c:ogs_pkbuf_put Unexecuted instantiation: ogs-sockopt.c:ogs_pkbuf_put Unexecuted instantiation: ogs-notify.c:ogs_pkbuf_put Unexecuted instantiation: ogs-tlv.c:ogs_pkbuf_put Unexecuted instantiation: ogs-hash.c:ogs_pkbuf_put Unexecuted instantiation: ogs-yaml.c:ogs_pkbuf_put Unexecuted instantiation: ogs-context.c:ogs_pkbuf_put Unexecuted instantiation: ogs-config.c:ogs_pkbuf_put Unexecuted instantiation: ogs-init.c:ogs_pkbuf_put Unexecuted instantiation: ogs-queue.c:ogs_pkbuf_put Unexecuted instantiation: ogs-env.c:ogs_pkbuf_put |
126 | | |
127 | | static ogs_inline void ogs_pkbuf_put_u8(ogs_pkbuf_t *pkbuf, uint8_t val) |
128 | 0 | { |
129 | 0 | *(uint8_t *)ogs_pkbuf_put(pkbuf, 1) = val; |
130 | 0 | } Unexecuted instantiation: gtp-message-fuzz.c:ogs_pkbuf_put_u8 Unexecuted instantiation: context.c:ogs_pkbuf_put_u8 Unexecuted instantiation: xact.c:ogs_pkbuf_put_u8 Unexecuted instantiation: conv.c:ogs_pkbuf_put_u8 Unexecuted instantiation: message.c:ogs_pkbuf_put_u8 Unexecuted instantiation: path.c:ogs_pkbuf_put_u8 Unexecuted instantiation: build.c:ogs_pkbuf_put_u8 Unexecuted instantiation: types.c:ogs_pkbuf_put_u8 Unexecuted instantiation: ogs-abort.c:ogs_pkbuf_put_u8 Unexecuted instantiation: ogs-strings.c:ogs_pkbuf_put_u8 Unexecuted instantiation: ogs-conv.c:ogs_pkbuf_put_u8 Unexecuted instantiation: ogs-log.c:ogs_pkbuf_put_u8 Unexecuted instantiation: ogs-pkbuf.c:ogs_pkbuf_put_u8 Unexecuted instantiation: ogs-memory.c:ogs_pkbuf_put_u8 Unexecuted instantiation: ogs-timer.c:ogs_pkbuf_put_u8 Unexecuted instantiation: ogs-sockaddr.c:ogs_pkbuf_put_u8 Unexecuted instantiation: ogs-socket.c:ogs_pkbuf_put_u8 Unexecuted instantiation: ogs-socknode.c:ogs_pkbuf_put_u8 Unexecuted instantiation: ogs-udp.c:ogs_pkbuf_put_u8 Unexecuted instantiation: ogs-poll.c:ogs_pkbuf_put_u8 Unexecuted instantiation: ogs-tlv-msg.c:ogs_pkbuf_put_u8 Unexecuted instantiation: ogs-core.c:ogs_pkbuf_put_u8 Unexecuted instantiation: ogs-epoll.c:ogs_pkbuf_put_u8 Unexecuted instantiation: ogs-errno.c:ogs_pkbuf_put_u8 Unexecuted instantiation: ogs-time.c:ogs_pkbuf_put_u8 Unexecuted instantiation: ogs-rbtree.c:ogs_pkbuf_put_u8 Unexecuted instantiation: ogs-sockopt.c:ogs_pkbuf_put_u8 Unexecuted instantiation: ogs-notify.c:ogs_pkbuf_put_u8 Unexecuted instantiation: ogs-tlv.c:ogs_pkbuf_put_u8 Unexecuted instantiation: ogs-hash.c:ogs_pkbuf_put_u8 Unexecuted instantiation: ogs-yaml.c:ogs_pkbuf_put_u8 Unexecuted instantiation: ogs-context.c:ogs_pkbuf_put_u8 Unexecuted instantiation: ogs-config.c:ogs_pkbuf_put_u8 Unexecuted instantiation: ogs-init.c:ogs_pkbuf_put_u8 Unexecuted instantiation: ogs-queue.c:ogs_pkbuf_put_u8 Unexecuted instantiation: ogs-env.c:ogs_pkbuf_put_u8 |
131 | | |
132 | | static ogs_inline void ogs_pkbuf_put_u16(ogs_pkbuf_t *pkbuf, uint16_t val) |
133 | 0 | { |
134 | 0 | uint8_t *p = ogs_pkbuf_put(pkbuf, 2); |
135 | 0 | uint16_t tmp = htobe16(val); |
136 | 0 | memcpy(p, &tmp, 2); |
137 | 0 | } Unexecuted instantiation: gtp-message-fuzz.c:ogs_pkbuf_put_u16 Unexecuted instantiation: context.c:ogs_pkbuf_put_u16 Unexecuted instantiation: xact.c:ogs_pkbuf_put_u16 Unexecuted instantiation: conv.c:ogs_pkbuf_put_u16 Unexecuted instantiation: message.c:ogs_pkbuf_put_u16 Unexecuted instantiation: path.c:ogs_pkbuf_put_u16 Unexecuted instantiation: build.c:ogs_pkbuf_put_u16 Unexecuted instantiation: types.c:ogs_pkbuf_put_u16 Unexecuted instantiation: ogs-abort.c:ogs_pkbuf_put_u16 Unexecuted instantiation: ogs-strings.c:ogs_pkbuf_put_u16 Unexecuted instantiation: ogs-conv.c:ogs_pkbuf_put_u16 Unexecuted instantiation: ogs-log.c:ogs_pkbuf_put_u16 Unexecuted instantiation: ogs-pkbuf.c:ogs_pkbuf_put_u16 Unexecuted instantiation: ogs-memory.c:ogs_pkbuf_put_u16 Unexecuted instantiation: ogs-timer.c:ogs_pkbuf_put_u16 Unexecuted instantiation: ogs-sockaddr.c:ogs_pkbuf_put_u16 Unexecuted instantiation: ogs-socket.c:ogs_pkbuf_put_u16 Unexecuted instantiation: ogs-socknode.c:ogs_pkbuf_put_u16 Unexecuted instantiation: ogs-udp.c:ogs_pkbuf_put_u16 Unexecuted instantiation: ogs-poll.c:ogs_pkbuf_put_u16 Unexecuted instantiation: ogs-tlv-msg.c:ogs_pkbuf_put_u16 Unexecuted instantiation: ogs-core.c:ogs_pkbuf_put_u16 Unexecuted instantiation: ogs-epoll.c:ogs_pkbuf_put_u16 Unexecuted instantiation: ogs-errno.c:ogs_pkbuf_put_u16 Unexecuted instantiation: ogs-time.c:ogs_pkbuf_put_u16 Unexecuted instantiation: ogs-rbtree.c:ogs_pkbuf_put_u16 Unexecuted instantiation: ogs-sockopt.c:ogs_pkbuf_put_u16 Unexecuted instantiation: ogs-notify.c:ogs_pkbuf_put_u16 Unexecuted instantiation: ogs-tlv.c:ogs_pkbuf_put_u16 Unexecuted instantiation: ogs-hash.c:ogs_pkbuf_put_u16 Unexecuted instantiation: ogs-yaml.c:ogs_pkbuf_put_u16 Unexecuted instantiation: ogs-context.c:ogs_pkbuf_put_u16 Unexecuted instantiation: ogs-config.c:ogs_pkbuf_put_u16 Unexecuted instantiation: ogs-init.c:ogs_pkbuf_put_u16 Unexecuted instantiation: ogs-queue.c:ogs_pkbuf_put_u16 Unexecuted instantiation: ogs-env.c:ogs_pkbuf_put_u16 |
138 | | |
139 | | static ogs_inline void ogs_pkbuf_put_u32(ogs_pkbuf_t *pkbuf, uint32_t val) |
140 | 0 | { |
141 | 0 | uint8_t *p = ogs_pkbuf_put(pkbuf, 4); |
142 | 0 | uint32_t tmp = htobe32(val); |
143 | 0 | memcpy(p, &tmp, 4); |
144 | 0 | } Unexecuted instantiation: gtp-message-fuzz.c:ogs_pkbuf_put_u32 Unexecuted instantiation: context.c:ogs_pkbuf_put_u32 Unexecuted instantiation: xact.c:ogs_pkbuf_put_u32 Unexecuted instantiation: conv.c:ogs_pkbuf_put_u32 Unexecuted instantiation: message.c:ogs_pkbuf_put_u32 Unexecuted instantiation: path.c:ogs_pkbuf_put_u32 Unexecuted instantiation: build.c:ogs_pkbuf_put_u32 Unexecuted instantiation: types.c:ogs_pkbuf_put_u32 Unexecuted instantiation: ogs-abort.c:ogs_pkbuf_put_u32 Unexecuted instantiation: ogs-strings.c:ogs_pkbuf_put_u32 Unexecuted instantiation: ogs-conv.c:ogs_pkbuf_put_u32 Unexecuted instantiation: ogs-log.c:ogs_pkbuf_put_u32 Unexecuted instantiation: ogs-pkbuf.c:ogs_pkbuf_put_u32 Unexecuted instantiation: ogs-memory.c:ogs_pkbuf_put_u32 Unexecuted instantiation: ogs-timer.c:ogs_pkbuf_put_u32 Unexecuted instantiation: ogs-sockaddr.c:ogs_pkbuf_put_u32 Unexecuted instantiation: ogs-socket.c:ogs_pkbuf_put_u32 Unexecuted instantiation: ogs-socknode.c:ogs_pkbuf_put_u32 Unexecuted instantiation: ogs-udp.c:ogs_pkbuf_put_u32 Unexecuted instantiation: ogs-poll.c:ogs_pkbuf_put_u32 Unexecuted instantiation: ogs-tlv-msg.c:ogs_pkbuf_put_u32 Unexecuted instantiation: ogs-core.c:ogs_pkbuf_put_u32 Unexecuted instantiation: ogs-epoll.c:ogs_pkbuf_put_u32 Unexecuted instantiation: ogs-errno.c:ogs_pkbuf_put_u32 Unexecuted instantiation: ogs-time.c:ogs_pkbuf_put_u32 Unexecuted instantiation: ogs-rbtree.c:ogs_pkbuf_put_u32 Unexecuted instantiation: ogs-sockopt.c:ogs_pkbuf_put_u32 Unexecuted instantiation: ogs-notify.c:ogs_pkbuf_put_u32 Unexecuted instantiation: ogs-tlv.c:ogs_pkbuf_put_u32 Unexecuted instantiation: ogs-hash.c:ogs_pkbuf_put_u32 Unexecuted instantiation: ogs-yaml.c:ogs_pkbuf_put_u32 Unexecuted instantiation: ogs-context.c:ogs_pkbuf_put_u32 Unexecuted instantiation: ogs-config.c:ogs_pkbuf_put_u32 Unexecuted instantiation: ogs-init.c:ogs_pkbuf_put_u32 Unexecuted instantiation: ogs-queue.c:ogs_pkbuf_put_u32 Unexecuted instantiation: ogs-env.c:ogs_pkbuf_put_u32 |
145 | | |
146 | | static ogs_inline void *ogs_pkbuf_push(ogs_pkbuf_t *pkbuf, unsigned int len) |
147 | 463 | { |
148 | 463 | if (ogs_unlikely(ogs_pkbuf_headroom(pkbuf) < (int)len)) |
149 | 0 | ogs_assert_if_reached(); |
150 | | |
151 | 463 | pkbuf->data -= len; |
152 | 463 | pkbuf->len += len; |
153 | | |
154 | 463 | return pkbuf->data; |
155 | 463 | } Unexecuted instantiation: gtp-message-fuzz.c:ogs_pkbuf_push Unexecuted instantiation: context.c:ogs_pkbuf_push Unexecuted instantiation: xact.c:ogs_pkbuf_push Unexecuted instantiation: conv.c:ogs_pkbuf_push Line | Count | Source | 147 | 463 | { | 148 | 463 | if (ogs_unlikely(ogs_pkbuf_headroom(pkbuf) < (int)len)) | 149 | 0 | ogs_assert_if_reached(); | 150 | | | 151 | 463 | pkbuf->data -= len; | 152 | 463 | pkbuf->len += len; | 153 | | | 154 | 463 | return pkbuf->data; | 155 | 463 | } |
Unexecuted instantiation: path.c:ogs_pkbuf_push Unexecuted instantiation: build.c:ogs_pkbuf_push Unexecuted instantiation: types.c:ogs_pkbuf_push Unexecuted instantiation: ogs-abort.c:ogs_pkbuf_push Unexecuted instantiation: ogs-strings.c:ogs_pkbuf_push Unexecuted instantiation: ogs-conv.c:ogs_pkbuf_push Unexecuted instantiation: ogs-log.c:ogs_pkbuf_push Unexecuted instantiation: ogs-pkbuf.c:ogs_pkbuf_push Unexecuted instantiation: ogs-memory.c:ogs_pkbuf_push Unexecuted instantiation: ogs-timer.c:ogs_pkbuf_push Unexecuted instantiation: ogs-sockaddr.c:ogs_pkbuf_push Unexecuted instantiation: ogs-socket.c:ogs_pkbuf_push Unexecuted instantiation: ogs-socknode.c:ogs_pkbuf_push Unexecuted instantiation: ogs-udp.c:ogs_pkbuf_push Unexecuted instantiation: ogs-poll.c:ogs_pkbuf_push Unexecuted instantiation: ogs-tlv-msg.c:ogs_pkbuf_push Unexecuted instantiation: ogs-core.c:ogs_pkbuf_push Unexecuted instantiation: ogs-epoll.c:ogs_pkbuf_push Unexecuted instantiation: ogs-errno.c:ogs_pkbuf_push Unexecuted instantiation: ogs-time.c:ogs_pkbuf_push Unexecuted instantiation: ogs-rbtree.c:ogs_pkbuf_push Unexecuted instantiation: ogs-sockopt.c:ogs_pkbuf_push Unexecuted instantiation: ogs-notify.c:ogs_pkbuf_push Unexecuted instantiation: ogs-tlv.c:ogs_pkbuf_push Unexecuted instantiation: ogs-hash.c:ogs_pkbuf_push Unexecuted instantiation: ogs-yaml.c:ogs_pkbuf_push Unexecuted instantiation: ogs-context.c:ogs_pkbuf_push Unexecuted instantiation: ogs-config.c:ogs_pkbuf_push Unexecuted instantiation: ogs-init.c:ogs_pkbuf_push Unexecuted instantiation: ogs-queue.c:ogs_pkbuf_push Unexecuted instantiation: ogs-env.c:ogs_pkbuf_push |
156 | | |
157 | | static ogs_inline void *ogs_pkbuf_pull_inline( |
158 | | ogs_pkbuf_t *pkbuf, unsigned int len) |
159 | 463 | { |
160 | 463 | pkbuf->len -= len; |
161 | 463 | return pkbuf->data += len; |
162 | 463 | } Unexecuted instantiation: gtp-message-fuzz.c:ogs_pkbuf_pull_inline Unexecuted instantiation: context.c:ogs_pkbuf_pull_inline Unexecuted instantiation: xact.c:ogs_pkbuf_pull_inline Unexecuted instantiation: conv.c:ogs_pkbuf_pull_inline message.c:ogs_pkbuf_pull_inline Line | Count | Source | 159 | 463 | { | 160 | 463 | pkbuf->len -= len; | 161 | 463 | return pkbuf->data += len; | 162 | 463 | } |
Unexecuted instantiation: path.c:ogs_pkbuf_pull_inline Unexecuted instantiation: build.c:ogs_pkbuf_pull_inline Unexecuted instantiation: types.c:ogs_pkbuf_pull_inline Unexecuted instantiation: ogs-abort.c:ogs_pkbuf_pull_inline Unexecuted instantiation: ogs-strings.c:ogs_pkbuf_pull_inline Unexecuted instantiation: ogs-conv.c:ogs_pkbuf_pull_inline Unexecuted instantiation: ogs-log.c:ogs_pkbuf_pull_inline Unexecuted instantiation: ogs-pkbuf.c:ogs_pkbuf_pull_inline Unexecuted instantiation: ogs-memory.c:ogs_pkbuf_pull_inline Unexecuted instantiation: ogs-timer.c:ogs_pkbuf_pull_inline Unexecuted instantiation: ogs-sockaddr.c:ogs_pkbuf_pull_inline Unexecuted instantiation: ogs-socket.c:ogs_pkbuf_pull_inline Unexecuted instantiation: ogs-socknode.c:ogs_pkbuf_pull_inline Unexecuted instantiation: ogs-udp.c:ogs_pkbuf_pull_inline Unexecuted instantiation: ogs-poll.c:ogs_pkbuf_pull_inline Unexecuted instantiation: ogs-tlv-msg.c:ogs_pkbuf_pull_inline Unexecuted instantiation: ogs-core.c:ogs_pkbuf_pull_inline Unexecuted instantiation: ogs-epoll.c:ogs_pkbuf_pull_inline Unexecuted instantiation: ogs-errno.c:ogs_pkbuf_pull_inline Unexecuted instantiation: ogs-time.c:ogs_pkbuf_pull_inline Unexecuted instantiation: ogs-rbtree.c:ogs_pkbuf_pull_inline Unexecuted instantiation: ogs-sockopt.c:ogs_pkbuf_pull_inline Unexecuted instantiation: ogs-notify.c:ogs_pkbuf_pull_inline Unexecuted instantiation: ogs-tlv.c:ogs_pkbuf_pull_inline Unexecuted instantiation: ogs-hash.c:ogs_pkbuf_pull_inline Unexecuted instantiation: ogs-yaml.c:ogs_pkbuf_pull_inline Unexecuted instantiation: ogs-context.c:ogs_pkbuf_pull_inline Unexecuted instantiation: ogs-config.c:ogs_pkbuf_pull_inline Unexecuted instantiation: ogs-init.c:ogs_pkbuf_pull_inline Unexecuted instantiation: ogs-queue.c:ogs_pkbuf_pull_inline Unexecuted instantiation: ogs-env.c:ogs_pkbuf_pull_inline |
163 | | |
164 | | static ogs_inline void *ogs_pkbuf_pull(ogs_pkbuf_t *pkbuf, unsigned int len) |
165 | 468 | { |
166 | 468 | return ogs_unlikely(len > pkbuf->len) ? |
167 | 463 | NULL : ogs_pkbuf_pull_inline(pkbuf, len); |
168 | 468 | } Unexecuted instantiation: gtp-message-fuzz.c:ogs_pkbuf_pull Unexecuted instantiation: context.c:ogs_pkbuf_pull Unexecuted instantiation: xact.c:ogs_pkbuf_pull Unexecuted instantiation: conv.c:ogs_pkbuf_pull Line | Count | Source | 165 | 468 | { | 166 | 468 | return ogs_unlikely(len > pkbuf->len) ? | 167 | 463 | NULL : ogs_pkbuf_pull_inline(pkbuf, len); | 168 | 468 | } |
Unexecuted instantiation: path.c:ogs_pkbuf_pull Unexecuted instantiation: build.c:ogs_pkbuf_pull Unexecuted instantiation: types.c:ogs_pkbuf_pull Unexecuted instantiation: ogs-abort.c:ogs_pkbuf_pull Unexecuted instantiation: ogs-strings.c:ogs_pkbuf_pull Unexecuted instantiation: ogs-conv.c:ogs_pkbuf_pull Unexecuted instantiation: ogs-log.c:ogs_pkbuf_pull Unexecuted instantiation: ogs-pkbuf.c:ogs_pkbuf_pull Unexecuted instantiation: ogs-memory.c:ogs_pkbuf_pull Unexecuted instantiation: ogs-timer.c:ogs_pkbuf_pull Unexecuted instantiation: ogs-sockaddr.c:ogs_pkbuf_pull Unexecuted instantiation: ogs-socket.c:ogs_pkbuf_pull Unexecuted instantiation: ogs-socknode.c:ogs_pkbuf_pull Unexecuted instantiation: ogs-udp.c:ogs_pkbuf_pull Unexecuted instantiation: ogs-poll.c:ogs_pkbuf_pull Unexecuted instantiation: ogs-tlv-msg.c:ogs_pkbuf_pull Unexecuted instantiation: ogs-core.c:ogs_pkbuf_pull Unexecuted instantiation: ogs-epoll.c:ogs_pkbuf_pull Unexecuted instantiation: ogs-errno.c:ogs_pkbuf_pull Unexecuted instantiation: ogs-time.c:ogs_pkbuf_pull Unexecuted instantiation: ogs-rbtree.c:ogs_pkbuf_pull Unexecuted instantiation: ogs-sockopt.c:ogs_pkbuf_pull Unexecuted instantiation: ogs-notify.c:ogs_pkbuf_pull Unexecuted instantiation: ogs-tlv.c:ogs_pkbuf_pull Unexecuted instantiation: ogs-hash.c:ogs_pkbuf_pull Unexecuted instantiation: ogs-yaml.c:ogs_pkbuf_pull Unexecuted instantiation: ogs-context.c:ogs_pkbuf_pull Unexecuted instantiation: ogs-config.c:ogs_pkbuf_pull Unexecuted instantiation: ogs-init.c:ogs_pkbuf_pull Unexecuted instantiation: ogs-queue.c:ogs_pkbuf_pull Unexecuted instantiation: ogs-env.c:ogs_pkbuf_pull |
169 | | |
170 | | static ogs_inline int ogs_pkbuf_trim(ogs_pkbuf_t *pkbuf, int len) |
171 | 0 | { |
172 | 0 | if (ogs_unlikely(len < 0)) |
173 | 0 | ogs_assert_if_reached(); |
174 | 0 | if (ogs_unlikely(len > pkbuf->len)) { |
175 | 0 | ogs_error("len(%d) > pkbuf->len(%d)", len, pkbuf->len); |
176 | 0 | return OGS_ERROR; |
177 | 0 | } |
178 | | |
179 | 0 | pkbuf->tail = pkbuf->data + len; |
180 | 0 | pkbuf->len = len; |
181 | |
|
182 | 0 | return OGS_OK; |
183 | 0 | } Unexecuted instantiation: gtp-message-fuzz.c:ogs_pkbuf_trim Unexecuted instantiation: context.c:ogs_pkbuf_trim Unexecuted instantiation: xact.c:ogs_pkbuf_trim Unexecuted instantiation: conv.c:ogs_pkbuf_trim Unexecuted instantiation: message.c:ogs_pkbuf_trim Unexecuted instantiation: path.c:ogs_pkbuf_trim Unexecuted instantiation: build.c:ogs_pkbuf_trim Unexecuted instantiation: types.c:ogs_pkbuf_trim Unexecuted instantiation: ogs-abort.c:ogs_pkbuf_trim Unexecuted instantiation: ogs-strings.c:ogs_pkbuf_trim Unexecuted instantiation: ogs-conv.c:ogs_pkbuf_trim Unexecuted instantiation: ogs-log.c:ogs_pkbuf_trim Unexecuted instantiation: ogs-pkbuf.c:ogs_pkbuf_trim Unexecuted instantiation: ogs-memory.c:ogs_pkbuf_trim Unexecuted instantiation: ogs-timer.c:ogs_pkbuf_trim Unexecuted instantiation: ogs-sockaddr.c:ogs_pkbuf_trim Unexecuted instantiation: ogs-socket.c:ogs_pkbuf_trim Unexecuted instantiation: ogs-socknode.c:ogs_pkbuf_trim Unexecuted instantiation: ogs-udp.c:ogs_pkbuf_trim Unexecuted instantiation: ogs-poll.c:ogs_pkbuf_trim Unexecuted instantiation: ogs-tlv-msg.c:ogs_pkbuf_trim Unexecuted instantiation: ogs-core.c:ogs_pkbuf_trim Unexecuted instantiation: ogs-epoll.c:ogs_pkbuf_trim Unexecuted instantiation: ogs-errno.c:ogs_pkbuf_trim Unexecuted instantiation: ogs-time.c:ogs_pkbuf_trim Unexecuted instantiation: ogs-rbtree.c:ogs_pkbuf_trim Unexecuted instantiation: ogs-sockopt.c:ogs_pkbuf_trim Unexecuted instantiation: ogs-notify.c:ogs_pkbuf_trim Unexecuted instantiation: ogs-tlv.c:ogs_pkbuf_trim Unexecuted instantiation: ogs-hash.c:ogs_pkbuf_trim Unexecuted instantiation: ogs-yaml.c:ogs_pkbuf_trim Unexecuted instantiation: ogs-context.c:ogs_pkbuf_trim Unexecuted instantiation: ogs-config.c:ogs_pkbuf_trim Unexecuted instantiation: ogs-init.c:ogs_pkbuf_trim Unexecuted instantiation: ogs-queue.c:ogs_pkbuf_trim Unexecuted instantiation: ogs-env.c:ogs_pkbuf_trim |
184 | | |
185 | | #ifdef __cplusplus |
186 | | } |
187 | | #endif |
188 | | |
189 | | #endif /* OGS_PKBUF_H */ |