Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
nghttp2
Commits
e29bb449
Commit
e29bb449
authored
Mar 01, 2012
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Exposed spdylay_frame_alloc_{pack,unpack}_nv for easy performance test
parent
aded9420
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
46 deletions
+62
-46
lib/spdylay_frame.c
lib/spdylay_frame.c
+14
-46
lib/spdylay_frame.h
lib/spdylay_frame.h
+48
-0
No files found.
lib/spdylay_frame.c
View file @
e29bb449
...
...
@@ -85,28 +85,13 @@ static void spdylay_frame_unpack_ctrl_hd(spdylay_ctrl_hd *hd,
hd
->
length
=
spdylay_get_uint32
(
&
buf
[
4
])
&
SPDYLAY_LENGTH_MASK
;
}
/*
* Packs name/value pairs in |nv| in |*buf_ptr| with offset
* |nv_offset|. It means first byte of packed name/value pairs is
* stored in |*buf_ptr|+|nv_offset|. |*buf_ptr| and |*nvbuf_ptr| are
* expanded as necessary.
*
* This function returns the number of the bytes for the frame
* containing this name/value pairs if it succeeds, or one of the
* following negative error codes:
*
* SPDYLAY_ERR_ZLIB
* The deflate operation failed.
* SPDYLAY_ERR_NOMEM
* Out of memory.
*/
static
ssize_t
spdylay_frame_alloc_pack_nv
(
uint8_t
**
buf_ptr
,
size_t
*
buflen_ptr
,
uint8_t
**
nvbuf_ptr
,
size_t
*
nvbuflen_ptr
,
char
**
nv
,
size_t
nv_offset
,
size_t
len_size
,
spdylay_zlib
*
deflater
)
ssize_t
spdylay_frame_alloc_pack_nv
(
uint8_t
**
buf_ptr
,
size_t
*
buflen_ptr
,
uint8_t
**
nvbuf_ptr
,
size_t
*
nvbuflen_ptr
,
char
**
nv
,
size_t
nv_offset
,
size_t
len_size
,
spdylay_zlib
*
deflater
)
{
size_t
nvspace
;
size_t
maxframelen
;
...
...
@@ -237,30 +222,13 @@ int spdylay_frame_unpack_nv(char ***nv_ptr, const uint8_t *in, size_t inlen,
return
0
;
}
/*
* Unpacks name/value pairs from buffer |in| with length |inlen|. The
* necessary memory area required for output is allocated and its
* pointer is assigned to |nv_ptr|. |inflatebuf| is used for inflate
* operation. |*nvbuf_ptr| is used for temporarily stored inflated
* name/value pair in wire format. It is expanded as necessary.
* |len_size| is the number of bytes used in name/value length. It
* must be either 2 or 4.
*
* This function returns 0 if it succeeds, or one of the following
* negative error codes:
*
* SPDYLAY_ERR_ZLIB
* The inflate operation failed.
* SPDYLAY_ERR_NOMEM
* Out of memory.
*/
static
int
spdylay_frame_alloc_unpack_nv
(
char
***
nv_ptr
,
spdylay_buffer
*
inflatebuf
,
uint8_t
**
nvbuf_ptr
,
size_t
*
nvbuflen_ptr
,
const
uint8_t
*
in
,
size_t
inlen
,
size_t
len_size
,
spdylay_zlib
*
inflater
)
int
spdylay_frame_alloc_unpack_nv
(
char
***
nv_ptr
,
spdylay_buffer
*
inflatebuf
,
uint8_t
**
nvbuf_ptr
,
size_t
*
nvbuflen_ptr
,
const
uint8_t
*
in
,
size_t
inlen
,
size_t
len_size
,
spdylay_zlib
*
inflater
)
{
ssize_t
nvspace
;
int
r
;
...
...
lib/spdylay_frame.h
View file @
e29bb449
...
...
@@ -392,6 +392,29 @@ size_t spdylay_frame_count_nv_space(char **nv, size_t len_size);
*/
ssize_t
spdylay_frame_pack_nv
(
uint8_t
*
buf
,
char
**
nv
,
size_t
len_size
);
/*
* Packs name/value pairs in |nv| in |*buf_ptr| with offset
* |nv_offset|. It means first byte of packed name/value pairs is
* stored in |*buf_ptr|+|nv_offset|. |*buf_ptr| and |*nvbuf_ptr| are
* expanded as necessary.
*
* This function returns the number of the bytes for the frame
* containing this name/value pairs if it succeeds, or one of the
* following negative error codes:
*
* SPDYLAY_ERR_ZLIB
* The deflate operation failed.
* SPDYLAY_ERR_NOMEM
* Out of memory.
*/
ssize_t
spdylay_frame_alloc_pack_nv
(
uint8_t
**
buf_ptr
,
size_t
*
buflen_ptr
,
uint8_t
**
nvbuf_ptr
,
size_t
*
nvbuflen_ptr
,
char
**
nv
,
size_t
nv_offset
,
size_t
len_size
,
spdylay_zlib
*
deflater
);
/*
* Counts number of name/value pair in |in| and computes length of
* buffers to store unpacked name/value pair and store them in
...
...
@@ -440,6 +463,31 @@ int spdylay_frame_count_unpack_nv_space
int
spdylay_frame_unpack_nv
(
char
***
nv_ptr
,
const
uint8_t
*
in
,
size_t
inlen
,
size_t
len_size
);
/*
* Unpacks name/value pairs from buffer |in| with length |inlen|. The
* necessary memory area required for output is allocated and its
* pointer is assigned to |nv_ptr|. |inflatebuf| is used for inflate
* operation. |*nvbuf_ptr| is used for temporarily stored inflated
* name/value pair in wire format. It is expanded as necessary.
* |len_size| is the number of bytes used in name/value length. It
* must be either 2 or 4.
*
* This function returns 0 if it succeeds, or one of the following
* negative error codes:
*
* SPDYLAY_ERR_ZLIB
* The inflate operation failed.
* SPDYLAY_ERR_NOMEM
* Out of memory.
*/
int
spdylay_frame_alloc_unpack_nv
(
char
***
nv_ptr
,
spdylay_buffer
*
inflatebuf
,
uint8_t
**
nvbuf_ptr
,
size_t
*
nvbuflen_ptr
,
const
uint8_t
*
in
,
size_t
inlen
,
size_t
len_size
,
spdylay_zlib
*
inflater
);
/*
* Initializes SYN_STREAM frame |frame| with given values. |frame|
* takes ownership of |nv|, so caller must not free it. If stream_id
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment