// SPDX-License-Identifier: GPL-3.0-or-later #ifndef NETDATA_STREAM_HANDSHAKE_H #define NETDATA_STREAM_HANDSHAKE_H #define HTTP_HEADER_SIZE 8192 #define STREAMING_PROTOCOL_VERSION "1.1" #define START_STREAMING_PROMPT_V1 "Hit me baby, push them over..." #define START_STREAMING_PROMPT_V2 "Hit me baby, push them over and bring the host labels..." #define START_STREAMING_PROMPT_VN "Hit me baby, push them over with the version=" #define START_STREAMING_ERROR_SAME_LOCALHOST "Don't hit me baby, you are trying to stream my localhost back" #define START_STREAMING_ERROR_ALREADY_STREAMING "This GUID is already streaming to this server" #define START_STREAMING_ERROR_NOT_PERMITTED "You are not permitted to access this. Check the logs for more info." #define START_STREAMING_ERROR_BUSY_TRY_LATER "The server is too busy now to accept this request. Try later." #define START_STREAMING_ERROR_INTERNAL_ERROR "The server encountered an internal error. Try later." #define START_STREAMING_ERROR_INITIALIZATION "The server is initializing. Try later." #define RRDPUSH_STATUS_CONNECTED "CONNECTED" #define RRDPUSH_STATUS_ALREADY_CONNECTED "ALREADY CONNECTED" #define RRDPUSH_STATUS_DISCONNECTED "DISCONNECTED" #define RRDPUSH_STATUS_RATE_LIMIT "RATE LIMIT TRY LATER" #define RRDPUSH_STATUS_INITIALIZATION_IN_PROGRESS "INITIALIZATION IN PROGRESS RETRY LATER" #define RRDPUSH_STATUS_INTERNAL_SERVER_ERROR "INTERNAL SERVER ERROR DROPPING CONNECTION" #define RRDPUSH_STATUS_DUPLICATE_RECEIVER "DUPLICATE RECEIVER DROPPING CONNECTION" #define RRDPUSH_STATUS_CANT_REPLY "CANT REPLY DROPPING CONNECTION" #define RRDPUSH_STATUS_NO_HOSTNAME "NO HOSTNAME PERMISSION DENIED" #define RRDPUSH_STATUS_NO_API_KEY "NO API KEY PERMISSION DENIED" #define RRDPUSH_STATUS_INVALID_API_KEY "INVALID API KEY PERMISSION DENIED" #define RRDPUSH_STATUS_NO_MACHINE_GUID "NO MACHINE GUID PERMISSION DENIED" #define RRDPUSH_STATUS_MACHINE_GUID_DISABLED "MACHINE GUID DISABLED PERMISSION DENIED" #define RRDPUSH_STATUS_INVALID_MACHINE_GUID "INVALID MACHINE GUID PERMISSION DENIED" #define RRDPUSH_STATUS_API_KEY_DISABLED "API KEY DISABLED PERMISSION DENIED" #define RRDPUSH_STATUS_NOT_ALLOWED_IP "NOT ALLOWED IP PERMISSION DENIED" #define RRDPUSH_STATUS_LOCALHOST "LOCALHOST PERMISSION DENIED" #define RRDPUSH_STATUS_PERMISSION_DENIED "PERMISSION DENIED" #define RRDPUSH_STATUS_BAD_HANDSHAKE "BAD HANDSHAKE" #define RRDPUSH_STATUS_TIMEOUT "TIMEOUT" #define RRDPUSH_STATUS_CANT_UPGRADE_CONNECTION "CANT UPGRADE CONNECTION" #define RRDPUSH_STATUS_SSL_ERROR "SSL ERROR" #define RRDPUSH_STATUS_INVALID_SSL_CERTIFICATE "INVALID SSL CERTIFICATE" #define RRDPUSH_STATUS_CANT_ESTABLISH_SSL_CONNECTION "CANT ESTABLISH SSL CONNECTION" typedef enum { STREAM_HANDSHAKE_OK_V3 = 3, // v3+ STREAM_HANDSHAKE_OK_V2 = 2, // v2 STREAM_HANDSHAKE_OK_V1 = 1, // v1 STREAM_HANDSHAKE_NEVER = 0, // never tried to connect STREAM_HANDSHAKE_ERROR_BAD_HANDSHAKE = -1, STREAM_HANDSHAKE_ERROR_LOCALHOST = -2, STREAM_HANDSHAKE_ERROR_ALREADY_CONNECTED = -3, STREAM_HANDSHAKE_ERROR_DENIED = -4, STREAM_HANDSHAKE_ERROR_SEND_TIMEOUT = -5, STREAM_HANDSHAKE_ERROR_RECEIVE_TIMEOUT = -6, STREAM_HANDSHAKE_ERROR_INVALID_CERTIFICATE = -7, STREAM_HANDSHAKE_ERROR_SSL_ERROR = -8, STREAM_HANDSHAKE_ERROR_CANT_CONNECT = -9, STREAM_HANDSHAKE_BUSY_TRY_LATER = -10, STREAM_HANDSHAKE_INTERNAL_ERROR = -11, STREAM_HANDSHAKE_INITIALIZATION = -12, STREAM_HANDSHAKE_DISCONNECT_HOST_CLEANUP = -13, STREAM_HANDSHAKE_DISCONNECT_STALE_RECEIVER = -14, STREAM_HANDSHAKE_DISCONNECT_SHUTDOWN = -15, STREAM_HANDSHAKE_DISCONNECT_NETDATA_EXIT = -16, STREAM_HANDSHAKE_DISCONNECT_PARSER_EXIT = -17, STREAM_HANDSHAKE_DISCONNECT_UNKNOWN_SOCKET_READ_ERROR = -18, STREAM_HANDSHAKE_DISCONNECT_PARSER_FAILED = -19, STREAM_HANDSHAKE_DISCONNECT_RECEIVER_LEFT = -20, STREAM_HANDSHAKE_DISCONNECT_ORPHAN_HOST = -21, STREAM_HANDSHAKE_NON_STREAMABLE_HOST = -22, STREAM_HANDSHAKE_DISCONNECT_NOT_SUFFICIENT_READ_BUFFER = -23, STREAM_HANDSHAKE_DISCONNECT_SOCKET_EOF = -24, STREAM_HANDSHAKE_DISCONNECT_SOCKET_READ_FAILED = -25, STREAM_HANDSHAKE_DISCONNECT_SOCKET_READ_TIMEOUT = -26, STREAM_HANDSHAKE_ERROR_HTTP_UPGRADE = -27, } STREAM_HANDSHAKE; const char *stream_handshake_error_to_string(STREAM_HANDSHAKE handshake_error); #endif //NETDATA_STREAM_HANDSHAKE_H