server: specify port as a string
[openocd.git] / src / server / server.c
index 1c556638afff7722d464c6b8ab78824580b0ce03..435ddbb7d4854234785d7a87c1c421d268b353ef 100644 (file)
@@ -238,6 +238,29 @@ int add_service(char *name, enum connection_type type, unsigned short port, int
        return ERROR_OK;
 }
 
+int add_service_pipe(char *name, const char *port, int max_connections,
+               new_connection_handler_t new_connection_handler, input_handler_t input_handler,
+               connection_closed_handler_t connection_closed_handler, void *priv)
+{
+       enum connection_type type = CONNECTION_TCP;
+       long portnumber;
+       char *end;
+       strtol(port, &end, 0);
+       if (!*end)
+       {
+               if ((parse_long(port, &portnumber) == ERROR_OK) && (portnumber == 0))
+               {
+                       type = CONNECTION_PIPE;
+               }
+       } else
+       {
+               LOG_ERROR("Illegal port number %s", port);
+               return ERROR_FAIL;
+       }
+       return add_service(name, type, portnumber, max_connections, new_connection_handler,
+                       input_handler, connection_closed_handler, priv);
+}
+
 static int remove_services(void)
 {
        struct service *c = services;
@@ -250,6 +273,12 @@ static int remove_services(void)
                if (c->name)
                        free(c->name);
 
+               if (c->type == CONNECTION_PIPE)
+               {
+                       if (c->fd != -1)
+                               close(c->fd);
+               }
+
                if (c->priv)
                        free(c->priv);
 
@@ -591,3 +620,23 @@ SERVER_PORT_COMMAND()
        }
        return ERROR_OK;
 }
+
+SERVER_PIPE_COMMAND()
+{
+       switch (CMD_ARGC) {
+       case 0:
+               command_print(CMD_CTX, "%s", *out);
+               break;
+       case 1:
+       {
+               const char * t = strdup(CMD_ARGV[0]);
+               free((void *)*out);
+               *out = t;
+               break;
+       }
+       default:
+               return ERROR_INVALID_ARGUMENTS;
+       }
+       return ERROR_OK;
+}
+

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)