6 #include <sys/socket.h> 20 FILE* pFile = fopen(
fname,
"r");
21 if (pFile ==
nullptr) {
27 fseek(pFile, 0, SEEK_END);
28 unsigned int lSize = ftell(pFile);
46 unsigned int deflatedSize = compressBound(lSize) + 4;
47 Bytef* deflatedBuff = (Bytef*)
malloc(
sizeof(Bytef) * (deflatedSize));
48 *((
unsigned int*)deflatedBuff) = htonl(lSize);
51 *buffPtr = deflatedBuff;
54 zippedSize = deflatedSize;
55 compress(deflatedBuff + 4, &zippedSize, (
const Bytef*)
buffer, lSize);
69 std::cerr <<
"Uasage: sendCrashReport <fileName>" << std::endl;
74 int sd = socket(AF_INET, SOCK_DGRAM, 0);
80 struct sockaddr_in cliAddr;
81 cliAddr.sin_family = AF_INET;
82 cliAddr.sin_addr.s_addr = htonl(INADDR_ANY);
83 cliAddr.sin_port = htons(0);
85 int rc = bind(sd, (
struct sockaddr*)&cliAddr,
sizeof(cliAddr));
87 std::cerr <<
"Can't bind port %d " << rc << std::endl;
92 struct hostent*
h = gethostbyname(
"xrootd.t2.ucsd.edu");
98 struct sockaddr_in remoteServAddr;
99 remoteServAddr.sin_family =
h->h_addrtype;
100 memcpy((
char*)&remoteServAddr.sin_addr.s_addr,
h->h_addr_list[0],
h->h_length);
101 remoteServAddr.sin_port = htons(9699);
104 unsigned long buffSize;
107 sendto(sd, buff, buffSize, 0, (
struct sockaddr*)&remoteServAddr,
sizeof(remoteServAddr));
void getCompressedBuffer(const char *fname, Bytef **buffPtr, unsigned long &zippedSize)
void free(void *ptr) noexcept
int main(int argc, char **argv)
void * malloc(size_t size) noexcept
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.