2014-03-03 11:09:26 -08:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* \section COPYRIGHT
|
|
|
|
*
|
|
|
|
* Copyright 2013-2014 The libLTE Developers. See the
|
|
|
|
* COPYRIGHT file at the top-level directory of this distribution.
|
|
|
|
*
|
|
|
|
* \section LICENSE
|
|
|
|
*
|
|
|
|
* This file is part of the libLTE library.
|
|
|
|
*
|
|
|
|
* libLTE is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License as
|
|
|
|
* published by the Free Software Foundation, either version 3 of
|
|
|
|
* the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* libLTE is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* A copy of the GNU Lesser General Public License can be found in
|
|
|
|
* the LICENSE file in the top-level directory of this distribution
|
|
|
|
* and at http://www.gnu.org/licenses/.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2014-06-13 04:42:29 -07:00
|
|
|
#ifndef UDPSINK_
|
|
|
|
#define UDPSINK_
|
2014-03-03 11:09:26 -08:00
|
|
|
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#include <arpa/inet.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2014-06-17 06:20:00 -07:00
|
|
|
#include "liblte/config.h"
|
2014-03-03 11:09:26 -08:00
|
|
|
|
|
|
|
/* Low-level API */
|
2014-06-13 04:42:29 -07:00
|
|
|
typedef struct LIBLTE_API {
|
2014-06-17 02:11:41 -07:00
|
|
|
int sockfd;
|
|
|
|
struct sockaddr_in servaddr;
|
2014-03-03 11:09:26 -08:00
|
|
|
}udpsink_t;
|
|
|
|
|
2014-12-26 15:36:32 -08:00
|
|
|
LIBLTE_API int udpsink_init(udpsink_t *q,
|
|
|
|
char *address,
|
|
|
|
int port);
|
|
|
|
|
2014-06-13 04:42:29 -07:00
|
|
|
LIBLTE_API void udpsink_free(udpsink_t *q);
|
2014-03-03 11:09:26 -08:00
|
|
|
|
2014-12-26 15:36:32 -08:00
|
|
|
LIBLTE_API int udpsink_write(udpsink_t *q,
|
|
|
|
void *buffer,
|
|
|
|
int nof_bytes);
|
2014-03-03 11:09:26 -08:00
|
|
|
|
|
|
|
|
|
|
|
/* High-level API */
|
2014-06-13 04:42:29 -07:00
|
|
|
typedef struct LIBLTE_API {
|
2014-06-17 02:11:41 -07:00
|
|
|
udpsink_t obj;
|
|
|
|
struct udpsink_init {
|
|
|
|
char *address;
|
|
|
|
int port;
|
|
|
|
int block_length;
|
|
|
|
int data_type;
|
|
|
|
} init;
|
|
|
|
void* input;
|
|
|
|
int in_len;
|
2014-03-03 11:09:26 -08:00
|
|
|
}udpsink_hl;
|
|
|
|
|
2014-06-13 04:42:29 -07:00
|
|
|
LIBLTE_API int udpsink_initialize(udpsink_hl* h);
|
2014-06-17 02:11:41 -07:00
|
|
|
LIBLTE_API int udpsink_work( udpsink_hl* hl);
|
2014-06-13 04:42:29 -07:00
|
|
|
LIBLTE_API int udpsink_stop(udpsink_hl* h);
|
2014-03-03 11:09:26 -08:00
|
|
|
|
2014-06-13 04:42:29 -07:00
|
|
|
#endif // UDPSINK_
|