MCPcopy Create free account
hub / github.com/RangeNetworks/openbts / pinghttpsend

Function pinghttpsend

GPRS/pinghttp.c:412–436  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

410}
411
412int pinghttpsend(packet_t *packet,mg_con_t *mgp,int sfd,struct sockaddr *toaddr)
413{
414 int rc;
415 usleep(100000);
416 if (options.v) ip_hdr_dump(packet->storage,"sending:");
417 //struct iphdr *pip = (struct iphdr*)packet->s;
418 //printf("packet->len = %d tot_len=%d\n",packet->tot_len,ntohs(pip->tot_len));
419 if (options.use_tunnel) {
420 rc = write(tun_fd,packet->storage,packet->tot_len);
421 } else if (mgp) {
422#ifndef STANDALONE
423 rc = miniggsn_snd_npdu_by_mgc(mgp,packet->storage,packet->tot_len);
424#endif
425 } else {
426 // Note: when I left the non-raw socket connected above and fell through
427 // to this code, it looked like the raw socket may not receive on this port until
428 // the connected socket is closed, not sure.
429 rc = sendto(sfd,packet->storage,packet->tot_len,0,toaddr,sizeof(struct sockaddr));
430 }
431 if (rc < 0) {
432 printf("sendto failed: %s\n",strerror(errno));
433 return 2;
434 }
435 return 0;
436}
437
438
439

Callers 1

tcpsendFunction · 0.85

Calls 2

ip_hdr_dumpFunction · 0.70
miniggsn_snd_npdu_by_mgcFunction · 0.70

Tested by

no test coverage detected