Andreas,my problem is, that I want to do ssh port forwarding.I have a pair: 
local socket to the client and the corresponding SSH channel.My initial idea 
was to attach the channel as userdata to the socket callback function and the 
socket as userdata to the channel callback functions.
Problem: The userdata portion of the channel callback functions is a member of 
the callback structure. That means one cannot have different userdata for 
different channels without a new callback structure for every channel. Right?
So, what I did was to malloc the callback structure, initialize it and set 
different userdata for every channel. That caused all kinds of trouble:* there 
is no official way to access the callback structure (or is there)?* there is no 
way to know, when it is safe to release the userdata or the callback structure 
(ssh_channel_free only marks the channel for release in the future. When I 
released the callback structure after calling ssh_channel_free, all hell broke 
lose, because the channel was not really gone and tried to access both, its 
callbacks and the userdata).
That's why my original question: Is there a safe way to either have channel 
specific callbacks or can I attach different userdata to different channels?
  -- 
Regards
 Joerg

Reply via email to