📄 netfone.h
字号:
int llsamples; // Number of samples in packet
SOCKADDR_IN lladdr; // Address packet sent to
char llpacket[0]; // Packet data
};
#define IS_LOCALHOST(i) (ntohl((long)(i)) == 0x7F000001)
#define LOOPBACK_ENABLED 1 // Enabled flag in localLoopback
#define LOOPBACK_PLAYING 2 // Flag in localLoopback for play active
// Auxiliary socket
struct auxSocket {
struct auxSocket *asnext; // Next auxiliary socket
short asrefc; // Reference count if not permanent: 0 = socket closed
unsigned short asport; // Port number (host byte order)
SOCKET asdata; // Data (even port) socket
SOCKET asctrl; // Control (odd port) socket
};
// Sampling rate conversion tools
typedef struct ratestuff {
unsigned long opos_frac; /* Fractional position of the output stream in input stream unit */
unsigned long opos;
unsigned long opos_inc_frac; /* Fractional position increment in the output stream */
unsigned long opos_inc;
unsigned long ipos; /* Position in the input stream (integer) */
long ilast; /* Last sample in the input stream */
} rate_t;
// Socket-specific types
typedef INT SOCKERR; // A socket error code
typedef WORD PORT; // A socket port number
typedef WORD SOCKEVENT; // An asynchronous socket event
// Potential states for connection windows
typedef enum _CLIENT_STATE
{
Embryonic, // Newly creates connection
Idle, // Idle
SendingLiveAudio, // Sending live audio
Transferring, // Sending audio file
PlayingReceivedAudio // Playing audio received from remote host
} CLIENT_STATE;
typedef enum {
Unspecified, // No package specified
PGP, // PGP
GPG // GPG: Gnu Privacy Guard
} public_key_package;
/* Connection window data. A pointer to this structure is
kept at offset GWL_CLIENT in each connection window. */
typedef struct _CLIENT_DATA {
DWORD dwType; // Type of window (WINDOW_TYPE_CLIENT)
CLIENT_STATE state; // Current state.
SOCKET sReply; // Socket waiting for reply from srv
SOCKET sControl; // Socket for RTP/VAT control messages
int timeout; // Timeout counter
SOCKADDR_IN inetSock; // Client's socket address
unsigned short port; // Destination data port number
struct auxSocket *auxSock; // Auxiliary socket, if any
CHAR szHost[MAX_HOST]; // Target server's host name
HFILE hFile; // Handle to open file
DWORD cbSent; // Count of bytes sent so far.
DWORD cbReceived; // Count of bytes received so far
CHAR szFile[MAX_PATH]; // Name of file being sent
HANDLE getNameTask; // Get full site name task handle
BYTE hostBuffer[MAXGETHOSTSTRUCT]; // Host name reply buffer
int modemConnection; // Connection is via the modem
HMMIO mmioHandle; // WAVE file MMIO handle
LPWAVEFORMAT mmioFormat; // WAVE file format descriptor
DWORD mmioDataLeft; // WAVE file data left to send
int quitSoundFile; // Abort current sound file ?
int wantsInput; // Is wave input wanted ?
int outputSocketBusy; // Output socket is busy with a sendto()
DWORD broadcastBeginTime; // Time (ticks) when subscribed to broadcast
int broadcastEnd; // Terminate broadcast connection ?
struct sockaddr_in name; // Target system address
struct sockaddr_in ctrl; // Target system control port address
char desKeyString[256]; // DES key string
char deskey[9]; // Destination DES key, if any
char rtpdeskey[9]; // Destination RTP DES key, if any
char vatdeskey[9]; // Destination VAT DES key, if any
char ideaKeyString[256]; // IDEA key string
char ideakey[17]; // Destination IDEA key, if any
char blowfishKeyString[256]; // Blowfish key string
char blowfish_spec; // Is Blowfish key specified?
BF_KEY blowfishkey; // Generated Blowfish key
char aesKeyString[256]; // AES key string
int aesKeyHex; // Is AES key hexadecimal ?
char aes_spec; // Is AES key specified ?
aes_ctx aesEkey; // AES encryption key
aes_ctx aesDkey; // AES decryption key
char pgpkeymd5[16]; // Inbound MD5 signature of PGP session key
char pgpkey[17]; // Inbound PGP-transmitted session key
char pgpFileName[MAX_PATH]; // Inbound PGP decoded file name, if strlen > 0
char opgpUserList[256]; // Outbound PGP user ID list
char opgpkey[17]; // Outbound PGP-transmitted session key
char opgpFileName[MAX_PATH]; // Outbound PGP decoded file name, if strlen > 0
char otpFileName[MAX_PATH]; // One-time pad file name
char otp[BUFL]; // One-time pad
int multicast_scope; // Multicast scope (time-to-live)
int squelch; // Squelch
int ring; // Ring
int debugging; // Debug mode
int debugReq; // Debug output requested by remote ?
int loopback; // Loopback mode
int saveKeys; // Save keys in connection file
char connectionFileName[MAX_PATH]; // Connection file name for save
gsm gsmh; // GSM handle for incoming audio
lpcstate_t lpc_state; // LPC decoder state
rate_t rateconv; // Rate conversion state
struct celp_context *d_celp_ctx; // CELP decoding context (allocated when CELP data received)
int rseq; // Robust mode packet sequence number
short protocol; // Transmission protocol
short localLoopback; // Local loopback enabled ?
struct localLoop *llhead, // Local loopback packet chain
*lltail;
char session_id[4]; // VAT/RTP session identifier
int sendSDEStimer; // Sent RTP/VAT ID timer
int buttonUpTimer; // Button up timer running
LPSTR uname; // User name, if known
char email[256]; // User E-mail address, if known
char szRemoteProgram[256]; // Name of connected party's client software
int face_stat; // Face retrieval status
long face_address; // Address of current block request
int face_retry; // Timeout retry count
int face_timeout; // Timeout interval
LPSTR face_bmp; // In memory copy of face .bmp file
int face_is_gif; // Face being received as .gif file
long face_file_length; // Length of face file being received
int face_shown; // Face bitmap currently displayed ?
int bSentOutgoingMessage; // Sent outgoing message already.
} CLIENT_DATA, *LPCLIENT_DATA;
#define CLIENTPTR(w) ((LPCLIENT_DATA)GetWindowLong((w), GWL_CLIENT))
#define IS_CLIENT_WINDOW(w) (CLIENTPTR(w)->dwType == WINDOW_TYPE_CLIENT)
// Face retrieval status values for face_stat
#define FSinit 0 // Nothing requested yet
#define FSrequest 1 // Request sent, awaiting reply
#define FSreply 2 // Reply received, ready for next request
#define FScomplete 3 // Face file reception complete
#define FSabandoned 4 // Face file retrieval abandoned
// Face retrieval configuration parameters
#define FaceFetchInterval 250 // Interval between block requests, msec
#define FaceTimeout 20 // Resend block request after this number of intervals
#define FaceMaxRetries 10 // Maximum retries to obtain face data
// Configuration parameters for adaptive output rate adjustment
#define AORA_MINIMUM_DELAY 500 // Minimum delay (ms) at which to act, regardless of jitter
#define AORA_ACTION_DELAY 500 // Begin adjusting rate when queue delay > this value in ms
#define AORA_MAXIMUM_RATE_PERCENT 10 // Maximum output rate speed-up in percent
#define AORA_MAXIMUM_RATE_DELAY 3000 // Apply maximum rate when delay greater than this number of ms
// System tray interaction
#define TRAY // Enable system tray minimisation
#ifdef TRAY
#define WM_TRAY_NOTIFY (WM_USER + 300) // System tray notification message
extern HWND trayIconWindow; // Tray icon window, if active
extern HWND createTrayIcon(void); // Create tray icon window
extern void updateTrayToolTipText(void); // Update ToolTip on tray icon to current status
extern void blinkTrayIcon(BOOL blink); // Start or stop the tray icon blinking
#define TRAY_TIMER_ID 7 // Tray timer ID
#endif
// Audio encoding types for RTP and VAT protocols
typedef enum {
AE_PCMU, AE_PCMA, AE_G721, AE_IDVI, AE_G723, AE_GSM,
AE_1016, AE_LPC,
AE_L8, AE_L16, AE_L24, AE_L32,
AE_G728, AE_TRUE,
AE_MAX
} audio_encoding_t;
/* Common audio description for files and workstations */
typedef struct {
audio_encoding_t encoding; /* type of encoding (differs) */
unsigned sample_rate; /* sample frames per second */
unsigned channels; /* number of interleaved channels */
} audio_descr_t;
// Socket related data
extern SOCKET sCommand; // Command socket
extern struct auxSocket *asList; // List of auxiliary sockets
// Various handles
extern HINSTANCE hInst; // The current instance handle
extern HACCEL hAccel; // Accelerator table handle
extern HWND hwndMDIFrame; // MDI frame window handle
extern HWND hwndMDIClient; // MDI client window handle
extern HWND hDlgPropeller; // Propeller head dialogue handle
extern HWND hDlgAnswer; // Answering machine dialogue handle
extern HWND hDlgChat; // Chat dialogue handle
extern HWND hDlgConsole; // Debug console dialogue handle
extern HWND hDlgSpectral; // Spectral display dialogue handle
// Window class names
extern LPSTR pszFrameClass; // MDI frame window class
extern LPSTR pszMDIClientClass; // MDI client window class
extern LPSTR pszClientClass; // MDI child window class
// Miscellaneous data
extern LPSTR pszAppName; // Application name
extern INT tmAveCharWidth; // TEXTMETRIC.tmAveCharWidth
extern INT tmHeight; // TEXTMETRIC.tmHeight
extern LPSTR commandLine; // Command line from invocation
extern int holped; // Help was invoked somewhere
#ifdef HTML_HELP
extern DWORD HtmlHelpContext; // HTML Help context
#endif
extern UINT fileOpenHelpButton; // File open help button message value
extern char *fileHelpKey; // Help key for file open/save in progress
extern UINT jitterBuf; // Milliseconds to anti-jitter output
extern BOOL jitterPause; // Queueing packets for anti-jitter ?
extern HWAVEOUT hWaveOut; // Wave output handle
extern HWAVEIN hWaveIn; // Wave input handle
extern soundbuf ebuf; // Utility sound buffer
extern int audioChannels, samplesPerSecond, bytesPerSecond, sampleAlignment, bitsPerSample;
extern int currentOutputRate; // Current output sample rate
// Window display modes
extern int openOnAnswerMessage; // Restore from icon when new answering machine message arrives
// Compression modes
extern int voxmode; // VOX mode
extern int breakinput; // break input audio stream for output
extern int compression; // 2X compression mode
extern int gsmcompress; // GSM compression mode
extern int adpcmcompress; // ADPCM compression mode
extern int lpccompress; // LPC compression mode
extern int lpc10compress; // LPC-10 compression mode
extern int celpcompress; // CELP compression mode
extern int robust; // Robust mode for LPC-10
extern int voxcompress; // VOXGSM compression mode
extern int protocolXmit; // Default protocol to send (!protocolAuto or new connection)
extern int protocolSent; // Protocol we're currently sending
extern int protocolAuto; // Send same protocol as received from connection
extern gsm gsmh; // GSM compression handle
#ifdef CELP_USE_CONTEXT
struct celp_context *celp_xp; // Transmit CELP context pointer
#endif
extern rate_t xrate; // Simple (2X) compression context
extern int currentInputSamples; // Samples desired in current input buffers
// Transmission modes
extern int broadcasting; // Broadcasting to all connections ?
extern int listeners; // Current wantsInput windows
extern int bConferencing; // TRUE if we send to and listen to all connections.
// Audio settings for About dialogue
extern int isWaveSound; // Input from wave file ?
extern int inputActive, outputActive; // Current activity flags
extern int inputPaused; // Is input paused for output ?
extern int halfDuplex; // Is hardware half-duplex
extern int aboutInSamples; // Input samples per second
extern int aboutInBits; // Input bits per sample
extern int aboutOutSamples; // Output samples per second
extern int aboutOutBits; // Output bits per sample
// Encryption settings
extern public_key_package pk_package; // Public key package
// Propeller head information
extern long packetsReceived, packetsSent; // Network packet traffic counters
extern long inputPacketsLost, outputPacketsLost;// Packets lost counters
extern int openConnections; // Number of open connections
extern int halfDuplexTransition; // Transitioning from output to input ?
extern int outputInShutdown; // Close output when last buffer returned
extern long outputPending; // Output buffers in queue
extern long microsecondsPending; // Microseconds of samples in buffers on queue
double smoothedMicrosecondsPending; // Smoothed microseconds pending in queue
extern int messageQueueSize; // Message queue size
extern long messageChecks; // Anti-lockup calls on DefaultMessageLoop
// Network configuration for About dialogue
extern int aboutUDPmax; // Longest UDP packet network handles
extern int netMaxSamples; // Maximum samples, possibly net constrained
// Windows and driver bug work-around options
extern int alwaysBindSocket; // Bind output socket to avoid
// bug in some WINSOCK implementations
extern int useSendNotSendto; /* Use send() instead of sendto()
if buggy (Microsoft) WINSOCK
refuses to accept sendto() on
a connect()-ed socket. */
extern int waNetNoConnect; // Don't connect(), use sendto()
extern int waNetUseSend; // Use send(), not sendto() always
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -