@@ -56,7 +56,7 @@ typedef void (*ssh_callback_int) (int code, void *user);
56
56
* @returns number of bytes processed by the callee. The remaining bytes will
57
57
* be sent in the next callback message, when more data is available.
58
58
*/
59
- typedef int (* ssh_callback_data ) (const void * data , size_t len , void * user );
59
+ typedef size_t (* ssh_callback_data ) (const void * data , size_t len , void * user );
60
60
61
61
typedef void (* ssh_callback_int_int ) (int code , int errno_code , void * user );
62
62
@@ -81,9 +81,9 @@ typedef void (*ssh_log_callback) (ssh_session session, int priority,
81
81
*
82
82
* @param priority Priority of the log, the smaller being the more important.
83
83
*
84
- * @param function The function name calling the the logging fucntions .
84
+ * @param function The function name calling the logging functions .
85
85
*
86
- * @param message The actual message
86
+ * @param buffer The actual message
87
87
*
88
88
* @param userdata Userdata to be passed to the callback function.
89
89
*/
@@ -117,6 +117,8 @@ typedef void (*ssh_global_request_callback) (ssh_session session,
117
117
* sends back an X11 connection attempt. This is a client-side API
118
118
* @param session current session handler
119
119
* @param userdata Userdata to be passed to the callback function.
120
+ * @param originator_address IP address of the machine who sent the request
121
+ * @param originator_port port number of the machine who sent the request
120
122
* @returns a valid ssh_channel handle if the request is to be allowed
121
123
* @returns NULL if the request should not be allowed
122
124
* @warning The channel pointer returned by this callback must be closed by the application.
@@ -221,8 +223,8 @@ typedef int (*ssh_auth_gssapi_mic_callback) (ssh_session session, const char *us
221
223
* @param user User that wants to authenticate
222
224
* @param pubkey public key used for authentication
223
225
* @param signature_state SSH_PUBLICKEY_STATE_NONE if the key is not signed (simple public key probe),
224
- * SSH_PUBLICKEY_STATE_VALID if the signature is valid. Others values should be
225
- * replied with a SSH_AUTH_DENIED.
226
+ * SSH_PUBLICKEY_STATE_VALID if the signature is valid. Others values should be
227
+ * replied with a SSH_AUTH_DENIED.
226
228
* @param userdata Userdata to be passed to the callback function.
227
229
* @returns SSH_AUTH_SUCCESS Authentication is accepted.
228
230
* @returns SSH_AUTH_PARTIAL Partial authentication, more authentication means are needed.
@@ -268,11 +270,11 @@ typedef ssh_string (*ssh_gssapi_select_oid_callback) (ssh_session session, const
268
270
int n_oid , ssh_string * oids , void * userdata );
269
271
270
272
/*
271
- * @brief handle the negociation of a security context, server side.
273
+ * @brief handle the negotiation of a security context, server side.
272
274
* @param session current session handler
273
275
* @param[in] input_token input token provided by client
274
276
* @param[out] output_token output of the gssapi accept_sec_context method,
275
- * NULL after completion.
277
+ * NULL after completion.
276
278
* @returns SSH_OK if the token was generated correctly or accept_sec_context
277
279
* returned GSS_S_COMPLETE
278
280
* @returns SSH_ERROR in case of error
@@ -354,6 +356,9 @@ typedef struct ssh_server_callbacks_struct *ssh_server_callbacks;
354
356
* This functions sets the callback structure to use your own callback
355
357
* functions for user authentication, new channels and requests.
356
358
*
359
+ * Note, that the structure is not copied to the session structure so it needs
360
+ * to be valid for the whole session lifetime.
361
+ *
357
362
* @code
358
363
* struct ssh_server_callbacks_struct cb = {
359
364
* .userdata = data,
@@ -394,7 +399,7 @@ struct ssh_socket_callbacks_struct {
394
399
*/
395
400
ssh_callback_int_int exception ;
396
401
/** This function is called when the ssh_socket_connect was used on the socket
397
- * on nonblocking state, and the connection successed .
402
+ * on nonblocking state, and the connection succeeded .
398
403
*/
399
404
ssh_callback_int_int connected ;
400
405
};
@@ -548,6 +553,9 @@ typedef struct ssh_packet_callbacks_struct *ssh_packet_callbacks;
548
553
* This functions sets the callback structure to use your own callback
549
554
* functions for auth, logging and status.
550
555
*
556
+ * Note, that the callback structure is not copied into the session so it needs
557
+ * to be valid for the whole session lifetime.
558
+ *
551
559
* @code
552
560
* struct ssh_callbacks_struct cb = {
553
561
* .userdata = data,
@@ -619,6 +627,7 @@ typedef void (*ssh_channel_signal_callback) (ssh_session session,
619
627
* @brief SSH channel exit status callback. Called when a channel has received an exit status
620
628
* @param session Current session handler
621
629
* @param channel the actual channel
630
+ * @param exit_status Exit status of the ran command
622
631
* @param userdata Userdata to be passed to the callback function.
623
632
*/
624
633
typedef void (* ssh_channel_exit_status_callback ) (ssh_session session ,
@@ -631,7 +640,7 @@ typedef void (*ssh_channel_exit_status_callback) (ssh_session session,
631
640
* @param session Current session handler
632
641
* @param channel the actual channel
633
642
* @param signal the signal name (without the SIG prefix)
634
- * @param core a boolean telling wether a core has been dumped or not
643
+ * @param core a boolean telling whether a core has been dumped or not
635
644
* @param errmsg the description of the exception
636
645
* @param lang the language of the description (format: RFC 3066)
637
646
* @param userdata Userdata to be passed to the callback function.
@@ -646,12 +655,13 @@ typedef void (*ssh_channel_exit_signal_callback) (ssh_session session,
646
655
647
656
/**
648
657
* @brief SSH channel PTY request from a client.
658
+ * @param session the session
649
659
* @param channel the channel
650
660
* @param term The type of terminal emulation
651
661
* @param width width of the terminal, in characters
652
662
* @param height height of the terminal, in characters
653
663
* @param pxwidth width of the terminal, in pixels
654
- * @param pxheight height of the terminal, in pixels
664
+ * @param pwheight height of the terminal, in pixels
655
665
* @param userdata Userdata to be passed to the callback function.
656
666
* @returns 0 if the pty request is accepted
657
667
* @returns -1 if the request is denied
@@ -665,6 +675,7 @@ typedef int (*ssh_channel_pty_request_callback) (ssh_session session,
665
675
666
676
/**
667
677
* @brief SSH channel Shell request from a client.
678
+ * @param session the session
668
679
* @param channel the channel
669
680
* @param userdata Userdata to be passed to the callback function.
670
681
* @returns 0 if the shell request is accepted
@@ -677,6 +688,7 @@ typedef int (*ssh_channel_shell_request_callback) (ssh_session session,
677
688
* @brief SSH auth-agent-request from the client. This request is
678
689
* sent by a client when agent forwarding is available.
679
690
* Server is free to ignore this callback, no answer is expected.
691
+ * @param session the session
680
692
* @param channel the channel
681
693
* @param userdata Userdata to be passed to the callback function.
682
694
*/
@@ -688,7 +700,12 @@ typedef void (*ssh_channel_auth_agent_req_callback) (ssh_session session,
688
700
* @brief SSH X11 request from the client. This request is
689
701
* sent by a client when X11 forwarding is requested(and available).
690
702
* Server is free to ignore this callback, no answer is expected.
703
+ * @param session the session
691
704
* @param channel the channel
705
+ * @param single_connection If true, only one channel should be forwarded
706
+ * @param auth_protocol The X11 authentication method to be used
707
+ * @param auth_cookie Authentication cookie encoded hexadecimal
708
+ * @param screen_number Screen number
692
709
* @param userdata Userdata to be passed to the callback function.
693
710
*/
694
711
typedef void (* ssh_channel_x11_req_callback ) (ssh_session session ,
@@ -700,11 +717,12 @@ typedef void (*ssh_channel_x11_req_callback) (ssh_session session,
700
717
void * userdata );
701
718
/**
702
719
* @brief SSH channel PTY windows change (terminal size) from a client.
720
+ * @param session the session
703
721
* @param channel the channel
704
722
* @param width width of the terminal, in characters
705
723
* @param height height of the terminal, in characters
706
724
* @param pxwidth width of the terminal, in pixels
707
- * @param pxheight height of the terminal, in pixels
725
+ * @param pwheight height of the terminal, in pixels
708
726
* @param userdata Userdata to be passed to the callback function.
709
727
* @returns 0 if the pty request is accepted
710
728
* @returns -1 if the request is denied
@@ -717,6 +735,7 @@ typedef int (*ssh_channel_pty_window_change_callback) (ssh_session session,
717
735
718
736
/**
719
737
* @brief SSH channel Exec request from a client.
738
+ * @param session the session
720
739
* @param channel the channel
721
740
* @param command the shell command to be executed
722
741
* @param userdata Userdata to be passed to the callback function.
@@ -730,6 +749,7 @@ typedef int (*ssh_channel_exec_request_callback) (ssh_session session,
730
749
731
750
/**
732
751
* @brief SSH channel environment request from a client.
752
+ * @param session the session
733
753
* @param channel the channel
734
754
* @param env_name name of the environment value to be set
735
755
* @param env_value value of the environment value to be set
@@ -746,6 +766,7 @@ typedef int (*ssh_channel_env_request_callback) (ssh_session session,
746
766
void * userdata );
747
767
/**
748
768
* @brief SSH channel subsystem request from a client.
769
+ * @param session the session
749
770
* @param channel the channel
750
771
* @param subsystem the subsystem required
751
772
* @param userdata Userdata to be passed to the callback function.
@@ -760,6 +781,8 @@ typedef int (*ssh_channel_subsystem_request_callback) (ssh_session session,
760
781
/**
761
782
* @brief SSH channel write will not block (flow control).
762
783
*
784
+ * @param session the session
785
+ *
763
786
* @param channel the channel
764
787
*
765
788
* @param[in] bytes size of the remote window in bytes. Writing as much data
@@ -771,7 +794,7 @@ typedef int (*ssh_channel_subsystem_request_callback) (ssh_session session,
771
794
*/
772
795
typedef int (* ssh_channel_write_wontblock_callback ) (ssh_session session ,
773
796
ssh_channel channel ,
774
- size_t bytes ,
797
+ uint32_t bytes ,
775
798
void * userdata );
776
799
777
800
struct ssh_channel_callbacks_struct {
@@ -849,7 +872,11 @@ typedef struct ssh_channel_callbacks_struct *ssh_channel_callbacks;
849
872
* @brief Set the channel callback functions.
850
873
*
851
874
* This functions sets the callback structure to use your own callback
852
- * functions for channel data and exceptions
875
+ * functions for channel data and exceptions.
876
+ *
877
+ * Note, that the structure is not copied to the channel structure so it needs
878
+ * to be valid as for the whole life of the channel or until it is removed with
879
+ * ssh_remove_channel_callbacks().
853
880
*
854
881
* @code
855
882
* struct ssh_channel_callbacks_struct cb = {
@@ -907,7 +934,7 @@ LIBSSH_API int ssh_remove_channel_callbacks(ssh_channel channel,
907
934
908
935
/** @} */
909
936
910
- /** @group libssh_threads
937
+ /** @addtogroup libssh_threads
911
938
* @{
912
939
*/
913
940
@@ -979,7 +1006,7 @@ LIBSSH_API struct ssh_threads_callbacks_struct *ssh_threads_get_noop(void);
979
1006
*
980
1007
* @param[in] cb The callback to set.
981
1008
*
982
- * @return 0 on success, < 0 on errror .
1009
+ * @return 0 on success, < 0 on error .
983
1010
*/
984
1011
LIBSSH_API int ssh_set_log_callback (ssh_logging_callback cb );
985
1012
0 commit comments