Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
MQTTLinux.h
00001 /******************************************************************************* 00002 * Copyright (c) 2014 IBM Corp. 00003 * 00004 * All rights reserved. This program and the accompanying materials 00005 * are made available under the terms of the Eclipse Public License v1.0 00006 * and Eclipse Distribution License v1.0 which accompany this distribution. 00007 * 00008 * The Eclipse Public License is available at 00009 * http://www.eclipse.org/legal/epl-v10.html 00010 * and the Eclipse Distribution License is available at 00011 * http://www.eclipse.org/org/documents/edl-v10.php. 00012 * 00013 * Contributors: 00014 * Allan Stockdill-Mander - initial API and implementation and/or initial documentation 00015 *******************************************************************************/ 00016 00017 #if !defined(__MQTT_LINUX_) 00018 #define __MQTT_LINUX_ 00019 00020 #if defined(WIN32_DLL) || defined(WIN64_DLL) 00021 #define DLLImport __declspec(dllimport) 00022 #define DLLExport __declspec(dllexport) 00023 #elif defined(LINUX_SO) 00024 #define DLLImport extern 00025 #define DLLExport __attribute__ ((visibility ("default"))) 00026 #else 00027 #define DLLImport 00028 #define DLLExport 00029 #endif 00030 00031 #include <sys/types.h> 00032 #include <sys/socket.h> 00033 #include <sys/param.h> 00034 #include <sys/time.h> 00035 #include <sys/select.h> 00036 #include <netinet/in.h> 00037 #include <netinet/tcp.h> 00038 #include <arpa/inet.h> 00039 #include <netdb.h> 00040 #include <stdio.h> 00041 #include <unistd.h> 00042 #include <errno.h> 00043 #include <fcntl.h> 00044 00045 #include <stdlib.h> 00046 #include <string.h> 00047 #include <signal.h> 00048 00049 typedef struct Timer 00050 { 00051 struct timeval end_time; 00052 } Timer; 00053 00054 void TimerInit(Timer*); 00055 char TimerIsExpired(Timer*); 00056 void TimerCountdownMS(Timer*, unsigned int); 00057 void TimerCountdown(Timer*, unsigned int); 00058 int TimerLeftMS(Timer*); 00059 00060 typedef struct Network 00061 { 00062 int my_socket; 00063 int (*mqttread) (struct Network*, unsigned char*, int, int); 00064 int (*mqttwrite) (struct Network*, unsigned char*, int, int); 00065 } Network; 00066 00067 int linux_read(Network*, unsigned char*, int, int); 00068 int linux_write(Network*, unsigned char*, int, int); 00069 00070 DLLExport void NetworkInit(Network*); 00071 DLLExport int NetworkConnect(Network*, char*, int); 00072 DLLExport void NetworkDisconnect(Network*); 00073 00074 #endif
Generated on Wed Jul 13 2022 10:46:02 by
1.7.2