|
_i16 | sl_NetAppStart (const _u32 AppBitMap) |
| Starts a network application. More...
|
|
_i16 | sl_NetAppStop (const _u32 AppBitMap) |
| Stops a network application. More...
|
|
_i16 | sl_NetAppDnsGetHostByName (_i8 *hostname, const _u16 usNameLen, _u32 *out_ip_addr, const _u8 family) |
| Get host IP by name. More...
|
|
_i32 | sl_NetAppDnsGetHostByService (_i8 *pServiceName, const _u8 ServiceLen, const _u8 Family, _u32 pAddr[], _u32 *pPort, _u16 *pTextLen, _i8 *pText) |
| Return service attributes like IP address, port and text according to service name. More...
|
|
_i16 | sl_NetAppGetServiceList (const _u8 IndexOffest, const _u8 MaxServiceCount, const _u8 Flags, _i8 *pBuffer, const _u32 RxBufferLength) |
| Get service List Insert into out pBuffer a list of peer's services that are the NWP. The list is in a form of service struct. The user should chose the type of the service struct like: More...
|
|
_i16 | sl_NetAppMDNSUnRegisterService (const _i8 *pServiceName, const _u8 ServiceNameLen) |
| Unregister mDNS service This function deletes the mDNS service from the mDNS package and the database. More...
|
|
_i16 | sl_NetAppMDNSRegisterService (const _i8 *pServiceName, const _u8 ServiceNameLen, const _i8 *pText, const _u8 TextLen, const _u16 Port, const _u32 TTL, _u32 Options) |
| Register a new mDNS service. More...
|
|
_i16 | sl_NetAppPingStart (const SlPingStartCommand_t *pPingParams, const _u8 family, SlPingReport_t *pReport, const P_SL_DEV_PING_CALLBACK pPingCallback) |
| send ICMP ECHO_REQUEST to network hosts More...
|
|
_i32 | sl_NetAppSet (const _u8 AppId, const _u8 Option, const _u8 OptionLen, const _u8 *pOptionValue) |
| Internal function for setting network application configurations. More...
|
|
_i32 | sl_NetAppGet (const _u8 AppId, const _u8 Option, _u8 *pOptionLen, _u8 *pOptionValue) |
| Internal function for getting network applications configurations. More...
|
|
_i32 sl_NetAppDnsGetHostByService |
( |
_i8 * |
pServiceName, |
|
|
const _u8 |
ServiceLen, |
|
|
const _u8 |
Family, |
|
|
_u32 |
pAddr[], |
|
|
_u32 * |
pPort, |
|
|
_u16 * |
pTextLen, |
|
|
_i8 * |
pText |
|
) |
| |
Return service attributes like IP address, port and text according to service name.
- The user sets a service name Full/Part (see example below), and should get:
- IP of service
- The port of service
- The text of service
Hence it can make a connection to the specific service and use it. It is similar to get host by name method. It is done by a single shot query with PTR type on the service name. The command that is sent is from constant parameters and variables parameters.
- Parameters
-
[in] | pService | Service name can be full or partial.
Example for full service name:
- PC1._ipp._tcp.local
- PC2_server._ftp._tcp.local
Example for partial service name:
- _ipp._tcp.local
- _ftp._tcp.local
|
[in] | ServiceLen | The length of the service name (in_pService). |
[in] | Family | IPv4 or IPv6 (SL_AF_INET , SL_AF_INET6). |
[out] | pAddr | Contains the IP address of the service. |
[out] | pPort | Contains the port of the service. |
[out] | pTextLen | Has 2 options. One as Input field and the other one as output:
- Input:
Contains the max length of the text that the user wants to get.
It means that if the text len of service is bigger that its value than the text is cut to inout_TextLen value.
- Output:
Contain the length of the text that is returned. Can be full text or part of the text (see above).
|
[out] | pOut_pText | Contains the text of the service full or partial |
- Returns
- On success, zero is returned SL_POOL_IS_EMPTY may be return in case there are no resources in the system In this case try again later or increase MAX_CONCURRENT_ACTIONS In case No service is found error SL_NET_APP_DNS_NO_ANSWER will be returned
- Note
- The returns attributes belongs to the first service found. There may be other services with the same service name that will response to the query. The results of these responses are saved in the peer cache of the Device and should be read by another API.
Only one sl_NetAppDnsGetHostByService can be handled at a time. Calling this API while the same command is called from another thread, may result in one of the two scenarios:
- The command will wait (internal) until the previous command finish, and then be executed.
- There are not enough resources and SL_POOL_IS_EMPTY error will return. In this case, MAX_CONCURRENT_ACTIONS can be increased (result in memory increase) or try again later to issue the command.
- Warning
- Text length can be 120 bytes only
_i16 sl_NetAppGetServiceList |
( |
const _u8 |
IndexOffest, |
|
|
const _u8 |
MaxServiceCount, |
|
|
const _u8 |
Flags, |
|
|
_i8 * |
pBuffer, |
|
|
const _u32 |
RxBufferLength |
|
) |
| |
Get service List Insert into out pBuffer a list of peer's services that are the NWP. The list is in a form of service struct. The user should chose the type of the service struct like:
- Full service parameters with text.
- Full service parameters.
- Short service parameters (port and IP only) especially for tiny hosts.
The different types of struct are made to give the Possibility to save memory in the host
The user also chose how many max services to get and start point index NWP peer cache. For example:
- Get max of 3 full services from index 0.Up to 3 full services from index 0 are inserted into pBuffer (services that are in indexes 0,1,2).
- Get max of 4 full services from index 3.Up to 4 full services from index 3 are inserted into pBuffer (services that are in indexes 3,4,5,6).
- Get max of 2 int services from index 6.Up to 2 int services from index 6 are inserted into pBuffer (services that are in indexes 6,7).
See below - command parameters.
- Parameters
-
[in] | indexOffset | - The start index in the peer cache that from it the first service is returned. |
[in] | MaxServiceCount | - The Max services that can be returned if existed or if not exceed the max index in the peer cache |
[in] | Flags | - an ENUM number that means which service struct to use (means which types of service to fill)
|
[out] | Buffer | - The Services are inserted into this buffer. In the struct form according to the bit that is set in the Flags input parameter. |
- Returns
- ServiceFoundCount - The number of the services that were inserted into the buffer. zero means no service is found negative number means an error
- See also
- sl_NetAppMDNSRegisterService
- Note
- Warning
- if the out pBuffer size is bigger than an RX packet(1480), than an error is returned because there is no place in the RX packet. The size is a multiply of MaxServiceCount and size of service struct(that is set according to flag value).
_i16 sl_NetAppMDNSRegisterService |
( |
const _i8 * |
pServiceName, |
|
|
const _u8 |
ServiceNameLen, |
|
|
const _i8 * |
pText, |
|
|
const _u8 |
TextLen, |
|
|
const _u16 |
Port, |
|
|
const _u32 |
TTL, |
|
|
_u32 |
Options |
|
) |
| |
Register a new mDNS service.
- This function registers a new mDNS service to the mDNS package and the DB.
This registered service is a service offered by the application. The service name should be full service name according to RFC of the DNS-SD - meaning the value in name field in the SRV answer. Example for service name:
- PC1._ipp._tcp.local
- PC2_server._ftp._tcp.local
If the option is_unique is set, mDNS probes the service name to make sure it is unique before starting to announce the service on the network. Instance is the instance portion of the service name.
- Parameters
-
[in] | ServiceLen | The length of the service. |
[in] | TextLen | The length of the service should be smaller than 64. |
[in] | port | The port on this target host port. |
[in] | TTL | The TTL of the service |
[in] | Options | bitwise parameters:
- bit 0 - service is unique (means that the service needs to be unique)
- bit 31 - for internal use if the service should be added or deleted (set means ADD).
- bit 1-30 for future.
|
[in] | pServiceName | The service name. Example for service name:
- PC1._ipp._tcp.local
- PC2_server._ftp._tcp.local
|
[in] | pText | The description of the service. should be as mentioned in the RFC (according to type of the service IPP,FTP...) |
- Returns
- On success, zero is returned Possible error codes:
- Maximum advertise services are already configured. Delete another existed service that is registered and then register again the new service
- Trying to register a service that is already exists
- Trying to delete service that does not existed
- Illegal service name according to the RFC
- Retry request
- Illegal length of one of the mDNS Set functions
- mDNS is not operational as the device has no IP.Connect the device to an AP to get an IP address.
- mDNS parameters error
- mDNS internal cache error
- mDNS internal error
- Adding a service is not allowed as it is already exist (duplicate service)
- mDNS is not running
- Host name error. Host name format is not allowed according to RFC 1033,1034,1035, 6763
- List size buffer is bigger than internally allowed in the NWP (API get service list), change the APIs’ parameters to decrease the size of the list
- See also
- sl_NetAppMDNSUnRegisterService
- Warning
- 1) Temporary - there is an allocation on stack of internal buffer. Its size is NETAPP_MDNS_MAX_SERVICE_NAME_AND_TEXT_LENGTH.
It means that the sum of the text length and service name length cannot be bigger than NETAPP_MDNS_MAX_SERVICE_NAME_AND_TEXT_LENGTH.
If it is - An error is returned.
2) According to now from certain constraints the variables parameters are set in the attribute part (contain constant parameters)