Github user zwoop commented on a diff in the pull request:

    https://github.com/apache/trafficserver/pull/736#discussion_r68465162
  
    --- Diff: proxy/InkAPI.cc ---
    @@ -8941,3 +8942,110 @@ TSVConnReenable(TSVConn vconn)
         }
       }
     }
    +
    +// APIs for managing and using UUIDs.
    +TSUuid
    +TSUuidCreate(void)
    +{
    +  ATSUuid *uuid = new ATSUuid();
    +  return (TSUuid)uuid;
    +}
    +
    +TSReturnCode
    +TSUuidDestroy(TSUuid uuid)
    +{
    +  sdk_assert(sdk_sanity_check_null_ptr((void *)uuid) == TS_SUCCESS);
    +  ATSUuid *u = (ATSUuid *)uuid;
    +
    +  if (u->alive()) {
    +    delete u;
    +    return TS_SUCCESS;
    +  }
    +
    +  return TS_ERROR;
    +}
    +
    +TSReturnCode
    +TSUuidCopy(TSUuid dest, const TSUuid src)
    +{
    +  sdk_assert(sdk_sanity_check_null_ptr((void *)dest) == TS_SUCCESS);
    +  sdk_assert(sdk_sanity_check_null_ptr((void *)src) == TS_SUCCESS);
    +
    +  ATSUuid *d = (ATSUuid *)dest;
    +  ATSUuid *s = (ATSUuid *)src;
    +
    +  if (d->alive() && s->alive() && s->valid()) {
    +    *d = *s;
    +    return TS_SUCCESS;
    +  }
    +
    +  return TS_ERROR;
    +}
    +
    +TSReturnCode
    +TSUuidInitialize(TSUuid uuid, TSUuidVersion v)
    +{
    +  sdk_assert(sdk_sanity_check_null_ptr((void *)uuid) == TS_SUCCESS);
    +  ATSUuid *u = (ATSUuid *)uuid;
    +
    +  if (u->alive()) {
    +    u->initialize(v);
    +    return u->valid() ? TS_SUCCESS : TS_ERROR;
    +  }
    +
    +  return TS_ERROR;
    +}
    +
    +const TSUuid
    +TSProcessUuidGet(void)
    +{
    +  Machine *machine = Machine::instance();
    +  return (TSUuid)(&machine->uuid);
    +}
    +
    +const char *
    +TSUuidStringGet(const TSUuid uuid)
    +{
    +  sdk_assert(sdk_sanity_check_null_ptr((void *)uuid) == TS_SUCCESS);
    +  ATSUuid *u = (ATSUuid *)(uuid);
    +
    +  if (u->alive() && u->valid()) {
    +    return u->getString();
    +  }
    +
    +  return NULL;
    +}
    +
    +TSReturnCode
    +TSUuidStringParse(TSUuid uuid, const char *str)
    +{
    +  sdk_assert(sdk_sanity_check_null_ptr((void *)uuid) == TS_SUCCESS);
    +  sdk_assert(sdk_sanity_check_null_ptr((void *)str) == TS_SUCCESS);
    +  ATSUuid *u = (ATSUuid *)uuid;
    +
    +  if (u->alive() && u->parseString(str)) {
    +    return TS_SUCCESS;
    +  }
    +
    +  return TS_ERROR;
    +}
    +
    +TSUuidVersion
    +TSUuidVersionGet(TSUuid uuid)
    +{
    --- End diff --
    
    Sanity check?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to