📄 netfone.h
字号:
short soundBufLength; // Length of sound buffer
/* The following items appear in the file after the header defined
above, with lengths as given in the header. */
// char hostName[hostNameLength]; // Full name of host
// soundbuf fileSoundBuf; // Sound buffer, truncated to soundBufLength bytes
};
// Local loopback packet buffer
struct localLoop {
struct localLoop *llnext; // Next buffer in chain or NULL
int lllen; // Length of packet in bytes
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 lcmrate; /* least common multiple of rates */
unsigned long inskip, outskip; /* LCM increments for I & O rates */
unsigned long total;
unsigned long intot, outtot; /* total samples in terms of LCM rate */
long lastsamp;
} 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;
/* 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 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
lpcstate_t lpc_state; // LPC decoder state
rate_t rateconv; // Rate conversion state
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
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
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 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
extern UINT fileOpenHelpButton; // File open help button message value
extern char *fileHelpKey; // Help key for file open/save in progress
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
// 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 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
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
// 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 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
extern int waNetMultiTTLisChar; // Argument to IP_MULTICAST_TTL setsockopt is char
extern int waNetNoOutOverflow; // Disable output overflow detection and recovery
extern int waNetNoMsgLoopIns; // Disable message loop insurance
extern int waNetSynchronousGetHostname; // Use gethostbyaddr(), not WASAsync variant
extern int waNetSynchronousGetHostnameAction; // Action depending on above and Winsock type
extern int waProtNoHeartbeat; // No heartbeat in Speak Freely protocol
extern int waProtUseLargerRTCPackets; // Use large packets with RTP protocol
extern int waProtNoVAT; // Disable auto-sensing of VAT protocol
extern int waProtNoRTP; // Disable auto-sensing of RTP protocol
extern int waProtNoRTCPCrypt; // Don't encrypt RTCP packets
extern int waAudioHalf; // Assume audio half-duplex; don't test
extern int waAudio11025; // Assume audio 11025 samples/sec
extern int waAudioRingMaxVolume; // Force maximum output volume for remote ring
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -