le_comm.h

Go to the documentation of this file.
1 /**
2  * @file le_comm.h
3  *
4  * This file contains the prototypes of Legato RPC Communication API,
5  * used to provide network communication between two or more remote-host
6  * systems.
7  *
8  * Copyright (C) Sierra Wireless Inc.
9  */
10 #ifndef LE_COMM_H_INCLUDE_GUARD
11 #define LE_COMM_H_INCLUDE_GUARD
12 
13 //--------------------------------------------------------------------------------------------------
14 /**
15  * Legato RPC Communication Types
16  */
17 //--------------------------------------------------------------------------------------------------
18 typedef void (*le_comm_CallbackHandlerFunc_t) (void* handle, short events);
19 
20 
21 //--------------------------------------------------------------------------------------------------
22 /**
23  * Function for Creating a RPC Communication Channel
24  *
25  * Return Code
26  * - LE_OK if successfully,
27  * - LE_WAITING if pending on asynchronous connection,
28  * - otherwise failure
29  *
30  * @return
31  * Opaque handle to the Communication Channel.
32  */
33 //--------------------------------------------------------------------------------------------------
34 __attribute__((weak))
36 (
37  const int argc, ///< [IN] Number of strings pointed to by argv.
38  const char *argv[], ///< [IN] Pointer to an array of character strings.
39  le_result_t* resultPtr ///< [OUT] Return Code
40 );
41 
42 //--------------------------------------------------------------------------------------------------
43 /**
44  * Function for Registering a Callback Handler function to monitor events on the specific handle
45  *
46  * @return
47  * - LE_OK if successfully.
48  */
49 //--------------------------------------------------------------------------------------------------
50 __attribute__((weak))
52 (
53  void* handle, ///< [IN] Communication channel handle.
54  le_comm_CallbackHandlerFunc_t handlerFunc, ///< [IN] Callback Handler Function.
55  short events ///< [IN] Events to be monitored.
56 );
57 
58 //--------------------------------------------------------------------------------------------------
59 /**
60  * Function for Deleting a RPC Communicaiton Channel
61  *
62  * @return
63  * - LE_OK if successfully.
64  */
65 //--------------------------------------------------------------------------------------------------
66 __attribute__((weak))
68 (
69  void* handle ///< [IN] Communication channel.
70 );
71 
72 //--------------------------------------------------------------------------------------------------
73 /**
74  * Function for Connecting a RPC Communication Channel
75  *
76  * @return
77  * - LE_OK if successfully.
78  */
79 //--------------------------------------------------------------------------------------------------
80 __attribute__((weak))
82 (
83  void* handle ///< [IN] Communication channel.
84 );
85 
86 //--------------------------------------------------------------------------------------------------
87 /**
88  * Function for Disconnecting a RPC Communication Channel
89  *
90  * @return
91  * - LE_OK if successfully.
92  */
93 //--------------------------------------------------------------------------------------------------
94 __attribute__((weak))
96 (
97  void* handle ///< [IN] Communication channel.
98 );
99 
100 //--------------------------------------------------------------------------------------------------
101 /**
102  * Function for Sending Data over a RPC Communication Channel
103  *
104  * @return
105  * - LE_OK if successfully.
106  */
107 //--------------------------------------------------------------------------------------------------
108 __attribute__((weak))
110 (
111  void* handle, ///< [IN] Communication channel.
112  const void* buf, ///< [IN] Pointer to buffer of data to be sent.
113  size_t len ///< [IN] Size of data to be sent.
114 );
115 
116 //--------------------------------------------------------------------------------------------------
117 /**
118  * Function for Receiving Data over a RPC Communication Channel
119  *
120  * @return
121  * - LE_OK if successfully.
122  */
123 //--------------------------------------------------------------------------------------------------
124 __attribute__((weak))
126 (
127  void* handle, ///< [IN] Communication channel.
128  void* buf, ///< [IN] Pointer to buffer to hold received data.
129  size_t* len ///< [IN] Size of data received.
130 );
131 
132 
133 //--------------------------------------------------------------------------------------------------
134 /**
135  * Get Support Functions
136  */
137 //--------------------------------------------------------------------------------------------------
138 //--------------------------------------------------------------------------------------------------
139 /**
140  * Function to retrieve an ID for the specified handle.
141  * NOTE: For logging or display purposes only.
142  *
143  * @return
144  * - Non-zero integer, if successful.
145  * - Negative one (-1), otherwise.
146  */
147 //--------------------------------------------------------------------------------------------------
148 __attribute__((weak))
150 (
151  void* handle
152 );
153 
154 //--------------------------------------------------------------------------------------------------
155 /**
156  * Function to retrieve the Parent Handle.
157  * NOTE: For asynchronous connections only.
158  *
159  * @return
160  * - Parent (Listening) handle, if successfully.
161  * - NULL, otherwise.
162  */
163 //--------------------------------------------------------------------------------------------------
164 __attribute__((weak))
166 (
167  void* handle
168 );
169 
170 #endif /* LE_COMM_H_INCLUDE_GUARD */
LE_SHARED le_result_t le_comm_Send(void *handle, const void *buf, size_t len)
#define LE_SHARED
Definition: le_basics.h:241
LE_SHARED le_result_t le_comm_RegisterHandleMonitor(void *handle, le_comm_CallbackHandlerFunc_t handlerFunc, short events)
le_result_t
Definition: le_basics.h:35
LE_SHARED void * le_comm_GetParentHandle(void *handle)
LE_SHARED le_result_t le_comm_Disconnect(void *handle)
LE_SHARED void * le_comm_Create(const int argc, const char *argv[], le_result_t *resultPtr)
LE_SHARED int le_comm_GetId(void *handle)
void(* le_comm_CallbackHandlerFunc_t)(void *handle, short events)
Definition: le_comm.h:18
LE_SHARED le_result_t le_comm_Receive(void *handle, void *buf, size_t *len)
LE_SHARED le_result_t le_comm_Delete(void *handle)
LE_SHARED le_result_t le_comm_Connect(void *handle)