كوب
تشمل هذه الوحدة وظائف تتحكم في اتصال CoAP.
الملخّص
الوظائف المتوفّرة في هذه الوحدة متاحة عند تفعيل ميزة واجهة برمجة تطبيقات CoAP (OPENTHREAD_CONFIG_COAP_API_ENABLE
).
مواقد الخط |
|
---|---|
otCoapBlockSzx
|
مَعلمة typetypeenum otCoapBlockSzx
أس عدد قوالب COAP. |
otCoapBlockwiseReceiveHook)(void *aContext, const uint8_t *aBlock, uint32_t aPosition, uint16_t aBlockLength, bool aMore, uint32_t aTotalLength)
|
مَعلمة typetypeotError(*
يتم استدعاء مؤشر الدالة هذا عند تلقّي رسالة CoAP مع خيار النقل المعتمد من ناحية الحظر. |
otCoapBlockwiseResource
|
مَعلمة typetypestruct otCoapBlockwiseResource
تمثل هذه البنية مورد CoAP مع النقل باتّجاه الحظر. |
otCoapBlockwiseTransmitHook)(void *aContext, uint8_t *aBlock, uint32_t aPosition, uint16_t *aBlockLength, bool *aMore)
|
مَعلمة typetypeotError(*
يتم استدعاء مؤشر الدالة هذا قبل إرسال الحظر التالي في عملية حظر الملكية. |
otCoapCode
|
مَعلمة typetypeenum otCoapCode
قيم رمز CAP. |
otCoapOption
|
مَعلمة typetypestruct otCoapOption
تمثل هذه البنية خيار CoAP. |
otCoapOptionContentFormat
|
مَعلمة typetype رموز تنسيق محتوى CoAP |
otCoapOptionIterator
|
مَعلمة typetypestruct otCoapOptionIterator
تعمل هذه البنية كمكرر لخيارات CoAP. |
otCoapOptionType
|
مَعلمة typetypeenum otCoapOptionType
أرقام خيارات CoAP. |
otCoapRequestHandler)(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo)
|
مَعلمة typetypevoid(*
يتم استدعاء مؤشر الدالة هذا عند تلقّي طلب CoAP باستخدام مسار Uri محدد. |
otCoapResource
|
مَعلمة typetypestruct otCoapResource
تمثل هذه البنية مورد CoAP. |
otCoapResponseHandler)(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo, otError aResult)
|
مَعلمة typetypevoid(*
يتم استدعاء مؤشر الدالة هذا عند تلقّي استجابة CoAP أو عند انتهاء مهلة الطلب. |
otCoapTxParameters
|
مَعلمة typetypestruct otCoapTxParameters
تمثل هذه البنية معلمات إرسال CoAP. |
otCoapType
|
مَعلمة typetypeenum otCoapType
قيم نوع CoAP (عدد صحيح غير موقَّع 2 بت). |
الدوال |
|
---|---|
otCoapAddBlockWiseResource(otInstance *aInstance, otCoapBlockwiseResource *aResource)
|
void
تضيف هذه الدالة مورد حظر الحظر إلى خادم CoAP.
|
otCoapAddResource(otInstance *aInstance, otCoapResource *aResource)
|
void
تضيف هذه الدالة موردًا إلى خادم CoAP.
|
otCoapBlockSizeFromExponent(otCoapBlockSzx aSize)
|
uint16_t
تحوِّل هذه الدالة حقل خيار حظر SZX إلى حجم الكتلة الفعلي.
|
otCoapMessageAppendBlock1Option(otMessage *aMessage, uint32_t aNum, bool aMore, otCoapBlockSzx aSize)
|
تضيف هذه الدالة الخيار Block1.
|
otCoapMessageAppendBlock2Option(otMessage *aMessage, uint32_t aNum, bool aMore, otCoapBlockSzx aSize)
|
تضيف هذه الدالة الخيار Block2.
|
otCoapMessageAppendContentFormatOption(otMessage *aMessage, otCoapOptionContentFormat aContentFormat)
|
تُلحِق هذه الدالة خيار CoAP بتنسيق المحتوى كما هو محدَّد في https://tools.ietf.org/html/rfc7252#page-92.
|
otCoapMessageAppendMaxAgeOption(otMessage *aMessage, uint32_t aMaxAge)
|
تضيف هذه الدالة خيار Max-Age.
|
otCoapMessageAppendObserveOption(otMessage *aMessage, uint32_t aObserve)
|
تضيف هذه الدالة خيار "الملاحظة".
|
otCoapMessageAppendOption(otMessage *aMessage, uint16_t aNumber, uint16_t aLength, const void *aValue)
|
تضيف هذه الدالة خيار CoAP في الرأس.
|
otCoapMessageAppendProxyUriOption(otMessage *aMessage, const char *aUriPath)
|
تضيف هذه الدالة خيارَ Proxy-Uri.
|
otCoapMessageAppendUintOption(otMessage *aMessage, uint16_t aNumber, uint32_t aValue)
|
تضيف هذه الدالة خيار CoAP لعدد صحيح غير موقَّع كما هو مُحدَّد في https://tools.ietf.org/html/rfc7252#section-3.2.
|
otCoapMessageAppendUriPathOptions(otMessage *aMessage, const char *aUriPath)
|
تضيف هذه الدالة خيار Uri-Path.
|
otCoapMessageAppendUriQueryOption(otMessage *aMessage, const char *aUriQuery)
|
تضيف هذه الدالة خيار معرّف موارد منتظم (URI) واحد.
|
otCoapMessageCodeToString(const otMessage *aMessage)
|
const char *
تعرض هذه الطريقة رمز CoAP على هيئة سلسلة يمكن للمستخدمين قراءتها.
|
otCoapMessageGenerateToken(otMessage *aMessage, uint8_t aTokenLength)
|
void
تحدد هذه الدالة طول الرمز المميز وتوزّع قيمته بشكل عشوائي.
|
otCoapMessageGetCode(const otMessage *aMessage)
|
تعرض هذه الدالة قيمة الرمز.
|
otCoapMessageGetMessageId(const otMessage *aMessage)
|
uint16_t
تعرض هذه الدالة قيمة "معرِّف الرسالة".
|
otCoapMessageGetToken(const otMessage *aMessage)
|
const uint8_t *
تعرض هذه الدالة مؤشرًا إلى قيمة الرمز المميَّز.
|
otCoapMessageGetTokenLength(const otMessage *aMessage)
|
uint8_t
تعرض هذه الدالة طول الرمز المميز.
|
otCoapMessageGetType(const otMessage *aMessage)
|
تعرض هذه الدالة قيمة "النوع".
|
otCoapMessageInit(otMessage *aMessage, otCoapType aType, otCoapCode aCode)
|
void
تعمل هذه الدالة على إعداد عنوان CoAP.
|
otCoapMessageInitResponse(otMessage *aResponse, const otMessage *aRequest, otCoapType aType, otCoapCode aCode)
|
تعمل هذه الدالة على إعداد رسالة رد.
|
otCoapMessageSetCode(otMessage *aMessage, otCoapCode aCode)
|
void
تحدّد هذه الدالة قيمة الرمز.
|
otCoapMessageSetPayloadMarker(otMessage *aMessage)
|
تضيف هذه الدالة علامة الحمولة التي تشير إلى بداية الحمولة إلى عنوان CoAP.
|
otCoapMessageSetToken(otMessage *aMessage, const uint8_t *aToken, uint8_t aTokenLength)
|
تحدد هذه الدالة قيمة الرمز المميز وطوله في العنوان.
|
otCoapNewMessage(otInstance *aInstance, const otMessageSettings *aSettings)
|
تنشئ هذه الدالة رسالة CoAP جديدة.
|
otCoapOptionIteratorGetFirstOption(otCoapOptionIterator *aIterator)
|
const otCoapOption *
تعرض هذه الدالة مؤشرًا إلى الخيار الأول.
|
otCoapOptionIteratorGetFirstOptionMatching(otCoapOptionIterator *aIterator, uint16_t aOption)
|
const otCoapOption *
تعرض هذه الدالة مؤشرًا للخيار الأول الذي يطابق رقم الخيار المحدّد.
|
otCoapOptionIteratorGetNextOption(otCoapOptionIterator *aIterator)
|
const otCoapOption *
تعرض هذه الدالة مؤشرًا للخيار التالي.
|
otCoapOptionIteratorGetNextOptionMatching(otCoapOptionIterator *aIterator, uint16_t aOption)
|
const otCoapOption *
تعرض هذه الدالة مؤشرًا للخيار التالي يطابق رقم الخيار المحدّد.
|
otCoapOptionIteratorGetOptionUintValue(otCoapOptionIterator *aIterator, uint64_t *aValue)
|
تملأ هذه الدالة قيمة الخيار الحالية في
aValue على افتراض أن القيمة الحالية هي عدد صحيح غير موقَّع مرمّز وفقًا لـ https://tools.ietf.org/html/rfc7252#section-3.2. |
otCoapOptionIteratorGetOptionValue(otCoapOptionIterator *aIterator, void *aValue)
|
تملأ هذه الدالة قيمة الخيار الحالية في
aValue . |
otCoapOptionIteratorInit(otCoapOptionIterator *aIterator, const otMessage *aMessage)
|
تعمل هذه الدالة على إعداد تكرار للخيارات في الرسالة المحدّدة.
|
otCoapRemoveBlockWiseResource(otInstance *aInstance, otCoapBlockwiseResource *aResource)
|
void
تزيل هذه الدالة مورد حظر الحظر من خادم CoAP.
|
otCoapRemoveResource(otInstance *aInstance, otCoapResource *aResource)
|
void
تزيل هذه الدالة موردًا من خادم CoAP.
|
otCoapSendRequest(otInstance *aInstance, otMessage *aMessage, const otMessageInfo *aMessageInfo, otCoapResponseHandler aHandler, void *aContext)
|
ترسل هذه الدالة طلب CoAP.
|
otCoapSendRequestBlockWise(otInstance *aInstance, otMessage *aMessage, const otMessageInfo *aMessageInfo, otCoapResponseHandler aHandler, void *aContext, otCoapBlockwiseTransmitHook aTransmitHook, otCoapBlockwiseReceiveHook aReceiveHook)
|
ترسل هذه الدالة طلب CoAP على مستوى الحظر.
|
otCoapSendRequestBlockWiseWithParameters(otInstance *aInstance, otMessage *aMessage, const otMessageInfo *aMessageInfo, otCoapResponseHandler aHandler, void *aContext, const otCoapTxParameters *aTxParameters, otCoapBlockwiseTransmitHook aTransmitHook, otCoapBlockwiseReceiveHook aReceiveHook)
|
ترسل هذه الدالة طلب CoAP على مستوى الحظر باستخدام معلّمات نقل مخصّصة.
|
otCoapSendRequestWithParameters(otInstance *aInstance, otMessage *aMessage, const otMessageInfo *aMessageInfo, otCoapResponseHandler aHandler, void *aContext, const otCoapTxParameters *aTxParameters)
|
ترسل هذه الدالة طلب CoAP مع معلّمات النقل المخصّصة.
|
otCoapSendResponse(otInstance *aInstance, otMessage *aMessage, const otMessageInfo *aMessageInfo)
|
ترسل هذه الدالة استجابة CoAP من الخادم.
|
otCoapSendResponseBlockWise(otInstance *aInstance, otMessage *aMessage, const otMessageInfo *aMessageInfo, void *aContext, otCoapBlockwiseTransmitHook aTransmitHook)
|
ترسل هذه الدالة استجابة CoAP على مستوى الحظر من الخادم.
|
otCoapSendResponseBlockWiseWithParameters(otInstance *aInstance, otMessage *aMessage, const otMessageInfo *aMessageInfo, const otCoapTxParameters *aTxParameters, void *aContext, otCoapBlockwiseTransmitHook aTransmitHook)
|
ترسل هذه الدالة حظر CoAP على مستوى الحظر من الخادم باستخدام مُعلّمات الإرسال المخصّصة.
|
otCoapSendResponseWithParameters(otInstance *aInstance, otMessage *aMessage, const otMessageInfo *aMessageInfo, const otCoapTxParameters *aTxParameters)
|
ترسل هذه الدالة استجابة CoAP من الخادم تتضمن معلمات إرسال مخصصة.
|
otCoapSetDefaultHandler(otInstance *aInstance, otCoapRequestHandler aHandler, void *aContext)
|
void
تحدد هذه الدالة المعالج التلقائي لطلبات CoAP التي لم تتم معالجتها.
|
otCoapStart(otInstance *aInstance, uint16_t aPort)
|
تبدأ هذه الدالة خادم CoAP.
|
otCoapStop(otInstance *aInstance)
|
توقف هذه الدالة خادم CoAP.
|
التشريعات |
|
---|---|
otCoapBlockwiseResource |
تمثل هذه البنية مورد CoAP مع النقل باتّجاه الحظر. |
otCoapOption |
تمثل هذه البنية خيار CoAP. |
otCoapOptionIterator |
تعمل هذه البنية كمكرر لخيارات CoAP. |
otCoapResource |
تمثل هذه البنية مورد CoAP. |
otCoapTxParameters |
تمثل هذه البنية معلمات إرسال CoAP. |
التعدادات
otCoapBlockSzx
otCoapBlockSzx
أس عدد قوالب COAP.
رمز otCoapCode
otCoapCode
قيم رمز CAP.
otCoapOptionContentFormat
otCoapOptionContentFormat
رموز تنسيق محتوى CoAP
القائمة الكاملة موثَّقة على https://www.iana.org/assignments/core-parameters/core-parameters.xhtml#content-formats.
المنشآت الفندقية | |
---|---|
OT_COAP_OPTION_CONTENT_FORMAT_CBOR
|
application/cbor: [RFC7049] |
OT_COAP_OPTION_CONTENT_FORMAT_COAP_GROUP_JSON
|
application/coap-group+json: [RFC7390] |
OT_COAP_OPTION_CONTENT_FORMAT_COSE_ENCRYPT
|
تطبيق/cose؛ cose-type="cose-encrypt": [RFC8152] |
OT_COAP_OPTION_CONTENT_FORMAT_COSE_ENCRYPT0
|
تطبيق/cose؛ cose-type="cose-encrypt0": [RFC8152] |
OT_COAP_OPTION_CONTENT_FORMAT_COSE_KEY
|
application/cose-key: [RFC8152] |
OT_COAP_OPTION_CONTENT_FORMAT_COSE_KEY_SET
|
application/cose-key-set: [RFC8152] |
OT_COAP_OPTION_CONTENT_FORMAT_COSE_MAC
|
تطبيق/cose؛ cose-type="cose-mac": [RFC8152] |
OT_COAP_OPTION_CONTENT_FORMAT_COSE_MAC0
|
تطبيق/cose؛ cose-type="cose-mac0": [RFC8152] |
OT_COAP_OPTION_CONTENT_FORMAT_COSE_SIGN
|
تطبيق/cose؛ cose-type="cose-sign": [RFC8152] |
OT_COAP_OPTION_CONTENT_FORMAT_COSE_SIGN1
|
تطبيق/cose؛ cose-type="cose-sign1": [RFC8152] |
OT_COAP_OPTION_CONTENT_FORMAT_CWT
|
app/cwt: [RFC8392] |
OT_COAP_OPTION_CONTENT_FORMAT_EXI
|
application/exi: ["كفاءة تنسيق XML (EXI) تنسيق 1.0 (الإصدار الثاني)"، شباط (فبراير) 2014] |
OT_COAP_OPTION_CONTENT_FORMAT_JSON
|
application/json: [RFC7159] |
OT_COAP_OPTION_CONTENT_FORMAT_JSON_PATCH_JSON
|
application/json-patch+json: [RFC6902] |
OT_COAP_OPTION_CONTENT_FORMAT_LINK_FORMAT
|
application/link-format: [RFC6690] |
OT_COAP_OPTION_CONTENT_FORMAT_MERGE_PATCH_JSON
|
application/merge-patch+json: [RFC7396] |
OT_COAP_OPTION_CONTENT_FORMAT_OCTET_STREAM
|
application/octet-stream: [RFC2045][RFC2046] |
OT_COAP_OPTION_CONTENT_FORMAT_SENML_CBOR
|
application/senml+cbor: [RFC8428] |
OT_COAP_OPTION_CONTENT_FORMAT_SENML_EXI
|
application/senml-exi: [RFC8428] |
OT_COAP_OPTION_CONTENT_FORMAT_SENML_JSON
|
application/senml+json: [RFC8428] |
OT_COAP_OPTION_CONTENT_FORMAT_SENML_XML
|
application/senml+xml: [RFC8428] |
OT_COAP_OPTION_CONTENT_FORMAT_SENSML_CBOR
|
application/sensml+cbor: [RFC8428] |
OT_COAP_OPTION_CONTENT_FORMAT_SENSML_EXI
|
application/sensml-exi: [RFC8428] |
OT_COAP_OPTION_CONTENT_FORMAT_SENSML_JSON
|
application/sensml+json: [RFC8428] |
OT_COAP_OPTION_CONTENT_FORMAT_SENSML_XML
|
application/sensml+xml: [RFC8428] |
OT_COAP_OPTION_CONTENT_FORMAT_TEXT_PLAIN
|
نص/نص عادي charset=utf-8: [RFC2046][RFC3676][RFC5147] |
OT_COAP_OPTION_CONTENT_FORMAT_XML
|
application/xml: [RFC3023] |
otCoapOptionType
otCoapOptionType
أرقام خيارات CoAP.
المنشآت الفندقية | |
---|---|
OT_COAP_OPTION_ACCEPT
|
قبول. |
OT_COAP_OPTION_BLOCK1
|
Block1 (RFC7959) |
OT_COAP_OPTION_BLOCK2
|
Block2 (RFC7959) |
OT_COAP_OPTION_CONTENT_FORMAT
|
تنسيق المحتوى. |
OT_COAP_OPTION_E_TAG
|
ETag. |
OT_COAP_OPTION_IF_MATCH
|
إذا كانت مطابقة. |
OT_COAP_OPTION_IF_NONE_MATCH
|
إذا لم يكن هناك أي محتوى مطابق. |
OT_COAP_OPTION_LOCATION_PATH
|
مسار الموقع الجغرافي. |
OT_COAP_OPTION_LOCATION_QUERY
|
طلب البحث عن الموقع الجغرافي |
OT_COAP_OPTION_MAX_AGE
|
الحد الأقصى لعمر المستخدم. |
OT_COAP_OPTION_OBSERVE
|
ملاحظة [RFC7641]. |
OT_COAP_OPTION_PROXY_SCHEME
|
مخطط الخادم الوكيل. |
OT_COAP_OPTION_PROXY_URI
|
الخادم الوكيل-Uri |
OT_COAP_OPTION_SIZE1
|
الحجم1. |
OT_COAP_OPTION_SIZE2
|
size2 (RFC7959) |
OT_COAP_OPTION_URI_HOST
|
معرّف الموارد المنتظم (URI) المضيف |
OT_COAP_OPTION_URI_PATH
|
معرّف موارد منتظم (URI) |
OT_COAP_OPTION_URI_PORT
|
معرّف الموارد المنتظم (URI) - المنفذ |
OT_COAP_OPTION_URI_QUERY
|
مُعرّف الموارد المنتظم (URI)- الطلب |
otCoapType
otCoapType
قيم نوع CoAP (عدد صحيح غير موقَّع 2 بت).
المنشآت الفندقية | |
---|---|
OT_COAP_TYPE_ACKNOWLEDGMENT
|
إقرار |
OT_COAP_TYPE_CONFIRMABLE
|
قابل للتأكيد. |
OT_COAP_TYPE_NON_CONFIRMABLE
|
غير قابل للتأكيد. |
OT_COAP_TYPE_RESET
|
إعادة تعيين. |
مواقد الخط
otCoapBlockwiseReceiveHok
otError(* otCoapBlockwiseReceiveHook)(void *aContext, const uint8_t *aBlock, uint32_t aPosition, uint16_t aBlockLength, bool aMore, uint32_t aTotalLength)
يتم استدعاء مؤشر الدالة هذا عند تلقّي رسالة CoAP مع خيار النقل المعتمد من ناحية الحظر.
تتوفر هذه الدالة عند تفعيل ضبط OpenGLيجب أن يتم ضبط تهيئة {7}CREATE_CONFIG_COAP_BlockWISE_TRANSFER_ENABLE.
التفاصيل | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
المعلَمات |
|
||||||||||||
قيم الإرجاع |
|
otCoapBlockwiseResource
struct otCoapBlockwiseResource otCoapBlockwiseResource
تمثل هذه البنية مورد CoAP مع النقل باتّجاه الحظر.
otCoapBlockwiseTransmitHok
otError(* otCoapBlockwiseTransmitHook)(void *aContext, uint8_t *aBlock, uint32_t aPosition, uint16_t *aBlockLength, bool *aMore)
يتم استدعاء مؤشر الدالة هذا قبل إرسال الحظر التالي في عملية حظر الملكية.
تتوفر هذه الدالة عند تفعيل ضبط OpenGLيجب أن يتم ضبط تهيئة {7}CREATE_CONFIG_COAP_BlockWISE_TRANSFER_ENABLE.
من خلال تغيير قيمة BlockBlock، تتم إعادة التفاوض على حجم الكتلة للتبادل بالكامل. وننصحك بإجراء ذلك بعد استلام الحظر الأول لأن التغييرات اللاحقة قد تؤدي إلى حدوث مشاكل في عمليات تنفيذ CoAP الأخرى.
التفاصيل | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
المعلَمات |
|
||||||||||
قيم الإرجاع |
|
otCoapOptionContentFormat
enum otCoapOptionContentFormat otCoapOptionContentFormat
رموز تنسيق محتوى CoAP
القائمة الكاملة موثَّقة على https://www.iana.org/assignments/core-parameters/core-parameters.xhtml#content-formats.
otCoapOptionIterator
struct otCoapOptionIterator otCoapOptionIterator
تعمل هذه البنية كمكرر لخيارات CoAP.
otCoapRequestHandler
void(* otCoapRequestHandler)(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo)
يتم استدعاء مؤشر الدالة هذا عند تلقّي طلب CoAP باستخدام مسار Uri محدد.
التفاصيل | |||||||
---|---|---|---|---|---|---|---|
المعلَمات |
|
مقبض otCoapResponse
void(* otCoapResponseHandler)(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo, otError aResult)
يتم استدعاء مؤشر الدالة هذا عند تلقّي استجابة CoAP أو عند انتهاء مهلة الطلب.
التفاصيل | |||||||||
---|---|---|---|---|---|---|---|---|---|
المعلَمات |
|
||||||||
قيم الإرجاع |
|
الدوال
otCoapAddBlockWiseResource
void otCoapAddBlockWiseResource( otInstance *aInstance, otCoapBlockwiseResource *aResource )
تضيف هذه الدالة مورد حظر الحظر إلى خادم CoAP.
التفاصيل | |||||
---|---|---|---|---|---|
المعلَمات |
|
otCoapAddResource
void otCoapAddResource( otInstance *aInstance, otCoapResource *aResource )
تضيف هذه الدالة موردًا إلى خادم CoAP.
التفاصيل | |||||
---|---|---|---|---|---|
المعلَمات |
|
otCoapBlockSizeFromExponent
uint16_t otCoapBlockSizeFromExponent( otCoapBlockSzx aSize )
تحوِّل هذه الدالة حقل خيار حظر SZX إلى حجم الكتلة الفعلي.
التفاصيل | |||
---|---|---|---|
المعلَمات |
|
||
طلبات الإرجاع |
قيمة الأُس الفعلية.
|
otCoapMessageExtensionBlock1Option
otError otCoapMessageAppendBlock1Option( otMessage *aMessage, uint32_t aNum, bool aMore, otCoapBlockSzx aSize )
تضيف هذه الدالة الخيار Block1.
التفاصيل | |||||||||
---|---|---|---|---|---|---|---|---|---|
المعلَمات |
|
||||||||
قيم الإرجاع |
|
otCoapMessageExtensionBlock2Option
otError otCoapMessageAppendBlock2Option( otMessage *aMessage, uint32_t aNum, bool aMore, otCoapBlockSzx aSize )
تضيف هذه الدالة الخيار Block2.
التفاصيل | |||||||||
---|---|---|---|---|---|---|---|---|---|
المعلَمات |
|
||||||||
قيم الإرجاع |
|
otCoapMessageExtensionContentFormatOption
otError otCoapMessageAppendContentFormatOption( otMessage *aMessage, otCoapOptionContentFormat aContentFormat )
تُلحِق هذه الدالة خيار CoAP بتنسيق المحتوى كما هو محدَّد في https://tools.ietf.org/html/rfc7252#page-92.
يجب استدعاء هذه القيمة قبل ضبط otCoapMessageSetPayloadmarker إذا تم تضمين حمولة في الرسالة.
الدالة هي برنامج تضمين ملائم حول otCoapMessageExtensionUintOption، وإذا لم يكن رمز نوع التنسيق المطلوب مُدرجًا في otCoapOptionContentFormat، فيجب استخدام هذه الدالة الأساسية بدلاً من ذلك.
التفاصيل | |||||||
---|---|---|---|---|---|---|---|
المعلَمات |
|
||||||
قيم الإرجاع |
|
otCoapMessageExtensionMaxAgeOption
otError otCoapMessageAppendMaxAgeOption( otMessage *aMessage, uint32_t aMaxAge )
تضيف هذه الدالة خيار Max-Age.
التفاصيل | |||||||
---|---|---|---|---|---|---|---|
المعلَمات |
|
||||||
قيم الإرجاع |
|
otCoapMessageExtensionObserveOption
otError otCoapMessageAppendObserveOption( otMessage *aMessage, uint32_t aObserve )
تضيف هذه الدالة خيار "الملاحظة".
التفاصيل | |||||||
---|---|---|---|---|---|---|---|
المعلَمات |
|
||||||
قيم الإرجاع |
|
otCoapMessageExtensionOption
otError otCoapMessageAppendOption( otMessage *aMessage, uint16_t aNumber, uint16_t aLength, const void *aValue )
تضيف هذه الدالة خيار CoAP في الرأس.
التفاصيل | |||||||||
---|---|---|---|---|---|---|---|---|---|
المعلَمات |
|
||||||||
قيم الإرجاع |
|
otCoapMessagePrefixProxyUriOption
otError otCoapMessageAppendProxyUriOption( otMessage *aMessage, const char *aUriPath )
تضيف هذه الدالة خيارَ Proxy-Uri.
التفاصيل | |||||||
---|---|---|---|---|---|---|---|
المعلَمات |
|
||||||
قيم الإرجاع |
|
otCoapMessageAttachmentUintOption
otError otCoapMessageAppendUintOption( otMessage *aMessage, uint16_t aNumber, uint32_t aValue )
تضيف هذه الدالة خيار CoAP لعدد صحيح غير موقَّع كما هو مُحدَّد في https://tools.ietf.org/html/rfc7252#section-3.2.
التفاصيل | |||||||
---|---|---|---|---|---|---|---|
المعلَمات |
|
||||||
قيم الإرجاع |
|
otCoapMessageGetOptionUintValue
otCoapMessageExtensionUriPathOptions
otError otCoapMessageAppendUriPathOptions( otMessage *aMessage, const char *aUriPath )
تضيف هذه الدالة خيار Uri-Path.
التفاصيل | |||||||
---|---|---|---|---|---|---|---|
المعلَمات |
|
||||||
قيم الإرجاع |
|
otCoapMessageExtensionUriQueryOption
otError otCoapMessageAppendUriQueryOption( otMessage *aMessage, const char *aUriQuery )
تضيف هذه الدالة خيار معرّف موارد منتظم (URI) واحد.
التفاصيل | |||||||
---|---|---|---|---|---|---|---|
المعلَمات |
|
||||||
قيم الإرجاع |
|
otCoapMessageCodeToString
const char * otCoapMessageCodeToString( const otMessage *aMessage )
تعرض هذه الطريقة رمز CoAP على هيئة سلسلة يمكن للمستخدمين قراءتها.
تعرض @ رمز CoAP كسلسلة.
التفاصيل | |||
---|---|---|---|
المعلَمات |
|
otCoapMessageGenerateToken
void otCoapMessageGenerateToken( otMessage *aMessage, uint8_t aTokenLength )
تحدد هذه الدالة طول الرمز المميز وتوزّع قيمته بشكل عشوائي.
التفاصيل | |||||
---|---|---|---|---|---|
المعلَمات |
|
otCoapMessageGetCode
otCoapCode otCoapMessageGetCode( const otMessage *aMessage )
تعرض هذه الدالة قيمة الرمز.
التفاصيل | |||
---|---|---|---|
المعلَمات |
|
||
طلبات الإرجاع |
تمثّل هذه الخاصية قيمة الرمز.
|
otCoapMessageGetId
uint16_t otCoapMessageGetMessageId( const otMessage *aMessage )
تعرض هذه الدالة قيمة "معرِّف الرسالة".
التفاصيل | |||
---|---|---|---|
المعلَمات |
|
||
طلبات الإرجاع |
قيمة معرِّف الرسالة.
|
otCoapMessageGetToken
const uint8_t * otCoapMessageGetToken( const otMessage *aMessage )
تعرض هذه الدالة مؤشرًا إلى قيمة الرمز المميَّز.
التفاصيل | |||
---|---|---|---|
المعلَمات |
|
||
طلبات الإرجاع |
مؤشر لقيمة الرمز المميز
|
otCoapMessageGetTokenLength
uint8_t otCoapMessageGetTokenLength( const otMessage *aMessage )
تعرض هذه الدالة طول الرمز المميز.
التفاصيل | |||
---|---|---|---|
المعلَمات |
|
||
طلبات الإرجاع |
طول الرمز المميز.
|
otCoapMessageGetType
otCoapType otCoapMessageGetType( const otMessage *aMessage )
تعرض هذه الدالة قيمة "النوع".
التفاصيل | |||
---|---|---|---|
المعلَمات |
|
||
طلبات الإرجاع |
تمثّل هذه الخاصية قيمة النوع.
|
otCoapMessageInit
void otCoapMessageInit( otMessage *aMessage, otCoapType aType, otCoapCode aCode )
تعمل هذه الدالة على إعداد عنوان CoAP.
التفاصيل | |||||||
---|---|---|---|---|---|---|---|
المعلَمات |
|
otCoapMessageInitResponse
otError otCoapMessageInitResponse( otMessage *aResponse, const otMessage *aRequest, otCoapType aType, otCoapCode aCode )
تعمل هذه الدالة على إعداد رسالة رد.
التفاصيل | |||||||||
---|---|---|---|---|---|---|---|---|---|
المعلَمات |
|
||||||||
قيم الإرجاع |
|
otCoapMessageSetCode
void otCoapMessageSetCode( otMessage *aMessage, otCoapCode aCode )
تحدّد هذه الدالة قيمة الرمز.
التفاصيل | |||||
---|---|---|---|---|---|
المعلَمات |
|
otCoapMessageSetloadloadmarker
otError otCoapMessageSetPayloadMarker( otMessage *aMessage )
تضيف هذه الدالة علامة الحمولة التي تشير إلى بداية الحمولة إلى عنوان CoAP.
التفاصيل | |||||
---|---|---|---|---|---|
المعلَمات |
|
||||
قيم الإرجاع |
|
otCoapMessageSetToken
otError otCoapMessageSetToken( otMessage *aMessage, const uint8_t *aToken, uint8_t aTokenLength )
تحدد هذه الدالة قيمة الرمز المميز وطوله في العنوان.
التفاصيل | |||||||
---|---|---|---|---|---|---|---|
المعلَمات |
|
||||||
قيم الإرجاع |
|
رسالة otCoapNewMessage
otMessage * otCoapNewMessage( otInstance *aInstance, const otMessageSettings *aSettings )
تنشئ هذه الدالة رسالة CoAP جديدة.
التفاصيل | |||||
---|---|---|---|---|---|
المعلَمات |
|
||||
طلبات الإرجاع |
إشارة إلى المخزن المؤقت للرسائل أو فارغ في حال عدم توفر ذاكرة تخزين مؤقت للرسائل أو كانت المعلمات غير صالحة.
|
otCoapOptionIteratorGetFirstOption
const otCoapOption * otCoapOptionIteratorGetFirstOption( otCoapOptionIterator *aIterator )
تعرض هذه الدالة مؤشرًا إلى الخيار الأول.
التفاصيل | |||
---|---|---|---|
المعلَمات |
|
||
طلبات الإرجاع |
مؤشر إلى الخيار الأول وفي حال عدم وجود أي خيار، يتم عرض المؤشر "خالٍ".
|
otCoapOptionIteratorGetFirstOptionMatching
const otCoapOption * otCoapOptionIteratorGetFirstOptionMatching( otCoapOptionIterator *aIterator, uint16_t aOption )
تعرض هذه الدالة مؤشرًا للخيار الأول الذي يطابق رقم الخيار المحدّد.
التفاصيل | |||||
---|---|---|---|---|---|
المعلَمات |
|
||||
طلبات الإرجاع |
مؤشر إلى خيار المطابقة الأول. وفي حال عدم وجود أي خيار مطابقة، يتم عرض المؤشر "خالٍ".
|
otCoapOptionIteratorGetNextOption
const otCoapOption * otCoapOptionIteratorGetNextOption( otCoapOptionIterator *aIterator )
تعرض هذه الدالة مؤشرًا للخيار التالي.
التفاصيل | |||
---|---|---|---|
المعلَمات |
|
||
طلبات الإرجاع |
مؤشر إلى الخيار التالي في حال عدم وجود أي خيارات أخرى، يتم عرض المؤشر "خالٍ".
|
otCoapOptionIteratorGetNextOptionMatching
const otCoapOption * otCoapOptionIteratorGetNextOptionMatching( otCoapOptionIterator *aIterator, uint16_t aOption )
تعرض هذه الدالة مؤشرًا للخيار التالي يطابق رقم الخيار المحدّد.
التفاصيل | |||||
---|---|---|---|---|---|
المعلَمات |
|
||||
طلبات الإرجاع |
مؤشر إلى خيار المطابقة التالي. وفي حال عدم وجود خيار آخر للمطابقة، يتم عرض المؤشر "خالٍ".
|
otCoapOptionIteratorGetOptionUintValue
otError otCoapOptionIteratorGetOptionUintValue( otCoapOptionIterator *aIterator, uint64_t *aValue )
تملأ هذه الدالة قيمة الخيار الحالية في aValue
على افتراض أن القيمة الحالية هي عدد صحيح غير موقَّع مرمّز وفقًا لـ https://tools.ietf.org/html/rfc7252#section-3.2.
التفاصيل | |||||||
---|---|---|---|---|---|---|---|
المعلَمات |
|
||||||
قيم الإرجاع |
|
otCoapMessageExtensionUintOption
otCoapOptionIteratorGetOptionValue
otError otCoapOptionIteratorGetOptionValue( otCoapOptionIterator *aIterator, void *aValue )
تملأ هذه الدالة قيمة الخيار الحالية في aValue
.
التفاصيل | |||||
---|---|---|---|---|---|
المعلَمات |
|
||||
قيم الإرجاع |
|
otCoapOptionIteratorInit
otError otCoapOptionIteratorInit( otCoapOptionIterator *aIterator, const otMessage *aMessage )
تعمل هذه الدالة على إعداد تكرار للخيارات في الرسالة المحدّدة.
التفاصيل | |||||
---|---|---|---|---|---|
المعلَمات |
|
||||
قيم الإرجاع |
|
otCoapRemoveBlockWiseResource
void otCoapRemoveBlockWiseResource( otInstance *aInstance, otCoapBlockwiseResource *aResource )
تزيل هذه الدالة مورد حظر الحظر من خادم CoAP.
التفاصيل | |||||
---|---|---|---|---|---|
المعلَمات |
|
otCoapRemoveResource
void otCoapRemoveResource( otInstance *aInstance, otCoapResource *aResource )
تزيل هذه الدالة موردًا من خادم CoAP.
التفاصيل | |||||
---|---|---|---|---|---|
المعلَمات |
|
otCoapSendRequest
otError otCoapSendRequest( otInstance *aInstance, otMessage *aMessage, const otMessageInfo *aMessageInfo, otCoapResponseHandler aHandler, void *aContext )
ترسل هذه الدالة طلب CoAP.
إذا كان من المتوقع الرد على الطلب، يجب تقديم معلومات عن الدالة والسياق المعنيّ. في حال عدم توقُّع استجابة، يجب أن تكون هذه الوسيطات فارغة.
التفاصيل | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
المعلَمات |
|
||||||||||
قيم الإرجاع |
|
otCoapSendRequestBlockWise
otError otCoapSendRequestBlockWise( otInstance *aInstance, otMessage *aMessage, const otMessageInfo *aMessageInfo, otCoapResponseHandler aHandler, void *aContext, otCoapBlockwiseTransmitHook aTransmitHook, otCoapBlockwiseReceiveHook aReceiveHook )
ترسل هذه الدالة طلب CoAP على مستوى الحظر.
تتوفر هذه الدالة عند تفعيل ضبط OpenGLيجب أن يتم ضبط تهيئة {7}CREATE_CONFIG_COAP_BlockWISE_TRANSFER_ENABLE.
إذا كان من المتوقع الرد على الطلب، يجب تقديم معلومات عن الدالة والسياق المعنيّ. إذا كان من المتوقع أن تكون الاستجابة من ناحية الحظر، يجب تقديم وظيفة مرتبطة ذات صلة. في حال عدم توقُّع استجابة، يجب أن تكون هذه الوسيطات فارغة.
التفاصيل | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
المعلَمات |
|
||||||||||||||
قيم الإرجاع |
|
otCoapSendRequestBlockWiseWithParameters
otError otCoapSendRequestBlockWiseWithParameters( otInstance *aInstance, otMessage *aMessage, const otMessageInfo *aMessageInfo, otCoapResponseHandler aHandler, void *aContext, const otCoapTxParameters *aTxParameters, otCoapBlockwiseTransmitHook aTransmitHook, otCoapBlockwiseReceiveHook aReceiveHook )
ترسل هذه الدالة طلب CoAP على مستوى الحظر باستخدام معلّمات نقل مخصّصة.
تتوفر هذه الدالة عند تفعيل ضبط OpenGLيجب أن يتم ضبط تهيئة {7}CREATE_CONFIG_COAP_BlockWISE_TRANSFER_ENABLE.
إذا كان من المتوقع الرد على الطلب، يجب تقديم معلومات عن الدالة والسياق المعنيّ. إذا كان من المتوقع أن تكون الاستجابة من ناحية الحظر، يجب تقديم وظيفة مرتبطة ذات صلة. في حال عدم توقُّع استجابة، يجب أن تكون هذه الوسيطات فارغة.
التفاصيل | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
المعلَمات |
|
||||||||||||||||
قيم الإرجاع |
|
otCoapSendRequestParameters
otError otCoapSendRequestWithParameters( otInstance *aInstance, otMessage *aMessage, const otMessageInfo *aMessageInfo, otCoapResponseHandler aHandler, void *aContext, const otCoapTxParameters *aTxParameters )
ترسل هذه الدالة طلب CoAP مع معلّمات النقل المخصّصة.
إذا كان من المتوقع الرد على الطلب، يجب تقديم معلومات عن الدالة والسياق المعنيّ. في حال عدم توقُّع استجابة، يجب أن تكون هذه الوسيطات فارغة.
التفاصيل | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
المعلَمات |
|
||||||||||||
قيم الإرجاع |
|
otCoapSendResponse
otError otCoapSendResponse( otInstance *aInstance, otMessage *aMessage, const otMessageInfo *aMessageInfo )
ترسل هذه الدالة استجابة CoAP من الخادم.
التفاصيل | |||||||
---|---|---|---|---|---|---|---|
المعلَمات |
|
||||||
قيم الإرجاع |
|
otCoapSendResponseBlockWise
otError otCoapSendResponseBlockWise( otInstance *aInstance, otMessage *aMessage, const otMessageInfo *aMessageInfo, void *aContext, otCoapBlockwiseTransmitHook aTransmitHook )
ترسل هذه الدالة استجابة CoAP على مستوى الحظر من الخادم.
تتوفر هذه الدالة عند تفعيل ضبط OpenGLيجب أن يتم ضبط تهيئة {7}CREATE_CONFIG_COAP_BlockWISE_TRANSFER_ENABLE.
التفاصيل | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
المعلَمات |
|
||||||||||
قيم الإرجاع |
|
otCoapSendResponseBlockWiseWithParameters
otError otCoapSendResponseBlockWiseWithParameters( otInstance *aInstance, otMessage *aMessage, const otMessageInfo *aMessageInfo, const otCoapTxParameters *aTxParameters, void *aContext, otCoapBlockwiseTransmitHook aTransmitHook )
ترسل هذه الدالة حظر CoAP على مستوى الحظر من الخادم باستخدام مُعلّمات الإرسال المخصّصة.
تتوفر هذه الدالة عند تفعيل ضبط OpenGLيجب أن يتم ضبط تهيئة {7}CREATE_CONFIG_COAP_BlockWISE_TRANSFER_ENABLE.
التفاصيل | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
المعلَمات |
|
||||||||||||
قيم الإرجاع |
|
otCoapSendResponseWithParameters
otError otCoapSendResponseWithParameters( otInstance *aInstance, otMessage *aMessage, const otMessageInfo *aMessageInfo, const otCoapTxParameters *aTxParameters )
ترسل هذه الدالة استجابة CoAP من الخادم تتضمن معلمات إرسال مخصصة.
التفاصيل | |||||||||
---|---|---|---|---|---|---|---|---|---|
المعلَمات |
|
||||||||
قيم الإرجاع |
|
otCoapSetDefaultHandler
void otCoapSetDefaultHandler( otInstance *aInstance, otCoapRequestHandler aHandler, void *aContext )
تحدد هذه الدالة المعالج التلقائي لطلبات CoAP التي لم تتم معالجتها.
التفاصيل | |||||||
---|---|---|---|---|---|---|---|
المعلَمات |
|
otCoapStart
otError otCoapStart( otInstance *aInstance, uint16_t aPort )
تبدأ هذه الدالة خادم CoAP.
التفاصيل | |||||
---|---|---|---|---|---|
المعلَمات |
|
||||
قيم الإرجاع |
|
otCoapStop
otError otCoapStop( otInstance *aInstance )
توقف هذه الدالة خادم CoAP.
التفاصيل | |||
---|---|---|---|
المعلَمات |
|
||
قيم الإرجاع |
|
وحدات ماكرو
OT_COAP_CODE
OT_COAP_CODE ((((c)&0x7) << 5) | ((d)&0x1f))
وحدة ماكرو للمساعد لتحديد قيم رمز CoAP.
OT_COAP_DEFAULT_Token_LENGTH
OT_COAP_DEFAULT_TOKEN_LENGTH 2
طول الرمز المميز التلقائي.
OT_COAP_MAX_RETRANSMIT
OT_COAP_MAX_RETRANSMIT 20
يتم دعم الحد الأقصى للإرسال.
OT_COAP_MAX_Token_LENGTH
OT_COAP_MAX_TOKEN_LENGTH 8
الحد الأقصى لطول الرمز المميز كما هو محدَّد (RFC 7252).
OT_COAP_MIN_ACK_TIMEOUT
OT_COAP_MIN_ACK_TIMEOUT 1000
يتم بلوغ الحد الأدنى لانتهاء مهلة ACK بالمللي ثانية من خلال OpenThread.
OT_DEFAULT_COAP_PORT
OT_DEFAULT_COAP_PORT 5683
منفذ CoAP التلقائي، كما هو محدد في RFC 7252.
المراجع
تنشأ مواضيع واجهة برمجة التطبيقات المرجعية لـ OpenThread من رمز المصدر، المتوفر على GitHub. للاطّلاع على مزيد من المعلومات أو للمساهمة في مستنداتنا، يُرجى الرجوع إلى المراجع.