Welcome! Log In Create A New Profile

Advanced

Pointer to output buffer

Posted by Roman Lupin 
Roman Lupin
Pointer to output buffer
September 06, 2018 03:50PM
Hello,

I 'm C/C++ software developer. I've downloaded the source code of HAPROXY V1.8.13. I've tried to find a raw pointer (f.e., char*) to the output buffer of the output data after the TCP connection between client and server was successfully established. I want to add some specific data to output buffer in order the server to receive it from the client. I see the method 'connection_server()' in the file 'backend.c'. The pointer to the output buffer is prepared in this function? Could you please help me with this searching?

Thank you in advance!
Willy Tarreau
Re: Pointer to output buffer
September 06, 2018 08:00PM
Hello Roman,

On Thu, Sep 06, 2018 at 01:42:57PM +0000, Roman Lupin wrote:
> Hello,
>
> I 'm C/C++ software developer. I've downloaded the source code of HAPROXY
> V1.8.13. I've tried to find a raw pointer (f.e., char*) to the output buffer
> of the output data after the TCP connection between client and server was
> successfully established. I want to add some specific data to output buffer
> in order the server to receive it from the client. I see the method
> 'connection_server()' in the file 'backend.c'. The pointer to the output
> buffer is prepared in this function? Could you please help me with this
> searching?

Hmmm it doesn't work like this at all, so I guess it will be quite difficult
to explain like this. Please have a look at various things in doc/internals,
specifically "entities". It's a diagram which explains for each part, what
other parts it's connected to. You'll see the buffers attached to the channel.
These are the buffers you're looking for. But they are only allocated if they
contain data, and are released immediately after the data was sent. You may
even have some data in the kernel memory (inside a pipe) and not in the buffer
at all.

I really have no idea what you are trying to do, but definitely trying to
fiddle with the buffers around connect_server() is not the right thing to do.
Maybe you can achieve what you want using some Lua scripts and you will not
need to touch the code at all. If you need to touch the code to do something
very specific, you'd rather take a look at the analysers in proto_http.c.
They are the ones called in sequences to perform various parsing, or while
forwarding the payload from one side to another one. It's possible that it
will be easier for you to play there. Please have a look at filters as well
(eg: the compression filter), you will see how it interacts with the data
that come through a buffer, to compress that and write it back to the same
buffer, adjusting the lengths and input/output counts.

Hoping this helps,
Willy
Sorry, only registered users may post in this forum.

Click here to login