@@ -104,6 +104,12 @@ extern "C" {
104
104
#define PICOQUIC_ERROR_PATH_ID_INVALID (PICOQUIC_ERROR_CLASS + 60)
105
105
#define PICOQUIC_ERROR_RETRY_NEEDED (PICOQUIC_ERROR_CLASS + 61)
106
106
#define PICOQUIC_ERROR_SERVER_BUSY (PICOQUIC_ERROR_CLASS + 62)
107
+ #define PICOQUIC_ERROR_PATH_DUPLICATE (PICOQUIC_ERROR_CLASS + 63)
108
+ #define PICOQUIC_ERROR_PATH_ID_BLOCKED (PICOQUIC_ERROR_CLASS + 64)
109
+ #define PICOQUIC_ERROR_PATH_CID_BLOCKED (PICOQUIC_ERROR_CLASS + 65)
110
+ #define PICOQUIC_ERROR_PATH_ADDRESS_FAMILY (PICOQUIC_ERROR_CLASS + 66)
111
+ #define PICOQUIC_ERROR_PATH_NOT_READY (PICOQUIC_ERROR_CLASS + 67)
112
+ #define PICOQUIC_ERROR_PATH_LIMIT_EXCEEDED (PICOQUIC_ERROR_CLASS + 68)
107
113
108
114
/*
109
115
* Protocol errors defined in the QUIC spec
@@ -274,7 +280,8 @@ typedef enum {
274
280
picoquic_callback_path_deleted , /* An existing path has been deleted */
275
281
picoquic_callback_path_quality_changed , /* Some path quality parameters have changed */
276
282
picoquic_callback_path_address_observed , /* The peer has reported an address for the path */
277
- picoquic_callback_app_wakeup /* wakeup timer set by application has expired */
283
+ picoquic_callback_app_wakeup , /* wakeup timer set by application has expired */
284
+ picoquic_callback_next_path_allowed /* There are enough path_id and connection ID available for the next path */
278
285
} picoquic_call_back_event_t ;
279
286
280
287
typedef struct st_picoquic_tp_prefered_address_t {
@@ -858,6 +865,47 @@ void picoquic_set_rejected_version(picoquic_cnx_t* cnx, uint32_t rejected_versio
858
865
* Like all user-level networking API, the "probe new path" API assumes that the
859
866
* port numbers in the socket addresses structures are expressed in network order.
860
867
*
868
+ * If an error occurs during a call to picoquic_probe_new_path_ex,
869
+ * the function returns an error code describing the issue:
870
+ *
871
+ * PICOQUIC_ERROR_PATH_DUPLICATE: there is already an existing path with
872
+ * the same 4 tuple. This error only happens if the multipath extensions
873
+ * are not negotiated, because the multipath extensions allow creation of
874
+ * multiple paths with the same 4 tuple.
875
+ *
876
+ * PICOQUIC_ERROR_PATH_ID_BLOCKED: when using the multipath extension,
877
+ * the peers manage a max_path_id value. The code cannot create a new path
878
+ * if the path_id would exceed the limit negotiated with the peer. Applications
879
+ * encountering that error code should wait until the peer has increased the limit.
880
+ * They may want to signal the issue to the peer by queuing a PATHS_BLOCKED frame.
881
+ *
882
+ * PICOQUIC_ERROR_PATH_CID_BLOCKED: when using the multipath extension,
883
+ * the peers use NEW_PATH_CONNECTION_ID frame to provide CIDs associated with each
884
+ * valid path_id. The error occurs when the peer has not yet provided CIDs for the
885
+ * next path_id. Applications encountering the error should wait until the peer
886
+ * provides CID for the path. They may want to signal the issue to the peer by
887
+ * queuing a PATH_CIDS_BLOCKED frame.
888
+ *
889
+ * PICOQUIC_ERROR_PATH_ADDRESS_FAMILY: API error. The application is trying
890
+ * to use a four tuple with different address family for source and destination.
891
+ *
892
+ * PICOQUIC_ERROR_PATH_NOT_READY: API error. The application is trying to create
893
+ * paths before the connection handshake is complete. The application should wait
894
+ * until it is notified that the connection is ready.
895
+ *
896
+ * PICOQUIC_ERROR_PATH_LIMIT_EXCEEDED: The application is trying to create more
897
+ * simultaneous paths than allowed. It will need to close one of the existing paths
898
+ * before creating a new one.
899
+ *
900
+ * The errors PICOQUIC_ERROR_PATH_ID_BLOCKED, PICOQUIC_ERROR_PATH_CID_BLOCKED.
901
+ * PICOQUIC_ERROR_PATH_NOT_READY and PICOQUIC_ERROR_PATH_LIMIT_EXCEEDED are transient.
902
+ * The application can use the `picoquic_check_new_path_allowed` API to check whether
903
+ * a new path may be created. This function will return 1 if the path creation
904
+ * can be attempted immediately, 0 otherwise. If the return code is 0, the stack
905
+ * will issue a callback `picoquic_callback_next_path_ready` when the transient
906
+ * issues are resolved and `picoquic_probe_new_path_ex` could be called
907
+ * again.
908
+ *
861
909
* Path event callbacks can be enabled by calling "picoquic_enable_path_callbacks".
862
910
* This can be set as the default for new connections by calling
863
911
* "picoquic_enable_path_callbacks_default". If enabled, the folling events
@@ -893,10 +941,9 @@ void picoquic_set_rejected_version(picoquic_cnx_t* cnx, uint32_t rejected_versio
893
941
* maintain path data in an app specific context, it will use a call to
894
942
* "picoquic_set_app_path_ctx" to document it. The path created during
895
943
* the connection setup has the unique_path_id 0.
896
-
897
- *
944
+ *
898
945
* If an error occurs, such as reference to an obsolete unique path id,
899
- * all the functions return -1.
946
+ * all the path management functions return -1.
900
947
*
901
948
* The call to "refresh the connection ID" will trigger a renewal of the connection
902
949
* ID used for sending packets on that path. This API is mostly used in test
@@ -918,6 +965,8 @@ int picoquic_abandon_path(picoquic_cnx_t* cnx, uint64_t unique_path_id,
918
965
int picoquic_refresh_path_connection_id (picoquic_cnx_t * cnx , uint64_t unique_path_id );
919
966
int picoquic_set_stream_path_affinity (picoquic_cnx_t * cnx , uint64_t stream_id , uint64_t unique_path_id );
920
967
int picoquic_set_path_status (picoquic_cnx_t * cnx , uint64_t unique_path_id , picoquic_path_status_enum status );
968
+ int picoquic_subscribe_new_path_allowed (picoquic_cnx_t * cnx , int * is_already_allowed );
969
+
921
970
/* The get path addr API provides the IP addresses used by a specific path.
922
971
* The "local" argument determines whether the APi returns the local address
923
972
* (local == 1), the address of the peer (local == 2) or the address observed by the peer (local == 3).
0 commit comments