if (res == -1)
{
sock_geterror("pcap_startcapture_remote()", fp->errbuf, PCAP_ERRBUF_SIZE);
- SOCK_DEBUG_MESSAGE(fp->errbuf);
+ goto error;
}
/*
{
if (sock_initaddress(address, RPCAP_DEFAULT_NETPORT_ACTIVE, &hints, &addrinfo, errbuf, PCAP_ERRBUF_SIZE) == -1)
{
- SOCK_DEBUG_MESSAGE(errbuf);
return (SOCKET)-2;
}
}
{
if (sock_initaddress(address, port, &hints, &addrinfo, errbuf, PCAP_ERRBUF_SIZE) == -1)
{
- SOCK_DEBUG_MESSAGE(errbuf);
return (SOCKET)-2;
}
}
if ((sockmain = sock_open(addrinfo, SOCKOPEN_SERVER, 1, errbuf, PCAP_ERRBUF_SIZE)) == INVALID_SOCKET)
{
- SOCK_DEBUG_MESSAGE(errbuf);
freeaddrinfo(addrinfo);
return (SOCKET)-2;
}
* \{
*/
-/*
- * \brief DEBUG facility: it prints an error message on the screen (stderr)
- *
- * This macro prints the error on the standard error stream (stderr);
- * if we are working in debug mode (i.e. there is no NDEBUG defined) and we are in
- * Microsoft Visual C++, the error message will appear on the MSVC console as well.
- *
- * When NDEBUG is defined, this macro is empty.
- *
- * \param msg: the message you want to print.
- *
- * \param expr: 'false' if you want to abort the program, 'true' it you want
- * to print the message and continue.
- *
- * \return No return values.
- */
-#ifdef NDEBUG
- #define SOCK_DEBUG_MESSAGE(msg) ((void)0)
-#else
- #if (defined(_WIN32) && defined(_MSC_VER))
- #include <crtdbg.h> /* for _CrtDbgReport */
- /* Use MessageBox(NULL, msg, "warning", MB_OK)' instead of the other calls if you want to debug a Win32 service */
- /* Remember to activate the 'allow service to interact with desktop' flag of the service */
- #define SOCK_DEBUG_MESSAGE(msg) { _CrtDbgReport(_CRT_WARN, NULL, 0, NULL, "%s\n", msg); fprintf(stderr, "%s\n", msg); }
- #else
- #define SOCK_DEBUG_MESSAGE(msg) { fprintf(stderr, "%s\n", msg); }
- #endif
-#endif
-
/****************************************************
* *
* Exported functions / definitions *