> For the complete documentation index, see [llms.txt](https://sandbox-docs.verifone.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sandbox-docs.verifone.com/s-adk-5.1-programmers-guide/readme/files/dir_30aba3d9bf6279a25d84abe4015711f7/dir_f7a957c8f5c8e80b5a8d4b37f193d419/dir_e8da2933844aa72825eccee783cf08f3/ci_direct_8c.md).

# ciDirect.c

[Macros](#define-members) | [Functions](#func-members)

`#include <errno.h>` `#include <fcntl.h>` `#include <libgen.h>` `#include <memory.h>` `#include <pthread.h>` `#include <signal.h>` `#include <syslog.h>` `#include <sys/time.h>` `#include <sys/wait.h>` `#include <ucontext.h>` `#include <unistd.h>` `#include <svcmgr/svc_net.h>` `#include <stdarg.h>` `#include <stdio.h>` `#include <stdlib.h>` `#include <svc.h>` `#include "VHQTypes.h"` `#include "VHQDebug.h"` `#include "ComIntf.h"` `#include "VHQConfig.h"` `#include "VHQIo.h"`

Include dependency graph for ciDirect.c:

![](/files/c2sfBApEJN3HoZ0DXV9Z)

|         |                                                                                    |
| ------- | ---------------------------------------------------------------------------------- |
| Macros  |                                                                                    |
| #define | [ARRAY\_SIZEOF](#a083b03c5af4ad6035a7b2879c523150c)(x)   (sizeof(x)/sizeof(x\[0])) |

|               |                                                                                                                                         |
| ------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| Functions     |                                                                                                                                         |
| void          | [CheckAndInitLog](#af8673306bb95c4811b31e9f1dc1a8ca3) ()                                                                                |
| int           | [InitVXComms](#a63a54b0dd95a1b95c327144de73f8e0b) (bool NWIF\_start)                                                                    |
| void          | [StartNetwork](#a14218cafcf8cb7b241304a53c65c98a9) (void)                                                                               |
| void          | [StartCommEngine](#a4e9cf7d5bfbf9b781773b0f768525a5d) (void)                                                                            |
| int           | [internal\_GetMACAddress](#a07cc05691d9ade5eac44bf6759c347fb) (char \*pszMACAddress, int iMACAddressBufLen)                             |
| int           | [internal\_GetIPAddress](#afb24d619e9278eec2d27a3c03376d1c3) (char \*pszIPAddress, int iIPAddressBufLen)                                |
| int           | [Direct\_init](#aa2fc20b9443dc4d15ab2eba9b01adda5) (char \*pszSettings1, char \*pszSettings2, char \*pszSettings3, char \*pszSettings4) |
| int           | [Direct\_deinit](#ab09a84c65f71594a576ecacf8e81d333) (void)                                                                             |
| int           | [Direct\_open](#aa81d23033a1408b30fae9c448bc7531f) (CommOpenData \*pData)                                                               |
| int           | [Direct\_close](#a7954a2c6c7d3d3efda7cce26fe52209a) (CommOpenData \*pData)                                                              |
| int           | [Direct\_status](#a0f3afebb197058907fc1612a1d844180) (void \*pData, bool \*bUp, char \*pszIpAddress, char \*pszMacAddr)                 |
| int           | [Direct\_NetConn](#a4c56fad0e52ab28ecc97e80365f24812) (void)                                                                            |
| int           | [Direct\_NetDisconn](#a8b0c66a848f30fe9db652a958cd3fab8) (bool bForceDisconnect)                                                        |
| const char \* | [Direct\_ErrString](#a7add574cf5e9636377da0e5ed064b54f) (int err)                                                                       |

### DetailedDescription <a href="#detailed-description" id="detailed-description"></a>

File for Direct operating mode connectivity.

### MacroDefinition Documentation <a href="#macro-definition-documentation" id="macro-definition-documentation"></a>

### ARRAY\_SIZEOF <a href="#a083b03c5af4ad6035a7b2879c523150c" id="a083b03c5af4ad6035a7b2879c523150c"></a>

\#define ARRAY\_SIZEOF

### FunctionDocumentation <a href="#function-documentation" id="function-documentation"></a>

### CheckAndInitLog() <a href="#af8673306bb95c4811b31e9f1dc1a8ca3" id="af8673306bb95c4811b31e9f1dc1a8ca3"></a>

void CheckAndInitLog

### Direct\_close() <a href="#a7954a2c6c7d3d3efda7cce26fe52209a" id="a7954a2c6c7d3d3efda7cce26fe52209a"></a>

int Direct\_close

### Direct\_deinit() <a href="#ab09a84c65f71594a576ecacf8e81d333" id="ab09a84c65f71594a576ecacf8e81d333"></a>

int Direct\_deinit

### Direct\_ErrString() <a href="#a7add574cf5e9636377da0e5ed064b54f" id="a7add574cf5e9636377da0e5ed064b54f"></a>

const char\\\* Direct\_ErrString

### Direct\_init() <a href="#aa2fc20b9443dc4d15ab2eba9b01adda5" id="aa2fc20b9443dc4d15ab2eba9b01adda5"></a>

int Direct\_init

### Direct\_NetConn() <a href="#a4c56fad0e52ab28ecc97e80365f24812" id="a4c56fad0e52ab28ecc97e80365f24812"></a>

int Direct\_NetConn

This function establishes connection to network and set the successful connection type if operating mode is direct.

#### Returns

0, if network connect is successful.

### Direct\_NetDisconn() <a href="#a8b0c66a848f30fe9db652a958cd3fab8" id="a8b0c66a848f30fe9db652a958cd3fab8"></a>

int Direct\_NetDisconn

This function is the disconnect from network if operating mode is direct.

**Parameters**

\[in] **bForceDisconnect** =TRUE, if force disconnect is active

#### Returns

0, if network disconnect is successful.

### Direct\_open() <a href="#aa81d23033a1408b30fae9c448bc7531f" id="aa81d23033a1408b30fae9c448bc7531f"></a>

int Direct\_open

### Direct\_status() <a href="#a0f3afebb197058907fc1612a1d844180" id="a0f3afebb197058907fc1612a1d844180"></a>

int Direct\_status

This function returns the IP address and Mac address if connection status is active

**Parameters**

\[in] **pData** = UNUSED. \[out] **bUp** = to store status, TRUE if active/IP address is present \[out] **pszIpAddress** = to store IP Address \[out] **pszMacAddr** = to store Mac address

#### Returns

int -1, if not attached; 0, if connection attached

### InitVXComms() <a href="#a63a54b0dd95a1b95c327144de73f8e0b" id="a63a54b0dd95a1b95c327144de73f8e0b"></a>

int InitVXComms

### internal\_GetIPAddress() <a href="#afb24d619e9278eec2d27a3c03376d1c3" id="afb24d619e9278eec2d27a3c03376d1c3"></a>

int internal\_GetIPAddress

Function gather the IP address information.

**Parameters**

\[out] **pszIPAddress** = pointer to IP address \[out] **iIPAddressBufLen** = IP address buffer length

#### Returns

int 0, if success

### internal\_GetMACAddress() <a href="#a07cc05691d9ade5eac44bf6759c347fb" id="a07cc05691d9ade5eac44bf6759c347fb"></a>

int internal\_GetMACAddress

Function gather the MAC address information.

**Parameters**

\[out] **pszMACAddress** = pointer to MAC address \[out] **iMACAddressBufLen** = MAC address buffer length

#### Returns

int 0,if success

### StartCommEngine() <a href="#a4e9cf7d5bfbf9b781773b0f768525a5d" id="a4e9cf7d5bfbf9b781773b0f768525a5d"></a>

void StartCommEngine

### StartNetwork() <a href="#a14218cafcf8cb7b241304a53c65c98a9" id="a14218cafcf8cb7b241304a53c65c98a9"></a>

void StartNetwork


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://sandbox-docs.verifone.com/s-adk-5.1-programmers-guide/readme/files/dir_30aba3d9bf6279a25d84abe4015711f7/dir_f7a957c8f5c8e80b5a8d4b37f193d419/dir_e8da2933844aa72825eccee783cf08f3/ci_direct_8c.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
