FreeCalypso > hg > themwi-system-sw
comparison smpp-send/sock_send.c @ 225:243ed87880a1
smpp-send: implement sending via local socket
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 05 Aug 2023 12:52:33 -0800 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
224:62184b971c8e | 225:243ed87880a1 |
---|---|
1 /* | |
2 * This module implements local datagram socket transmission of the constructed | |
3 * submit_sm PDU to our smpp-trx-sa daemon process. | |
4 */ | |
5 | |
6 #include <sys/types.h> | |
7 #include <sys/socket.h> | |
8 #include <sys/un.h> | |
9 #include <stdio.h> | |
10 #include <stdlib.h> | |
11 #include <unistd.h> | |
12 | |
13 extern char *trx_socket; | |
14 | |
15 void | |
16 send_pdu_via_socket(pdu, pdulen) | |
17 u_char *pdu; | |
18 unsigned pdulen; | |
19 { | |
20 struct sockaddr_un sa; | |
21 unsigned sa_len; | |
22 int lsock, rc; | |
23 | |
24 lsock = socket(AF_UNIX, SOCK_DGRAM, 0); | |
25 if (lsock < 0) { | |
26 perror("socket(AF_UNIX, SOCK_DGRAM, 0)"); | |
27 exit(1); | |
28 } | |
29 fill_sockaddr_un(trx_socket, &sa, &sa_len); | |
30 rc = sendto(lsock, pdu, pdulen, 0, (struct sockaddr *) &sa, sa_len); | |
31 if (rc != pdulen) { | |
32 perror("send via local socket"); | |
33 exit(1); | |
34 } | |
35 close(lsock); | |
36 } |