Update snapshot(2018-01-24)
[platform/upstream/iotivity.git] / resource / src / InProcServerWrapper.cpp
1 //******************************************************************
2 //
3 // Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
4 //
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6 //
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 //
11 //      http://www.apache.org/licenses/LICENSE-2.0
12 //
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
18 //
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
20
21 #include <random>
22 #include <cstring>
23 #include <cstdlib>
24 #include <iostream>
25 #include <algorithm>
26 #include <map>
27 #include <sstream>
28 #include <string>
29
30 #include <InProcServerWrapper.h>
31 #include <InitializeException.h>
32 #include <OCResourceRequest.h>
33 #include <OCResourceResponse.h>
34 #include <ocstack.h>
35 #include <ocpayload.h>
36
37 #include <OCApi.h>
38 #include <oic_malloc.h>
39 #include <OCPlatform.h>
40 #include <OCUtilities.h>
41 #include "logger.h"
42
43 #define TAG "OIC_SERVER_WRAPPER"
44
45 using namespace std;
46 using namespace OC;
47
48 namespace OC
49 {
50     namespace details
51     {
52         std::mutex serverWrapperLock;
53         std::map <OCResourceHandle, OC::EntityHandler>  entityHandlerMap;
54         std::map <OCResourceHandle, std::string> resourceUriMap;
55         EntityHandler defaultDeviceEntityHandler;
56     }
57 }
58
59 void formResourceRequest(OCEntityHandlerFlag flag,
60                          OCEntityHandlerRequest * entityHandlerRequest,
61                          std::shared_ptr<OCResourceRequest> pRequest)
62 {
63     if(pRequest && entityHandlerRequest)
64     {
65         pRequest->setRequestHandle(entityHandlerRequest->requestHandle);
66         pRequest->setResourceHandle(entityHandlerRequest->resource);
67         pRequest->setMessageID(entityHandlerRequest->messageID);
68     }
69
70     if(flag & OC_REQUEST_FLAG)
71     {
72         pRequest->setRequestHandlerFlag(OC::RequestHandlerFlag::RequestFlag);
73
74         if(entityHandlerRequest)
75         {
76             if(entityHandlerRequest->query)
77             {
78                 OC::Utilities::QueryParamsKeyVal qp = OC::Utilities::getQueryParams(
79                         entityHandlerRequest->query);
80
81                 if(qp.size() > 0)
82                 {
83                     pRequest->setQueryParams(qp);
84                 }
85             }
86             if(entityHandlerRequest->numRcvdVendorSpecificHeaderOptions != 0)
87             {
88                 //Set the header options here.
89                 uint16_t optionID;
90                 char optionData[MAX_HEADER_OPTION_DATA_LENGTH + 1];
91                 HeaderOptions headerOptions;
92
93                 optionData[MAX_HEADER_OPTION_DATA_LENGTH] = '\0';
94                 for(int i = 0;
95                     i < entityHandlerRequest->numRcvdVendorSpecificHeaderOptions;
96                     i++)
97                 {
98                     optionID = entityHandlerRequest->rcvdVendorSpecificHeaderOptions[i].optionID;
99                     memcpy(optionData, entityHandlerRequest->rcvdVendorSpecificHeaderOptions[i].optionData,
100                         MAX_HEADER_OPTION_DATA_LENGTH);
101                     HeaderOption::OCHeaderOption headerOption(optionID, optionData);
102                     headerOptions.push_back(headerOption);
103                 }
104                 pRequest->setHeaderOptions(headerOptions);
105             }
106
107             if(OC_REST_GET == entityHandlerRequest->method)
108             {
109                 pRequest->setRequestType(OC::PlatformCommands::GET);
110             }
111             else if(OC_REST_PUT == entityHandlerRequest->method)
112             {
113                 pRequest->setRequestType(OC::PlatformCommands::PUT);
114                 pRequest->setPayload(entityHandlerRequest->payload);
115             }
116             else if(OC_REST_POST == entityHandlerRequest->method)
117             {
118                 pRequest->setRequestType(OC::PlatformCommands::POST);
119                 pRequest->setPayload(entityHandlerRequest->payload);
120             }
121             else if(OC_REST_DELETE == entityHandlerRequest->method)
122             {
123                 pRequest->setRequestType(OC::PlatformCommands::DELETE);
124             }
125         }
126     }
127
128     if(flag & OC_OBSERVE_FLAG)
129     {
130         pRequest->setRequestHandlerFlag(
131                    OC::RequestHandlerFlag::RequestFlag | OC::RequestHandlerFlag::ObserverFlag);
132
133         if(entityHandlerRequest)
134         {
135             OC::ObservationInfo observationInfo;
136             observationInfo.action = (OC::ObserveAction) entityHandlerRequest->obsInfo.action;
137             observationInfo.obsId = entityHandlerRequest->obsInfo.obsId;
138
139             observationInfo.connectivityType = static_cast<OCConnectivityType>(
140                     (entityHandlerRequest->devAddr.adapter << CT_ADAPTER_SHIFT) |
141                     (entityHandlerRequest->devAddr.flags & CT_MASK_FLAGS));
142             observationInfo.address = entityHandlerRequest->devAddr.addr;
143             observationInfo.port = entityHandlerRequest->devAddr.port;
144             pRequest->setObservationInfo(observationInfo);
145         }
146     }
147 }
148
149 OCEntityHandlerResult DefaultEntityHandlerWrapper(OCEntityHandlerFlag flag,
150                                                   OCEntityHandlerRequest * entityHandlerRequest,
151                                                   char* uri,
152                                                   void * /*callbackParam*/)
153 {
154     OCEntityHandlerResult result = OC_EH_ERROR;
155
156     OC::oclog() << "In Default device entity handler wrapper";
157
158     if(NULL == entityHandlerRequest)
159     {
160         oclog() << "Entity handler request is NULL.";
161         return OC_EH_ERROR;
162     }
163
164     auto pRequest = std::make_shared<OC::OCResourceRequest>();
165
166     formResourceRequest(flag, entityHandlerRequest, pRequest);
167
168     pRequest->setResourceUri(std::string(uri));
169
170     EntityHandler defHandler;
171     {
172         std::lock_guard<std::mutex> lock(OC::details::serverWrapperLock);
173         defHandler = OC::details::defaultDeviceEntityHandler;
174     }
175
176     if(defHandler)
177     {
178         result = defHandler(pRequest);
179     }
180     else
181     {
182         oclog() << "Default device entity handler was not set.";
183         return OC_EH_ERROR;
184     }
185
186     return result;
187 }
188
189
190 OCEntityHandlerResult EntityHandlerWrapper(OCEntityHandlerFlag flag,
191                                            OCEntityHandlerRequest * entityHandlerRequest,
192                                            void* /*callbackParam*/)
193 {
194     OCEntityHandlerResult result = OC_EH_ERROR;
195
196     oclog() << "\nIn entity handler wrapper: " << endl;
197
198     if(NULL == entityHandlerRequest)
199     {
200         oclog() << "Entity handler request is NULL."  << endl;
201         return OC_EH_ERROR;
202     }
203
204     auto pRequest = std::make_shared<OC::OCResourceRequest>();
205
206     formResourceRequest(flag, entityHandlerRequest, pRequest);
207
208     std::map <OCResourceHandle, std::string>::iterator resourceUriEntry;
209     std::map <OCResourceHandle, std::string>::iterator resourceUriEnd;
210     {
211         std::lock_guard<std::mutex> lock(OC::details::serverWrapperLock);
212         resourceUriEntry = OC::details::resourceUriMap.find(entityHandlerRequest->resource);
213         resourceUriEnd = OC::details::resourceUriMap.end();
214     }
215     // Finding the corresponding URI for a resource handle and set the URI in the request
216     if(resourceUriEntry != resourceUriEnd)
217     {
218         pRequest->setResourceUri(resourceUriEntry->second);
219     }
220     else
221     {
222         oclog() << "Resource handle not found; Resource URI not set in request";
223         return OC_EH_ERROR;
224     }
225
226     std::map <OCResourceHandle, OC::EntityHandler>::iterator entityHandlerEntry;
227     std::map <OCResourceHandle, OC::EntityHandler>::iterator entityHandlerEnd;
228     {
229         // Finding the corresponding CPP Application entityHandler for a given resource
230         std::lock_guard<std::mutex> lock(OC::details::serverWrapperLock);
231         entityHandlerEntry = OC::details::entityHandlerMap.find(entityHandlerRequest->resource);
232         entityHandlerEnd = OC::details::entityHandlerMap.end();
233     }
234
235     if(entityHandlerEntry != entityHandlerEnd)
236     {
237         // Call CPP Application Entity Handler
238         if(entityHandlerEntry->second)
239         {
240             result = entityHandlerEntry->second(pRequest);
241         }
242         else
243         {
244             oclog() << "C stack should not call again for parent resource\n";
245             return OC_EH_ERROR;
246         }
247     }
248     else
249     {
250         oclog() << "No entity handler found."  << endl;
251         return OC_EH_ERROR;
252     }
253
254     return result;
255 }
256
257 namespace OC
258 {
259     InProcServerWrapper::InProcServerWrapper(
260         std::weak_ptr<std::recursive_mutex> csdkLock, PlatformConfig cfg)
261      : m_threadRun(false),
262        m_csdkLock(csdkLock),
263        m_cfg { cfg }       
264     {
265         start();
266     }
267
268     OCStackResult InProcServerWrapper::start()
269     {
270         OIC_LOG_V(INFO, TAG, "start ocplatform for server : %d", m_cfg.transportType);
271
272         OCMode initType;
273         if(m_cfg.mode == ModeType::Server)
274         {
275             initType = OC_SERVER;
276         }
277         else if (m_cfg.mode == ModeType::Both)
278         {
279             initType = OC_CLIENT_SERVER;
280         }
281         else if (m_cfg.mode == ModeType::Gateway)
282         {
283             initType = OC_GATEWAY;
284         }
285         else
286         {
287             throw InitializeException(OC::InitException::NOT_CONFIGURED_AS_SERVER,
288                                          OC_STACK_INVALID_PARAM);
289         }
290
291         OCTransportFlags serverFlags =
292                             static_cast<OCTransportFlags>(m_cfg.serverConnectivity & CT_MASK_FLAGS);
293         OCTransportFlags clientFlags =
294                             static_cast<OCTransportFlags>(m_cfg.clientConnectivity & CT_MASK_FLAGS);
295         OCStackResult result = OCInit2(initType, serverFlags, clientFlags,
296                                        m_cfg.transportType);
297
298         if(OC_STACK_OK != result)
299         {
300             throw InitializeException(OC::InitException::STACK_INIT_ERROR, result);
301         }
302
303         if (false == m_threadRun)
304         {
305             m_threadRun = true;
306             m_processThread = std::thread(&InProcServerWrapper::processFunc, this);
307         }
308         return OC_STACK_OK;
309     }
310
311     OCStackResult InProcServerWrapper::stop()
312     {
313         OIC_LOG(INFO, TAG, "stop");
314
315         if(m_processThread.joinable())
316         {
317             m_threadRun = false;
318             m_processThread.join();
319         }
320
321         OCStackResult res = OCStop();
322
323         if (OC_STACK_OK != res)
324         {
325            throw InitializeException(OC::InitException::STACK_TERMINATE_ERROR, res);
326         }
327
328         return OC_STACK_OK;
329     }
330
331     void InProcServerWrapper::processFunc()
332     {
333         auto cLock = m_csdkLock.lock();
334         while(cLock && m_threadRun)
335         {
336             OCStackResult result;
337
338             {
339                 std::lock_guard<std::recursive_mutex> lock(*cLock);
340                 result = OCProcess();
341             }
342
343             if(OC_STACK_ERROR == result)
344             {
345                 oclog() << "OCProcess failed with result " << result <<std::flush;
346                 // ...the value of variable result is simply ignored for now.
347             }
348
349             std::this_thread::sleep_for(std::chrono::milliseconds(10));
350         }
351     }
352
353     OCStackResult InProcServerWrapper::registerDeviceInfo(const OCDeviceInfo deviceInfo)
354     {
355         auto cLock = m_csdkLock.lock();
356         OCStackResult result = OC_STACK_ERROR;
357         if(cLock)
358         {
359             std::lock_guard<std::recursive_mutex> lock(*cLock);
360             result = OCSetDeviceInfo(deviceInfo);
361         }
362         return result;
363     }
364
365     OCStackResult InProcServerWrapper::registerPlatformInfo(const OCPlatformInfo platformInfo)
366     {
367         auto cLock = m_csdkLock.lock();
368         OCStackResult result = OC_STACK_ERROR;
369         if(cLock)
370         {
371             std::lock_guard<std::recursive_mutex> lock(*cLock);
372             result = OCSetPlatformInfo(platformInfo);
373         }
374         return result;
375     }
376
377     OCStackResult InProcServerWrapper::setPropertyValue(OCPayloadType type, const std::string& propName,
378         const std::string& propValue)
379     {
380         auto cLock = m_csdkLock.lock();
381         OCStackResult result = OC_STACK_ERROR;
382         if (cLock)
383         {
384             std::lock_guard<std::recursive_mutex> lock(*cLock);
385             result = OCSetPropertyValue(type, propName.c_str(), (void *)propValue.c_str());
386         }
387         return result;
388     }
389
390     OCStackResult InProcServerWrapper::getPropertyValue(OCPayloadType type, const std::string& propName,
391         std::string& propValue)
392     {
393         auto cLock = m_csdkLock.lock();
394         OCStackResult result = OC_STACK_ERROR;
395         if (cLock)
396         {
397             std::lock_guard<std::recursive_mutex> lock(*cLock);
398             result = OCGetPropertyValue(type, propName.c_str(), (void **)propValue.c_str());
399         }
400         return result;
401     }
402
403     OCStackResult InProcServerWrapper::registerResource(
404                     OCResourceHandle& resourceHandle,
405                     std::string& resourceURI,
406                     const std::string& resourceTypeName,
407                     const std::string& resourceInterface,
408                     EntityHandler& eHandler,
409                     uint8_t resourceProperties)
410
411     {
412         OCStackResult result = OC_STACK_ERROR;
413
414         auto cLock = m_csdkLock.lock();
415
416         if(cLock)
417         {
418             std::lock_guard<std::recursive_mutex> lock(*cLock);
419
420             if(NULL != eHandler)
421             {
422                 result = OCCreateResource(&resourceHandle, // OCResourceHandle *handle
423                             resourceTypeName.c_str(), // const char * resourceTypeName
424                             resourceInterface.c_str(), //const char * resourceInterfaceName //TODO fix this
425                             resourceURI.c_str(), // const char * uri
426                             EntityHandlerWrapper, // OCEntityHandler entityHandler
427                             NULL,
428                             resourceProperties // uint8_t resourceProperties
429                             );
430             }
431             else
432             {
433                 result = OCCreateResource(&resourceHandle, // OCResourceHandle *handle
434                             resourceTypeName.c_str(), // const char * resourceTypeName
435                             resourceInterface.c_str(), //const char * resourceInterfaceName //TODO fix this
436                             resourceURI.c_str(), // const char * uri
437                             NULL, // OCEntityHandler entityHandler
438                             NULL,
439                             resourceProperties // uint8_t resourceProperties
440                             );
441             }
442
443             if(result != OC_STACK_OK)
444             {
445                 resourceHandle = (OCResourceHandle) 0;
446             }
447             else
448             {
449                 std::lock_guard<std::mutex> lock(OC::details::serverWrapperLock);
450                 OC::details::entityHandlerMap[resourceHandle] = eHandler;
451                 OC::details::resourceUriMap[resourceHandle] = resourceURI;
452             }
453         }
454         else
455         {
456             result = OC_STACK_ERROR;
457         }
458
459         return result;
460     }
461
462
463
464     OCStackResult InProcServerWrapper::setDefaultDeviceEntityHandler
465                                         (EntityHandler entityHandler)
466     {
467         OCStackResult result = OC_STACK_ERROR;
468
469         {
470             std::lock_guard<std::mutex> lock(OC::details::serverWrapperLock);
471             OC::details::defaultDeviceEntityHandler = entityHandler;
472         }
473
474         if(entityHandler)
475         {
476             result = OCSetDefaultDeviceEntityHandler(DefaultEntityHandlerWrapper, NULL);
477         }
478         else
479         {
480             // If Null passed we unset
481             result = OCSetDefaultDeviceEntityHandler(NULL, NULL);
482         }
483
484         return result;
485     }
486
487     OCStackResult InProcServerWrapper::unregisterResource(const OCResourceHandle& resourceHandle)
488     {
489         auto cLock = m_csdkLock.lock();
490         OCStackResult result = OC_STACK_ERROR;
491
492         if(cLock)
493         {
494             std::lock_guard<std::recursive_mutex> lock(*cLock);
495             result = OCDeleteResource(resourceHandle);
496
497             if(result == OC_STACK_OK)
498             {
499                 std::lock_guard<std::mutex> lock(OC::details::serverWrapperLock);
500                 OC::details::resourceUriMap.erase(resourceHandle);
501             }
502             else
503             {
504                 throw OCException(OC::Exception::RESOURCE_UNREG_FAILED, result);
505             }
506         }
507         else
508         {
509             result = OC_STACK_ERROR;
510         }
511
512         return result;
513     }
514
515     OCStackResult InProcServerWrapper::bindTypeToResource(const OCResourceHandle& resourceHandle,
516                      const std::string& resourceTypeName)
517     {
518         auto cLock = m_csdkLock.lock();
519         OCStackResult result;
520         if(cLock)
521         {
522             std::lock_guard<std::recursive_mutex> lock(*cLock);
523             result = OCBindResourceTypeToResource(resourceHandle, resourceTypeName.c_str());
524         }
525         else
526         {
527             result = OC_STACK_ERROR;
528         }
529
530         if (result != OC_STACK_OK)
531         {
532             throw OCException(OC::Exception::BIND_TYPE_FAILED, result);
533         }
534         return result;
535     }
536
537     OCStackResult InProcServerWrapper::bindInterfaceToResource(
538                      const OCResourceHandle& resourceHandle,
539                      const std::string& resourceInterfaceName)
540     {
541         auto cLock = m_csdkLock.lock();
542         OCStackResult result;
543         if(cLock)
544         {
545             std::lock_guard<std::recursive_mutex> lock(*cLock);
546             result = OCBindResourceInterfaceToResource(resourceHandle,
547                         resourceInterfaceName.c_str());
548         }
549         else
550         {
551             result = OC_STACK_ERROR;
552         }
553
554         if (result != OC_STACK_OK)
555         {
556             throw OCException(OC::Exception::BIND_INTERFACE_FAILED, result);
557         }
558         return result;
559     }
560
561     OCStackResult InProcServerWrapper::startPresence(const unsigned int seconds)
562     {
563         auto cLock = m_csdkLock.lock();
564         OCStackResult result = OC_STACK_ERROR;
565         if(cLock)
566         {
567             std::lock_guard<std::recursive_mutex> lock(*cLock);
568             result = OCStartPresence(seconds);
569         }
570
571         if(result != OC_STACK_OK)
572         {
573             throw OCException(OC::Exception::START_PRESENCE_FAILED, result);
574         }
575         return result;
576     }
577
578     OCStackResult InProcServerWrapper::stopPresence()
579     {
580         auto cLock = m_csdkLock.lock();
581         OCStackResult result = OC_STACK_ERROR;
582         if(cLock)
583         {
584             std::lock_guard<std::recursive_mutex> lock(*cLock);
585             result = OCStopPresence();
586         }
587
588         if(result != OC_STACK_OK)
589         {
590             throw OCException(OC::Exception::END_PRESENCE_FAILED, result);
591         }
592         return result;
593     }
594
595     OCStackResult InProcServerWrapper::sendResponse(
596         const std::shared_ptr<OCResourceResponse> pResponse)
597     {
598         auto cLock = m_csdkLock.lock();
599         OCStackResult result = OC_STACK_ERROR;
600
601         if(!pResponse)
602         {
603             result = OC_STACK_MALFORMED_RESPONSE;
604             throw OCException(OC::Exception::STR_NULL_RESPONSE, OC_STACK_MALFORMED_RESPONSE);
605         }
606         else
607         {
608             OCEntityHandlerResponse response;
609 //            OCRepPayload* payLoad = pResponse->getPayload();
610             HeaderOptions serverHeaderOptions = pResponse->getHeaderOptions();
611
612             response.requestHandle = pResponse->getRequestHandle();
613             response.resourceHandle = pResponse->getResourceHandle();
614             response.ehResult = pResponse->getResponseResult();
615
616             response.payload = reinterpret_cast<OCPayload*>(pResponse->getPayload());
617
618             response.persistentBufferFlag = 0;
619
620             response.numSendVendorSpecificHeaderOptions = serverHeaderOptions.size();
621             int i = 0;
622             for (auto it=serverHeaderOptions.begin(); it != serverHeaderOptions.end(); ++it)
623             {
624                 response.sendVendorSpecificHeaderOptions[i].protocolID = OC_COAP_ID;
625                 response.sendVendorSpecificHeaderOptions[i].optionID =
626                     static_cast<uint16_t>(it->getOptionID());
627                 response.sendVendorSpecificHeaderOptions[i].optionLength =
628                     (it->getOptionData()).length() + 1;
629                 std::string optionData = it->getOptionData();
630                 std::copy(optionData.begin(),
631                          optionData.end(),
632                          response.sendVendorSpecificHeaderOptions[i].optionData);
633                 response.sendVendorSpecificHeaderOptions[i].optionData[it->getOptionData().length()]
634                     = '\0';
635                 i++;
636             }
637
638             if(OC_EH_RESOURCE_CREATED == response.ehResult)
639             {
640                 pResponse->getNewResourceUri().copy(response.resourceUri,
641                         sizeof (response.resourceUri) - 1);
642                 response.resourceUri[pResponse->getNewResourceUri().length()] = '\0';
643             }
644
645             if(cLock)
646             {
647                 std::lock_guard<std::recursive_mutex> lock(*cLock);
648                 result = OCDoResponse(&response);
649             }
650             else
651             {
652                 result = OC_STACK_ERROR;
653             }
654
655             if(result != OC_STACK_OK)
656             {
657                 oclog() << "Error sending response\n";
658             }
659
660             OCPayloadDestroy(response.payload);
661             return result;
662         }
663     }
664
665     OCStackResult InProcServerWrapper::notifyAllObservers(OCResourceHandle resourceHandle,
666                                                           QualityOfService QoS)
667     {
668         auto cLock = m_csdkLock.lock();
669         OCStackResult result = OC_STACK_ERROR;
670         if (cLock)
671         {
672             std::lock_guard<std::recursive_mutex> lock(*cLock);
673             result = OCNotifyAllObservers(resourceHandle, static_cast<OCQualityOfService>(QoS));
674         }
675
676         return result;
677     }
678
679     OCStackResult InProcServerWrapper::notifyListOfObservers(OCResourceHandle resourceHandle,
680                                                ObservationIds& observationIds,
681                                                const std::shared_ptr<OCResourceResponse> pResponse,
682                                                QualityOfService QoS)
683     {
684         if (!pResponse)
685         {
686             return OC_STACK_ERROR;
687         }
688
689         auto cLock = m_csdkLock.lock();
690         OCStackResult result = OC_STACK_ERROR;
691         if (cLock)
692         {
693             std::lock_guard<std::recursive_mutex> lock(*cLock);
694
695             OCRepPayload* pl = pResponse->getResourceRepresentation().getPayload();
696             result = OCNotifyListOfObservers(resourceHandle,
697                                              &observationIds[0],
698                                              observationIds.size(),
699                                              pl,
700                                              static_cast<OCQualityOfService>(QoS));
701             OCRepPayloadDestroy(pl);
702         }
703
704         if (result != OC_STACK_OK)
705         {
706             throw OCException(OC::Exception::NOTIFY_LIST_OBSERVERS_FAILED, result);
707         }
708         return result;
709     }
710
711     InProcServerWrapper::~InProcServerWrapper()
712     {
713         try
714         {
715             stop();
716         }
717         catch (InitializeException &e)
718         {
719             oclog() << "Exception in stop"<< e.what() << std::flush;
720         }
721     }
722 }